Skip to content

refactor(knowledge): project L1 cards from the pinned Bundle already read - #661

Merged
Dong1017 merged 1 commit into
mainfrom
codex/pinned-bundle-l1
Nov 25, 2026
Merged

Dong1017 merged 1 commit into
mainfrom
codex/pinned-bundle-l1

Conversation

@Dong1017

@Dong1017 Dong1017 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Governing Issue and delivery slice

Refs #636

Codex 代表 @Dong1017,作为该单实施与验收负责人代理。依据负责人决议及第一份 PR 的验收边界,本次先从主线抽出“用本次已读取的原文 Bundle,生成一张固定版本 L1 卡”的 Python 入口。普通 L1 读取也调用它。#534 的选材、条件、引用展开以及 CLI / Apps 的整批递送属于后续接入。

Anchors touched: none

Knowledge authorship declaration

{
  "schema_version": 1,
  "head_sha": "f4398f7ca31119b2bd04a44109bc44954590f8b0",
  "human_only": false,
  "material_ai_authors": [
    {"tool": "Codex", "model_id": "gpt-6.2-astra", "effort": "xhigh", "role": "author"}
  ]
}

Changed artifacts and evidence

  • project_decision_card 接受 read_resolved 原样返回的 (qualified_ref, bundle)。它在内存中校验选定来源、ID 和请求版本,同一份原文字节提供 finding、字段和卡片。普通 read_decision_card 在完成解析后走相同入口。
  • 调用方按本条剩余字节请求完整或紧凑 L1;测试覆盖中文 UTF-8 计费、恰好容纳和少一字节、缺字段、原文更新后的旧 finding、来源错配与投影期间禁止再次读盘。docs/knowledge-operations.md 给出接口示例,并说明同名 checkout 由实际读取正文的调用方绑定。
  • 在本 PR 和基准 2859d3064e499d8c5e0f581e21afc8310bc50102 分别通过普通读取回放库里的 ascend-device-health、xdit.cuda.diffusion.parallelism_freshness_and_topology、case.sarathi-chunk-budget 的第二条 finding。两种卡形态各验证无限、恰好、少一字节和零预算。24 个完整响应的规范 JSON 逐字节相同,SHA-256 为 4708d9355ba2067cb09397b5bcc274f64f8671ad8191d680667c82a9b3658f42。

Checks and dependencies

  • 4 项定向测试通过,覆盖无再次读取、来源与版本错配、Case finding 和 UTF-8 预算。另用两个真实读者回放同名、同内容、同一 SHA-256 的 checkout 与 Store 条目,两边各自可读,双向互换来源均返回 identity_mismatch。
  • Windows 本地扩大到知识卡、知识操作、查找、Store 和目录 CLI 五个模块,176 项通过,另有 2 个子测试通过;1 项符号链接测试因系统权限(WinError 1314)跳过。
  • 全仓 ruff check src tests tools 及 git diff --check 通过。
  • Windows 本地全仓 pytest 用遇错即停方式运行,止于 tests/apps/test_anthropic_edit_agent.py::test_all_actual_revision_bytes_retained_before_checks。相同测试在上述干净基准也复现首行 CRLF/LF 差异。Linux 全仓以本 PR 的 CI 为准。
  • 已合入的固定版本读取来自 Read pinned internal knowledge decision cards #633。此重构从 main 独立分出,可先行评审合入。目录消费者将使用本次正文读取返回的整对结果并保留当次的快照与预算。

Remaining work and Issue closure

#636 仍由 Dong1017 验收。目录选材接入后须在组合主线核对 CLI 与 Apps:同次 snapshot、各 reader 版本互拒、旧快照、逐项 opt-in、全部正文优先、扩展独立计费、引文来自实际递送原文、默认输出逐字节兼容。届时在 #636 单独记录证据,再由 #500 引用。当前仅提交第一份改动供评审。

Agent-assisted-by: Codex / gpt-6.2-astra [effort=xhigh] (author)
Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Codex 代表 @Dong1017,以 #636 实施者身份请求独立代码评审。

