Skip to content

Plain memory writes emit hash-only audit receipts - #922

Merged
zlareb1 merged 7 commits into
mainfrom
fix/plain-memory-audit-receipts
Nov 18, 2026
Merged

zlareb1 merged 7 commits into
mainfrom
fix/plain-memory-audit-receipts

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Memory writes without embeddings leave a hash-only audit receipt after a confirmed ClickHouse insert, including episodic, profile and high-sensitivity writes.

Why

The plain-write branch returned before the searchable-write audit tail. Reuse the same receipt helper after the plain row lands so both branches record the key, id, content hash, source class, verdict and pin state without the value.

Scope and risk

The ClickHouse plain-write branch attempts one receipt before later cleanup. Cancelling an audit attempt still runs the committed write announcement and the high-sensitivity fence. Audit failures remain best effort. The Postgres branch retains its transactional revision receipt and emits no additional point-write receipt. Searchable writes use the extracted helper with the same payload.

Compatibility, rollout and rollback

  • Wire: no changes.
  • Operator steps: none.
  • Rollback: reverting leaves existing audit rows readable; no migration or backfill.

Tests

  • Regression tests before the fix: five failures and five passing controls.
  • python -m pytest tests/unit/test_plain_memory_audit.py tests/unit/test_memory_set_verdict.py tests/unit/test_write_audit_and_checkpoint_lag.py 'tests/unit/test_doc_links.py::test_relative_links_resolve[docs/architecture/memory-architecture.md]' -q: 35 passed, including actual task cancellation for ordinary and high-sensitivity plain writes.
  • All four deferred-delete audit cases pass after their setup-write receipt is asserted separately from the delete receipts. The worker still emits no receipt.
  • Three integration cases write and read back the real value and compare the scoped audit receipt with its hash. These await CI; no local integration stack was started.
  • Changed-file Ruff formatting and lint, pinned Prettier formatting and the architecture page link check pass. The source passes the 35 focused checks above; the four affected deferred-delete checks also pass.
  • Full lint, type, unit, coverage and integration checks await CI.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated: Codex wrote the change and checked the receipt payload, authority boundary and regression results.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated where required; this change adds no generated surface.
  • A new migration is additive and numbered after the latest on main; no migration changes.
  • A behaviour change to any file a plugin ships bumps both plugin manifests; no plugin changes.
  • The frontend builds and its tests pass, if frontend/ changed; no frontend changes.
  • Docs describe the current behaviour and this description names operator steps and wire changes.
  • Repository text contains no private deployment details.
  • Commits are signed off.

Reuse the point-write hash-only receipt after a ClickHouse plain row lands. Postgres already commits AUDIT_ROW with the row; audit failures remain best effort.

Signed-off-by: zlareb1 <[email protected]>
Read the stored value back and compare its hash with the scoped audit receipt for episodic, profile and high-sensitivity writes.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 merged commit 9522b2b into main Nov 18, 2026
51 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 18, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant