Fix: UPDATE branch of upsert_entry dropped doc_refs + valid_until #3
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/upsert-outcome-update-merge"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Surfaced by
The auditor's hybrid fixture on PR #1 (branch
auditor/scaffold) caught thisduring layer 3 validation on 2026-04-22. A re-seed with fresh doc_refs on
the same (operation, day) produced mode=updated but the doc_refs vanished.
Root cause
upsert_entryUPDATE arm only merged endorsed_names + partially handledschema_fingerprint. Three fields were dropped:
doc_refs,valid_until,plus the
schema_fingerprintpartial handling was inconsistent with thePhase 25 intent.
Fix
doc_refs— merge by tool (case-insensitive). Same-tool supersedes,different-tool appends, empty incoming preserves existing.
valid_until— refresh if caller provides one.schema_fingerprint— already correct, clarified in comment.Tests
4 new regression tests under
upsert_tests. All 9 upsert tests pass.Merge order
Independent of PR #2. Either can merge first. If PR #2 merges first
(which changes the UpsertOutcome enum shape), this branch needs a
rebase — only the 2 pattern-match sites in the tests update (_ → { .. }),
the fix logic is untouched.
🤖 Generated with Claude Code
The auditor's hybrid fixture (branch auditor/scaffold) surfaced this on 2026-04-22. A re-seed of the same (operation, day) pair with new endorsed_names merged the names but silently discarded the incoming doc_refs and valid_until fields. schema_fingerprint was partially handled (set-if-Some) but doc_refs and valid_until weren't touched. Root cause: the UPDATE arm of upsert_entry at playbook_memory.rs:609 only covered: - endorsed_names (union-merge) - timestamp - embedding (if Some) - schema_fingerprint (if Some) Fix: - valid_until — refresh if caller provides one - doc_refs — merge by tool (case-insensitive). Same-tool new entry supersedes older one; different-tool refs are appended. Empty incoming doc_refs preserves existing (don't wipe on partial seed). 4 new regression tests under upsert_tests: - update_merges_doc_refs_with_existing_ones - update_same_tool_supersedes_older_version - update_preserves_existing_doc_refs_when_new_entry_has_none - update_refreshes_valid_until_when_caller_provides_one Test result: 9/9 upsert tests pass (4 new + 5 pre-existing). Branch basis note: this branch is off main, so the UpsertOutcome enum here still has the newtype variants Added(String) / Noop(String). PR #2 (fix/upsert-outcome-serde) changes that enum to struct-like. When PR #2 merges first this branch needs a trivial rebase; the UPDATE arm logic is untouched by that change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>Auditor verdict: ✅
approveOne-liner: all checks passed (3 findings, all info)
Head SHA:
320009ddf4deAudited at: 2026-04-22T09:07:16.396Z
dynamic — 1 findings (0 block, 0 warn, 1 info)
ℹ️ info — dynamic check skipped — skipped by options
skipped by optionsinference — 1 findings (0 block, 0 warn, 1 info)
ℹ️ info — no ship-claims extracted — skipping cloud inference
parser returned empty claim list; nothing to verify against cloudkb_query — 1 findings (0 block, 0 warn, 1 info)
ℹ️ info — KB: 69 recent scenario runs, 209/289 events ok (fail rate 27.7%)
most recent: scenario-2026-04-21T05-29-34recent failing sigs: 5745bcd5e4c68591, 5745bcd5e4c68591, caeeeffc69d36009Metrics
Lakehouse auditor · SHA
320009dd· re-audit on new commit flips the status automatically.