Skip to content
This repository was archived by the owner on Aug 16, 2026. It is now read-only.

Post-merge audit fixes: close six defects phases A-C shipped green - #73

Merged
sathish-mg merged 2 commits into
mainfrom
fix/phase-abc-audit
Aug 13, 2026
Merged

sathish-mg merged 2 commits into
mainfrom
fix/phase-abc-audit

Conversation

@sathish-mg

Copy link
Copy Markdown
Contributor

Summary

A post-merge audit of PR #72 (phases A-C: trajectory capture, replay, governed
corpus export) found six defects. None failed a test, and in two cases a test
existed that passed whether the feature worked or not.

  • Identity could survive erasure. A sampled ASSEMBLE stored the whole
    statement text, so WHERE subject = "john" wrote that identity into an
    immutable, replicating Observation outside the erasure selector's reach. Now
    stores query_sha256 — same rule as the corpus manifest's selector_sha256.
  • Applying an advisory recommendation could strand it in approved (whose
    only exits are applied/expired) via the bindings' fused approve-and-apply
    path. One shared ensure_executable check now refuses at preflight, before
    the approval is recorded.
  • A second writer in a session could make capture-stop skip real turns
    the watermark counted thread grains rather than identifying turns by content
    address.
  • The corpus did not mask the step it exists to mask — a failed tool call
    kept full loss weight; only the (always-zero) result step was masked.
  • Two corpus fields were always empty — a reader/writer key mismatch on
    elisions, and no producer anywhere for policy_versions.

Each fix is pinned by a test verified to fail without it.

Also: records phases A-C in the CHANGELOG (previously only the review round was
recorded), and folds AGENTS.md/.agents into symlinks onto CLAUDE.md/.claude.

Test plan

  • cargo test --workspace — 1677 passed, 0 failed
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • Each new/changed test verified to fail on the pre-fix code

An audit of PR #72 found six defects, none of which failed a test — and in
two cases a test existed that passed whether the feature worked or not.

- An identity could survive erasure. A sampled ASSEMBLE stored the whole
  statement, so `WHERE subject = "john"` wrote that identity verbatim into an
  immutable, replicating Observation in `agent:harness` — a namespace the
  subject selector does not reach, so it never appeared in REPORT SUBJECT and
  survived FORGET SUBJECT. Now `query_sha256`, the same rule and the same
  reason as the corpus manifest's `selector_sha256` three thousand lines away.

- Applying an advisory recommendation could strand it. Every Data proposal but
  outcome_review's revert is advisory, and the bindings' fused approve-and-apply
  approved first and refused second, leaving the finding in `approved` — whose
  only exits are `applied` and `expired`. One shared `ensure_executable` now
  answers for both preflight and apply, so the refusal lands while the finding
  is still dismissible. Approving an advisory finding stays legal: a Flag is
  acknowledged, not executed.

- A second writer in a session made capture-stop skip real turns. The hook
  counted grains in the thread as a watermark, so anything else writing there
  consumed the count. A turn is now identified by its content address, with
  created_at pinned from the transcript — idempotent by construction rather
  than by arithmetic.

- The corpus did not mask the step it exists to mask. A tool call whose result
  errored kept full loss weight; only the environment's reply was zeroed, which
  it is regardless. Call and result arrive in different events, so the
  correlation runs once the session is whole.

- Two corpus fields were emitted and always empty: the elisions reader looked
  under `context` while the writer wrote top-level, and no code anywhere
  produced a policy version. `capture-stop --policy-version` is that producer.

Each fix is pinned by a test that fails without it — verified, not assumed.
Also records phases A-C in the changelog, which described only its own review
round, and folds AGENTS.md/.agents into symlinks onto CLAUDE.md/.claude so the
two stop drifting apart.

The strategy and design documents this work was built from are not in this
tree — they live at ~/Documents/dejadb/ instead of repo history.
@sathish-mg
sathish-mg requested a review from a team as a code owner August 13, 2026 20:41
@sathish-mg
sathish-mg merged commit 347df0b into main Aug 13, 2026
14 checks passed
@sathish-mg
sathish-mg deleted the fix/phase-abc-audit branch August 13, 2026 21:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant