Repository navigation
Update material metadata without losing source provenance - #9432
huangruiteng merged 4 commits into
Conversation
Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
[P2] 共享摘要写入被拒绝时命令仍报告成功。 项目 registry 可写,但同一次默认更新所需的共享 registry 不可写。 项目记录提交,直接同步返回 1,但 metadata update 返回 0 和顶层 ok=true。嵌套结果说明写入拒绝且共享文件没变,Markdown 只显示 global_sync_wrote=False,没有显示错误原因。 相关行
动机 / Motivation
材料维护者更新已登记文档的时效或访问状态,需要知道项目级写入和共享摘要刷新分别是否落盘。 旧入口重登记整条材料。只想改时效时需要重新提供来源,否则可能丢失原本保存的摘要。 脚本依赖退出码决定是否重试。假成功会使共享摘要仍旧,调用者却继续使用旧状态。 使用临时项目和共享 registry 登记一条合成来源。先预览只改时效和状态,再使共享 registry 不可写,最后恢复写入并重试。 预览保持两个文件原字节,实际修改只更新请求的字段。恢复写入后重试成功,inventory 回读保留来源摘要、原版本和 topic。 共享摘要拒绝写入时,默认更新命令仍把部分完成显示为成功。 只用临时 registry 和合成来源,运行实际本地命令。
项目记录提交,直接同步返回 1,但 metadata update 返回 0 和顶层 ok=true。嵌套结果说明写入拒绝且共享文件没变,Markdown 只显示 global_sync_wrote=False,没有显示错误原因。
改动思路 / Approach
仍由已存在的项目 registry reducer 和共享同步函数分别负责实际写入。CLI 回执应组合这两个写入结果,用户文档也据此说明如何处理部分完成。 补上材料元数据更新及保留来源摘要。默认共享刷新拒绝时仍需给出正确的失败与重试状态。 将共享同步返回的结构化失败传到默认更新的顶层状态和退出码,保留 written=true 及嵌套错误,Markdown 也显示失败原因。维持 --no-global-sync 的显式仅本地路径。
具体改动 / Changes
精确头 8eb8a84478f4205714063a6f880badc8888042fc,目标分支快照 f37e1c6589dd43cc80049c0d187fb86abdc9f33c。6 个文件新增 307 行、删除 20 行。保留原登记 reducer、共享刷新与两个命令。新增显式 metadata patch 和对应用户说明。 主干没有 metadata update。现有 sync-global 对写入拒绝返回 1。本头新命令在相同隔离状态下回报退出 0,用户需要另读嵌套结果。
关键代码讲解
-
update_authority_source。用同一项目 reducer 合并用户明确传入的字段。 源码 -
reduce。在已有材料上合并元数据,由已有 owner 更新项目 registry。 源码 -
共享摘要同步调用。收取嵌套写入结果,当前未把其中的失败传播到命令状态。 源码 -
_render_authority_markdown。渲染项目写入及共享刷新结果,默认人读输出目前只有共享写入布尔值。 源码 -
MATERIAL_METADATA_PARTIAL_WRITE 尚未满足。材料状态更新保留可溯源的原条目,并准确回报默认选择的本地写入与共享刷新结果。 现有依据
对主干的风险 / Risks
项目 registry 可写,但同一次默认更新所需的共享 registry 不可写。 在隔离 registry 上用真实文件权限制造写入拒绝,比较 metadata update 的 JSON、默认 Markdown、现有 sync-global 和恢复后的同命令重试。 项目记录提交,直接同步返回 1,但 metadata update 返回 0 和顶层 ok=true。嵌套结果说明写入拒绝且共享文件没变,Markdown 只显示 global_sync_wrote=False,没有显示错误原因。 采用既有 ok、written、global_sync 和 write_denied 表示两段写入。新命令名称属于 CLI。 默认更新要求共享同步。显式禁用同步时命令按项目写入结果退出。
语义与 CI 对齐
PASS — 91 项相关测试、本地所选的 8 项预合并及 git diff --check 通过。独立运行体积 smoke 在分叉基线和两份候选都报 11951/11400,属于相同现存失败。 FAIL — 本轮的部分完成或诊断回显反例。 UNVERIFIED — 本轮验证覆盖本机文件权限失败和恢复。托管 CI 及外部来源读取未查询。
我的整体评价 / Verdict
REQUEST_CHANGES。 来源保留和本地更新到位,共享写入拒绝还缺少可靠的外层失败信号。 补上材料元数据更新及保留来源摘要。默认共享刷新拒绝时仍需给出正确的失败与重试状态。 将共享同步返回的结构化失败传到默认更新的顶层状态和退出码,保留 written=true 及嵌套错误,Markdown 也显示失败原因。维持 --no-global-sync 的显式仅本地路径。
English verdict: REQUEST_CHANGES. When the shared registry denies a write, the default metadata update exits successfully even though only the local update committed.
Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
材料维护者更新来源时效、复核或访问状态,依赖 CLI 回执决定下一步。 主干的登记命令重建材料条目。早一版更新命令虽然保留来源摘要,但共享摘要写入被拒时,退出码仍为 0。 对旧评审提交和当前头走相同 CLI 序列。登记合成来源、预览、阻断共享写入、更新元数据,再记录新状态和单独执行 sync-global。 预览保留两个文件的原始字节。实际更新锁内合并指定字段,保留原引用摘要、版本和 topic。恢复后的共享计数反映新状态,项目文件原字节保持。共享目录写入被拒时,旧头 JSON 与 Markdown 均退出 0,当前头均退出 1。当前 JSON 保留 written=true、global_sync.write_denied=true 和顶层 ok=false,Markdown 显示权限错误。 验证限当前机器的非 root POSIX、隔离项目和共享文件。Windows 权限语义、已安装版和托管 CI 未验证。 上轮评审
改动思路 / Approach
沿用现有材料登记 owner、项目注册表事务和共享摘要投影。新增能力限对现有材料的显式 patch。 项目 registry codec 持有锁和写入,_apply_authority_entry 更新同一条材料及投影,现有共享同步在自己的锁内读取当前项目。CLI 组合两段回执。 单改文档可提示 re-register,但操作者无法从摘要重建原始引用。对现有条目做递增字段更新,并复用投影 owner,才能保护来源链。 共享权限故障有结构化回执,按同一 Goal 和 runtime root 重做共享投影即可。
具体改动 / Changes
当前精确提交 ab42bb0bd8cfe4358df7b146adb8c07a687a1a9a,目标分支快照和共同祖先 f37e1c6589dd43cc80049c0d187fb86abdc9f33c。6 个文件,+372 / −21。旧头到当前头补上共享同步失败传播、Markdown 回显及仅同步恢复。适配器进入既有 CLI package,扩充 help 和复验。
关键代码讲解
-
update_authority_source。仅接受显式记录的元数据字段。锁内读取、合并和提交原条目。 源码 -
_apply_authority_entry。更新原有 project_materials、紧凑来源显示与摘要计数。 源码 -
handle_registry_authority_command。共享写入拒绝传至顶层状态,同时保留项目已写入回执。 源码 -
render_authority_source_markdown。渲染新的元数据更新入口与已有写入、失败字段。 源码 -
Metadata update recovery。指向原 Goal 和 runtime root 的 sync-global,避免重放旧字段。 源码 -
Stored Shape。项目条目保留经过脱敏的来源标识与摘要。共享注册表只接收材料摘要计数。 登记合同
对主干的风险 / Risks
共享目录写入被拒时,旧头 JSON 与 Markdown 均退出 0,当前头均退出 1。当前 JSON 保留 written=true、global_sync.write_denied=true 和顶层 ok=false,Markdown 显示权限错误。 恢复阶段再次读取用户最新提交的项目状态,避免重复发送旧的元数据补丁。显式仅本地更新仍成功,预览也保持项目和共享两个文件的原字节。来源引用采用合成的不可用文件,整个登记、更新和回读都完成,原摘要、版本及 topic 留存。共享投影仍限摘要计数。
语义与本地验证
45 项材料维护、来源读取、完整性及 registry 回归通过。标准本地 premerge 的 8 项 catalog 检查及直接检查通过,包含 CLI 输出预算。 独立的旧头与当前头对照各覆盖 JSON、Markdown 及真实文件权限恢复。验证限当前机器的非 root POSIX、隔离项目和共享文件。Windows 权限语义、已安装版和托管 CI 未验证。
我的整体评价 / Verdict
APPROVE。 当前提交补上原部分写入问题,并保留项目注册材料及仅同步恢复入口。保留退出状态和写入标记。共享侧恢复后单独 sync-global,维持项目端随后写入的内容。
English verdict: APPROVE. The exact head reports partial write failures and supports sync-only recovery while preserving the original material provenance.
Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
为已注册材料补上就地更新记录元数据的入口。维护者可以记录过期或访问受阻,同时保留原来源、版本和 topic。 原 CLI 重新注册同一 source_id 会整体替换条目,省略原引用和 revision 时会丢失两者。上一提交的 update 在 source-session 边界只拦截 preview,apply 的旧 object 路径未执行同一规则。 负责维护项目级材料清单且持有所选 registry 写权限的操作者。
原 URL 不保存在 registry,旧命令覆盖引用摘要后无法仅从 registry 恢复。这使本应只改 freshness 的普通操作损伤决策依据。 同一 source 的预览保留项目字节,只提交显式字段;回读保留引用摘要、原 revision、登记时间与 topic。原 register 仍沿用整条替换语义。 精确头 update CLI 和 source-session 架构回归共 33 项通过。另用独立 CLI 夹具核对基线重新注册、source-session 拒绝、部分提交和 sync-only 恢复;git diff --check 与当前目标 merge-tree 通过。 使用源检出与非 root POSIX 隔离 registry。Windows、安装版和远程 CI 未核验。CLI 输出预算 smoke 在精确目标 f37e1c6 和当前头均失败,heartbeat_prompt_brief/json 同为 11951 字符,对应 11400 上限。完整标准预合并与测试套件本轮未运行。 基线契约
改动思路 / Approach
该改动沿用 现有 CLI → project registry 原生事务 → authority-sources 回读或共享摘要同步。两个入口都调用同一个 reducer,来源完整性在锁内使用当前 registry 判断。摘要失败时保留项目提交事实,sync-global 重新读当前项目快照。 preview 在副本上执行同一 reducer;apply 经现有 writer 确认后在锁内运行 reducer。失败结果区分项目提交和共享投影状态。 复用现有注册和投影 owner。显式 metadata patch 比再次登记或要求保存原 URL 更贴合操作,无需新存储格式。
具体改动 / Changes
精确提交 050391a,本次对照目标 f37e1c6。完整 diff 为 7 个文件 +393/-21。相对上一提交新增内容限于把同一 source-session guard 放进 reducer、对应入口测试以及静态扫描 allowlist。
关键代码讲解
-
reduce。在 lookup 或修改前调用 lifecycle-only profile guard,preview 与 apply 共用。 源码 -
update_authority_source。在副本上预览,提交使用锁内快照。 源码 -
handle_registry_authority_command。同步失败保留本地 written 事实并返回错误。 源码 -
mutate_project_registry。锁内读、规约、提交,保持原 registry writer 合约。 源码 -
material-metadata-maintenance-preserves-canonical-provenance(implemented)。局部变更保留 redacted provenance,且仅在所选的权威项目 registry 内写入。共享同步不足以证明接触原材料或改变授权。
对主干的风险 / Risks
精确头对带 lifecycle-only profile 的隔离 registry 在 preview 和 apply 均拒绝,项目字节未变,共享 runtime 未创建。真实 POSIX 共享目录拒写后,CLI 退出 1 且 written=true;随后仅同步读到期间新增的 metadata,不覆盖项目状态。 项目提交和共享摘要是两次操作,期间可能有新观察或权限变化。失败后使用 sync-only 读取当前状态。 把现有 profile guard 与锁内 reducer 共用,并把默认同步错误作为顶层失败,保留已提交本地状态。
我的整体评价 / Verdict
APPROVE。 精确提交的 source-session 拒绝和材料维护边界均通过实际 CLI 验证。既有输出预算失败仍应保留在交付状态里。 维护材料状态同时保留可核验 provenance,之后的决策与恢复仍能区分旧来源和新观察。
English verdict: APPROVE at 050391a. The exact head preserves material provenance and denies both preview and apply on lifecycle-only registries. Real CLI recovery retains newer metadata after a shared-sync failure. The same pre-existing heartbeat output-budget failure reproduced at base and head.
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · GPT-5 · OpenAI · self_reported
动机 / Motivation
维护已登记材料状态的操作者在发现文档过期或访问受阻时,需要在当前项目 registry 中记录这次观察。旧指引要求重新登记整条材料。
修复前,同一 source 为改 freshness 而重登记会替换整条条目并可能丢失 revision 与 reference digest;当前 exact head 只合并显式 metadata 字段,回读保留原 source reference、登记时间、导入摘要与 topic。
真实 CLI 的 preview 不改文件,apply 只改变请求字段;source-session registry 在 preview 和 apply 都被拒绝,隔离目录的 shared-sync 拒写返回 ok=false 且 written=true,恢复后 sync-only 保留更新期间产生的新 observation。
本 PR 不打开来源、不验证当前访问、不授予权限、不刷新共享摘要以外的共享状态,也不改变 register-authority-source 的整条替换语义。
改动思路 / Approach
The change layers a narrow operation intent over existing registry mutation, material projection and sync owners.
It delivers metadata maintenance plus truthful partial-write recovery; source access and access authority remain explicitly out of scope.
主路径是 loopx update-authority-source -> update_authority_source -> mutate_project_registry -> _apply_authority_entry -> optional sync_project_registry_to_global。权威输入为 The selected project registry, its existing project_materials entry and explicit CLI metadata fields,决定边界由 The project registry transaction remains authoritative; the existing material reducer owns entry and projection updates. 持有,结果是 One existing material entry is patched in place and the compact source view plus summary are refreshed under the registry lock.,再由 JSON entry/operation/written fields, Markdown metadata-update heading and authority-sources readback 消费。The CLI composes project and shared-write receipts; sync-global is the recovery owner after shared-write failure.
具体改动 / Changes
按 docs/operations/authority-source-registration.md 的 revision 9b3f5ebeb56d82fc2b1c3a2d035933bb226a6bea 核对,material-metadata-maintenance-preserves-canonical-provenance / partial-write-visible-and-recoverable / source-session-boundary 分别对应下面的行为与验证。
关键代码讲解
update_authority_source:Validate explicit fields and patch one existing material under the project registry transaction. Before callers had to re-register the full entry; now omitted provenance, summaries and topics stay in place.handle_registry_authority_command:Route registration and metadata maintenance while composing project and shared-write outcomes. Before update had no route; now a failed shared sync makes the metadata update exit 1 while written=true remains visible._apply_authority_entry:Replace the selected material entry and refresh compact authority source and projection summary. The reducer is now reused with a pre-merged entry, so only requested fields change while topic mappings and unrelated fields survive.
变更共 7 files (4 Python paths, 1 skill guide, 2 tests),393 additions、21 deletions。Add a metadata-only maintenance command, propagate shared-sync failure, cover recovery and source-session denial, and update operator guidance.
material-metadata-maintenance-preserves-canonical-provenance:A metadata-only maintenance update preserves the existing source identity and provenance while changing only explicitly requested fields.,当前为 implemented。partial-write-visible-and-recoverable:A project commit followed by shared-summary failure reports both facts and can be recovered without replaying stale metadata.,当前为 implemented。source-session-boundary:A source-session registry cannot use metadata preview or apply to mutate the project registry.,当前为 implemented。
对主干的风险 / Risks
最强回归场景是 A failed shared projection is reported as success, or an omitted field is lost during metadata maintenance.。触发状态为 A registered material with omitted provenance/topics, followed by a read-only shared runtime.;The reducer starts from the current entry and merges explicit fields; the CLI checks shared sync ok and returns failure while preserving written=true.。影响范围是 The selected project material entry, its compact source view and optional shared summary projection.,可观察性来自 operation, written, updated_fields, entry, authority_registry_summary, global_sync, Markdown heading/error and process exit status.,恢复路径是 Project transaction failure rolls back; after sync failure, restore access and run sync-global against the same Goal and runtime root.。
changed_invariant_positive=passed (53 passed, including preview/apply/readback and concurrent disjoint updates.);material_negative_or_failure=passed (Rejected paths left protected bytes unchanged; shared rejection returned ok=false, written=true and recovered through sync-global.);repository_required_checks=passed (Ruff passed; standard premerge passed all 8 selected checks with 0 failures.);remote_ci_observation=pending (Hosted jobs were still queued or using superseded earlier runs at review time.)。
- PASSED · Metadata-only update preserves reference provenance, import metadata and topics while changing requested fields.:53 passed, including preview/apply/readback and concurrent disjoint updates.
- PASSED · Source-session denial and shared-write rejection do not fabricate success or erase the local commit fact.:Rejected paths left protected bytes unchanged; shared rejection returned ok=false, written=true and recovered through sync-global.
- PASSED · Ruff, diff, RFC, maintainability, semantic vocabulary, output budget and related catalog checks.:Ruff passed; standard premerge passed all 8 selected checks with 0 failures.
- PENDING · Remote CI for the merged exact head.:Hosted jobs were still queued or using superseded earlier runs at review time.
我的整体评价 / Verdict
长程效果判断为 improved:Material lifecycle observations can be recorded without destroying the identity needed by later decisions and recovery.。用户体验判断为 improved:Operators get a previewable, explicit patch with truthful partial-write status and a sync-only recovery instruction.。视觉检查不适用,因为本次没有改变渲染界面或布局。
The metadata update is a narrow operation over the existing transaction and projection owners. The formerly false-successful shared-sync path now reports truthful partial completion, and sync-only recovery avoids overwriting newer observations.
English verdict: APPROVE at 771f0c0. Metadata maintenance preserves canonical source provenance, denies source-session mutation, and reports shared projection failures with a safe sync-only recovery path.
Outcome
A material owner can now mark a registered document stale or blocked, or revise its recorded metadata, without reconstructing its original reference. Previously, following the doc-registry skill's advice to reuse
register-authority-sourcereplaced the whole entry: an actual CLI reproduction changing only freshness lost the stored reference kind/SHA256 and revision. The raw reference is intentionally not retained, so this loss could not be repaired from the registry alone.update-authority-source --goal-id ... --source-id ... --freshness stale --gate-status needs_access --dry-runpreviews an explicit metadata patch; removing--dry-runapplies it. It preserves omitted fields, registration time, reference provenance, imported summaries and topic associations. Inventory query/readback sees the updated metadata. Existing registration replacement semantics remain unchanged.This closes a concrete maintenance gap in roadmap S6's material lifecycle and source-loss visibility. It does not claim verified access, document reading, causal outcome improvements or new access authority.
Boundary and recovery
The Python CLI adapter reuses the existing material registration owner and atomic project-registry reducer; read/patch/write happens under the same transaction, so disjoint concurrent metadata changes are preserved. It adds no persistence schema or domain owner. Shared-summary refresh uses the existing sync path after project commit; failures accurately report
written: true, and retry is covered. Missing source IDs and summary-only registries cannot create new sources or follow another registry automatically.The semantic advisory's added command values remain local CLI/help vocabulary. The skill documents preview, application, readback and recovery.
Validation
f37e1c6589dd43cc80049c0d187fb86abdc9f33c: 7/8 catalog checks passed, all direct checks and compilation passed. The only failure is the unchangedheartbeat_prompt_brief/jsonbudget (11951 characters > 11400), reproduced independently on the exact baseline withpython examples/control_plane/cli-output-budget-regression-smoke.py. Premerge therefore reports failure; this PR does not claim green CI.Full pytest, all TypeScript suites, Windows and live provider/model qualification were not run locally. No external source was dereferenced or production registry changed.
Exact-head refresh on 2026-11-26:
771f0c0e5fe1564e064c2ef66522e3af83436903on currentmainat9b3f5ebeb56d82fc2b1c3a2d035933bb226a6bea.written: true, and sync-only recovery:53 passedacross the update, inventory, integrity and architecture suites.