<feed xmlns='http://www.w3.org/2005/Atom'>
<title>living-village.git/src/LivingVillage.Kernel.Tests/TradeTests.fs, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<id>http://git.somhairle.bid/living-village.git/atom?h=main</id>
<link rel='self' href='http://git.somhairle.bid/living-village.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.somhairle.bid/living-village.git/'/>
<updated>2026-09-22T02:46:16+00:00</updated>
<entry>
<title>perf(kernel): P27 第二步 — Rumor 扫描去装箱 + 裁剪判定 O(1)</title>
<updated>2026-09-22T02:46:16+00:00</updated>
<author>
<name>Somhairle H. Marisol</name>
<email>muqiu-han@outlook.com</email>
</author>
<published>2026-09-22T02:46:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.somhairle.bid/living-village.git/commit/?id=a0597455629618a282b582d13c23bfeab786e7d2'/>
<id>urn:sha1:a0597455629618a282b582d13c23bfeab786e7d2</id>
<content type='text'>
两条互相独立、均不改变保留集合与查询结果的优化：

1) 扫描去装箱：latestRumorFor / rumorIsDuplicate 用 `=` 比较 [&lt;Struct&gt;] 的
   NpcId/RumorId（含 RumorId option）会走泛型结构相等并逐条装箱（实测 ~24 B/条，
   Sim.chat 单独测得 N=16000 时 393,736 B/次、随 N 线性）。改为先解构底层
   int/int64 再比较；Parent 用 int64 option 比较替代 RumorId option 结构相等。
   语义完全等价，扫描不再逐条分配。

2) 裁剪判定 O(1)：World 新增派生镜像 RumorCount/RumorOldestDay（不参与存档，
   读档由列表经 rumorWorkingSetStats 重建）。appendRumor 用「count+1&gt;capacity
   或 min(oldest,day)&lt;cutoff」O(1) 判定，仅真需裁剪时才走 trimRumors；旧 consRumor
   每次追加都 rumorsNeedTrim 全表扫一遍。条件与 needTrim 逐字等价，保留集合相同。

等价性验证：5 天 2000 聊天/天跑两遍 WorldSave.save 逐字节相同，
RumorCount/RumorOldestDay 与对列表重算一致（count=8000、oldest_day=1）。

Kernel 长跑基准 30 NPC × 2000 聊天/天（--rumor-bench D 30 2000）：
 days  修复前 alloc / ms        修复后 alloc / ms
  3    930,716,456 / 1626.7     482,716,192 / 1511.3
 30  13,419,045,864 / 12182.5  4,884,067,640 / 8879.6
 60  27,297,668,608 / 23769.7  9,774,660,360 / 17078.2
60 天分配 -64%、耗时 -28%，retained_id_checksum=927964000 前后一致。

门槛：final_digest=953775FAEB2F... 三次一致、performance_determinism=PASS；
Kernel 92 / Desktop 143 全绿；--cost-probe 1/5 天 18.7s/18.8GB、90.4s/94.6GB
（全模拟分配由逐 tick NPC 快照主导，谣言子系统占比很小，故全模拟基本持平）。
</content>
</entry>
<entry>
<title>feat(m5): 增加可交互对话、需求观察与编年史</title>
<updated>2026-09-20T06:20:54+00:00</updated>
<author>
<name>Somhairle H. Marisol</name>
<email>muqiu-han@outlook.com</email>
</author>
<published>2026-09-20T06:20:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.somhairle.bid/living-village.git/commit/?id=7e197babfbb68d7f7d1866d6a0ca47cf17d3af23'/>
<id>urn:sha1:7e197babfbb68d7f7d1866d6a0ca47cf17d3af23</id>
<content type='text'>
[变更性质]
- 本提交新增 M5 用户能力，不是缺陷修复。

[新增功能]
- 增加玩家六意图对话、需求面板、可见 NPC 观察、编年史与因果谣言冒烟验收。

[实现方案]
- 在 Kernel 中扩展 Avatar Mind、对话结果、观察数据、Annals 和确定性谣言链。
- 在 Desktop 中加入键盘交互、像素文本面板和运行时状态展示，并补充 Headless 与测试覆盖。

[影响范围]
- 覆盖 Kernel、Headless、Desktop 及测试工程；保留既有 M3/M4 确定性与交易、关系、谣言行为。
</content>
</entry>
<entry>
<title>feat(m4b): 增加可追踪谣言传播与回放</title>
<updated>2026-09-20T04:18:38+00:00</updated>
<author>
<name>Somhairle H. Marisol</name>
<email>muqiu-han@outlook.com</email>
</author>
<published>2026-09-20T04:18:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.somhairle.bid/living-village.git/commit/?id=4f8aca922e6cf47dce95aab79541065d487d5272'/>
<id>urn:sha1:4f8aca922e6cf47dce95aab79541065d487d5272</id>
<content type='text'>
[变更性质]
- 本提交新增 M4b 谣言传播与确定性验收能力，不是单纯缺陷修复。

[新增功能]
- 支持带来源、父节点、深度、强度和路径的谣言传播、去重、衰减与过期处理。
- Headless 支持稳定谣言 dump、replay，以及与 batch 模式的互斥校验。

[实现方案]
- 通过不可变 World 更新和失败原子返回保持模拟确定性。
- 新增多跳传播、重复转述、过期父节点、非法参与者和稳定 trace 测试。

[影响范围]
- 影响 Kernel、Headless 和 Kernel 测试；不包含 M5/M6 或无关配置与文档改动。
</content>
</entry>
<entry>
<title>feat(m4a): 增加交易库存金钱与动态定价</title>
<updated>2026-09-20T03:29:11+00:00</updated>
<author>
<name>Somhairle H. Marisol</name>
<email>muqiu-han@outlook.com</email>
</author>
<published>2026-09-20T03:29:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.somhairle.bid/living-village.git/commit/?id=23a9235f29e92adb51c3bf1a71f92cd8434e0939'/>
<id>urn:sha1:23a9235f29e92adb51c3bf1a71f92cd8434e0939</id>
<content type='text'>
[变更性质]
- 本提交新增 M4a 交易能力，不扩大到 M4b、M5 或 M6。

[新增功能]
- 支持 Food 库存、买卖双方金钱转移、原子成功与拒绝结果。
- 支持基于需求、库存、性格和近期成交记忆的动态定价。

[实现方案]
- 在 Sim 中增加 TradeRequest、TradeResult、交易失败类型、交易记忆与 TradeEvent。
- 以不可变 World 更新和确定性定价保持库存、金钱及事件守恒。
- 增加交易测试，并补齐既有 NPC fixture 与 MemoryKind 穷举匹配。

[影响范围]
- 仅影响 LivingVillage.Kernel 交易逻辑及五个 M4a 相关测试项目文件。
</content>
</entry>
</feed>