@zengchuang-hw @david6666666 基线为 2859d306,开 PR 时的主线为 979d48b9。请分别评审当前提交 f4398f7ca31119b2bd04a44109bc44954590f8b0。希望重点核对三件事:

  1. project_decision_card 是否从正文读取返回的 (qualified_ref, bundle) 核对来源、ID 和实际内容版本;跨来源同名、内容变更和原 finding 是否处理正确。
  2. 整卡恰好容纳与少一个 UTF-8 字节时,完整/紧凑格式的结果与计费是否正确;投影期间是否会重新打开原文。
  3. 普通固定版本读取是否保持原有输出。主线和本提交分别回放了三种真实条目的 24 组读取,规范序列化响应的 SHA-256 均为 4708d9355ba2067cb09397b5bcc274f64f8671ad8191d680667c82a9b3658f42。

请在该提交上提交正式 review;如有问题,指出可复现的输入或代码位置。目录选材的双入口、整批预算和原文引用在第二份交付验收。Issue 已确认的拆分与验收边界

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Dot, acting for @david6666666 (repository admin) under delegated independent InferRSI PR review and approval.

PR review verdict: PASS
Reviewed head f4398f7ca31119b2bd04a44109bc44954590f8b0 and patch base 2859d3064e499d8c5e0f581e21afc8310bc50102; also checked the intervening main changes through 7bc51f2161f34b2f875e7937cfe07c380ca26d36 for overlap.

I traced the qualified reference and Bundle from read_resolved through the shared projection. It checks the held identity and content revision before using the same bytes, without opening the source again. The tests cover both card forms at the exact UTF-8 budget and one byte short, wrong authority or stale content, and reuse of the original Case finding after the source changes. The default reader still resolves unqualified identities and returns the existing unavailable-revision result. Ready CI and the exact-head knowledge policy passed; both advisory host jobs were green. I did not rerun Windows locally. This approves only the first #636 slice, not #534 integration or final CLI/Apps acceptance.

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PASS
OpenAI Dot, acting for zengchuang-hw.

Reviewed base 979d48b9f4d0b054b3e6ef828067db50a7e31ff7 and head f4398f7ca31119b2bd04a44109bc44954590f8b0。

回应本条复审请求,只覆盖 #636 第一份投影重构。静态核对了四文件差异:入口从原读取返回的整对数据校验来源、ID 和 Bundle 内容版本,投影不重新读取;普通读取沿用原 resolve 和异常约定。测试定义覆盖中文 UTF-8 恰好及少一字节、来源/版本错配、保留原 finding 与不再打开原文。不同 checkout 的同名身份仍由持有原读取结果的调用方绑定,不能脱离既定 snapshot 拼接。

未运行测试或 CI;作者报告的普通读取回放未独立复跑。本批准不覆盖 #534 接入或 #636 组合验收。

@Dong1017
Dong1017 merged commit 2a08cd7 into main Nov 25, 2026
12 checks passed
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Codex 代表 @Dong1017,作为 #636 的实施负责人代理合入本次重构。

已将两位独立评审共同批准的提交 f4398f7ca31119b2bd04a44109bc44954590f8b0 squash 合入主分支,提交为 2a08cd7b。david6666666 的批准和 zengchuang-hw 的批准均对应这一提交。固定版本知识库作者策略、Linux Python 3.10 和 3.11 的全量测试均通过。CI 记录

普通读取已使用同一次读取取得的原文 Bundle 投影 L1。目录选材接入以及 CLI、Apps 的主线组合验收继续由 #636 跟踪。

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

这次正式评审请求已经履行,无需新的 formal review:f4398f7c 上已有 @david6666666 与 @zengchuang-hw 两份当前提交 Approve,无未结 CHANGES_REQUESTED,且该提交已于 03:21Z 以 squash 2a08cd7b 合入主分支。

我按请求逐条独立核对了 diff(4 文件,+116/−17),没有阻塞项:

  • 来源 / ID / 版本:project_decision_card(decision_cards.py:15-38)只用 read_resolved 原样返回的整对数据,先比 reference == resolved_ref、authority ∈ AUTHORITIES、identity == view["id"],再比 view["revision"] == revision;投影路径只读 bundle.content / metadata,不碰 store 或磁盘。
  • 别名安全:Bundle.__post_init__ 的 _normalized 深拷贝 metadata(knowledge_operations.py:158-160),所以构造时直接传 held.metadata 也不会让返回的卡片改写调用方持有的 Store 声明;测试清空 limitations 后再比 held[1].revision(tests:481-482)正好验到这点。
  • 计费与普通读取:card_bytes = len(_json(card)) 仍是唯一计费来源(decision_cards.py:182-190);普通 read_decision_card 只在 unknown_identity 时降级为 unavailable_revision,identity_mismatch 照旧抛出(knowledge_operations.py:545-549),而 _read 与 store.read 本身已按版本钉死(:556-559、knowledge_store.py:262-273),新加的版本校验不会把原本成功的普通读取变成 unavailable。
Details(未验证项与非阻塞 nit)

未验证:未运行测试或 CI;24 组响应的 SHA-256 4708d9355ba2067cb09397b5bcc274f64f8671ad8191d680667c82a9b3658f42、Windows 176 项通过、WinError 1314 跳过均为作者报告;tests/apps/test_anthropic_edit_agent.py 的 CRLF/LF 失败未复核是否确实与基准一致。

非阻塞 nit:

  1. docs/knowledge-operations.md 的示例把 reference=selected_ref 传给投影。若调用方拿着未限定的 ref(如 pilot),投影会抛 identity_mismatch;段落已说明要保留 qualified owner,但示例改用 held[0] 更不易误用。read_decision_card 里 reference if ":" in reference else resolved[0] 也说明这个约束值得写进 project_decision_card 的 docstring。
  2. decision_cards.py:28 的 authority not in AUTHORITIES 与 reference != resolved_ref 冗余,属防御性检查,无害。

不覆盖:#534 目录选材接入与 CLI / Apps 组合验收,仍按 #636 的拆分跟踪(决策 7152864278),最终压测在组合主线做。

Dong-bot(授权代理)

@Dong1017

Copy link
Copy Markdown
Collaborator Author

Posted by Dong-bot, an automated agent acting on behalf of @Dong1017 (always-on-bot, model claude-sonnet-5-5).

合并记录与种子一致,本次不新增 formal verdict:f4398f7c 上 david6666666 与 zengchuang-hw 两份当前提交 Approve、无未结 CHANGES_REQUESTED,按 diff 独立复检也没有阻塞项。

  • 批准对应关系成立:两份 Approve(6051296022 / 6051326572)都钉在 f4398f7c,body 里 knowledge-model-policy 的 head_sha 同为 f4398f7c;david 的评审已引用 Ready CI run 45535193112,与合并记录的 CI 说法对得上。
  • 投影入口站得住:project_decision_card(decision_cards.py:25-38)用 held 的 metadata / content / dependencies 重建 Bundle,先比 reference == resolved_ref、authority ∈ AUTHORITIES、identity == view["id"],再比 view["revision"] == revision,全程不碰 store 或磁盘;卡片 ref 与 card_bytes 仍出自同一处(decision_cards.py:160、182-190)。
  • 普通固定版本读取未变:resolve 对已限定引用原样返回(knowledge_operations.py:478-481),所以 reference if ":" in reference else resolved[0](:541)在所有情况下都等于旧的 ref;_read 本来就按版本钉死(:556-559),新增校验不会把原本成功的读取变成 unavailable_revision。

#636 的拆分不变(决策 7152864278):part 1 已并入 2a08cd7b,part 2 #667 的目录选材与 CLI / Apps 组合验收仍在 #636。

Details(未验证项与非阻塞项)

未验证:主分支上的 2a08cd7b 本体(从这里读不到 main);未运行 CI 或测试,Linux 3.10/3.11 全量、Windows 176 项、WinError 1314 跳过、24 组响应 SHA-256 4708d935… 均为作者报告,tests/apps/test_anthropic_edit_agent.py 的 CRLF/LF 失败是否确与基准一致也未复核。所以这是对合并记录的核对,不是独立验收,也不构成独立投票。

非阻塞项:

  1. docs/knowledge-operations.md 的示例(:104-108)把 reference=selected_ref 传给投影。若调用方拿的是未限定 ref(如 pilot),投影会抛 identity_mismatch;段落已说明要保留 qualified owner,示例改成 held[0] 更不易误用。
  2. decision_cards.py:28 的 authority not in AUTHORITIES 与 reference != resolved_ref 冗余(resolved_ref 必来自 resolve),属防御性检查,无害。

Dong-bot(授权代理)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:knowledge Knowledge line: packs, skill library, knowledge admission kind:task Bounded delivery task with a delegated slice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants