Skip to content

fix(security): declare raw_existence_changes once, as excised - #5767

Merged
Sinity merged 1 commit into
masterfrom
claude/excision-carrier-duplicate
Sep 28, 2026
Merged

Sinity merged 1 commit into
masterfrom
claude/excision-carrier-duplicate

Conversation

@Sinity

@Sinity Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

raw_existence_changes is now declared once in SESSION_CARRIERS, as EXCISED. A table declared twice is now an import-time error, so one declaration can no longer silently replace another.

Problem

test_raw_existence_journal_is_declared_as_content_free_bookkeeping fails on master: TOMBSTONE is RETIRED. Two PRs each declared the table:

_carriers built a dict, so the later TOMBSTONE entry silently replaced the EXCISED one. The actual behavior is EXCISED. The #5727 test asserted RETIRED, but that reach applies only to tables that fresh tiers omit, and this table is present in a fresh source tier.

Solution

  • Remove the TOMBSTONE declaration.
  • _carriers raises ValueError on a duplicate table.
  • The test (renamed test_raw_existence_journal_is_declared_as_excised) asserts EXCISED.

Verification

  • devtools test over tests/unit/security/test_excision_carrier_reach.py, tests/unit/security/test_excision.py and the other master-health files: PASSED exit=0

🤖 Generated with Claude Code

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

#5688 declared the frontier journal TOMBSTONE and #5727 added a second,
EXCISED declaration; _carriers kept the last one, so TOMBSTONE won even
though apply_session_excision deletes the journal rows by name (#5727)
and test_excision asserts none survive. Keep the EXCISED declaration and
make a duplicate carrier declaration an import-time error. The carrier
test asserted RETIRED, which is for tables fresh tiers omit; it now
asserts EXCISED.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
@Sinity
Sinity enabled auto-merge (squash) September 28, 2026 23:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T23:29:22.746651Z 94d33c1 PR opened
🔒 Security Review ✅ Completed 2026-09-28T23:31:01.131518Z 94d33c1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

Realigns the master tests whose failures are stale tests rather than
code defects: 16 test ids, 12 from the coordinator's list plus the
pinned read-only store test. Each one asserted a contract that a later
PR changed on purpose. The fixes below are grouped by the PR that broke
them.

## Problem and fix, by breaking PR

| Breaking PR | Tests | Why they fail | Fix |
| --- | --- | --- | --- |
| #5564 (0723a95) |
`test_pinned_read_only_store_blocks_all_archive_tier_mutations`,
`test_convergence_one_shot_readers_cannot_mutate` | The read profile's
authorizer rejects writes at prepare time with `DatabaseError: not
authorized`, before SQLite's own `OperationalError: readonly` is
reached. | Expect `sqlite3.DatabaseError` matching `not
authorized\|readonly`. The existing checks that nothing changed stay. |
| #5550 (da5346d) | Seven `test_store_ops` tag tests | Facade writes
now belong to the daemon: `add_tag` and `remove_tag` raise
`FacadeDaemonRequiredError` when no daemon is running. | The three
parametrized tests run the resident writer on the archive's own socket,
through a new `tests/infra/daemon_operations.daemon_serving_archive`;
the MCP helper now reuses it. The Hypothesis tag law calls
`ArchiveStore.add_user_tags`, the primitive the daemon's actuator
applies. It clears `open_connection`'s per-path cache between examples,
because otherwise each new example archive keeps about 11 descriptors
and trips the fd-leak guard. |
| #5700 (f2562c3) |
`test_daemon_required_envelope_preserves_resolved_archive_root` | #5700
made a daemon-absent machine refusal exit with `FAILED_READ_EXIT_CODE`
(1). The test, added in #5722, asserted 2. | Assert
`FAILED_READ_EXIT_CODE`. |
| #5727 (ee567d0) |
`test_recent_attempts_report_the_file_count_not_the_session_count` |
Read-only opens now check derived schema identity, so a hand-built
`ops.db` is refused and the probe returns no attempts. | Seed a real ops
tier with `initialize_archive_database` and a valid status. |
| #5727 | `test_compare_reports_archive_derived_readiness_deltas` |
`compare` is now not ok when either side's convergence-debt ledger is
unavailable, and a missing `ops.db` counts as unavailable. | Initialize
`ops.db`. |
| #5727 |
`test_unavailable_debt_is_rendered_unknown_and_cli_fails_closed` | The
test was added in #5727 and never passed: `"0 failed" not in output`
also matched the attempt-count line (`0 running, 0 failed`), which has
existed since #4010. | Check only the convergence-debt line. |
| #5551 (aa19052) |
`test_daemon_workload_probe_does_not_claim_derived_ready_on_schema_mismatch`
| Under the fresh format every tier starts at `user_version = 1`, so
writing 1 no longer produces a mismatch. | Set `user_version = 2`. |

Not in this PR:
- `test_raw_existence_journal_is_declared_as_content_free_bookkeeping`
was a real duplicate declaration and is fixed in #5767.
- polylogue-njwky (sqlite-vec on async attaches) was confirmed real and
is fixed in #5765.

## Verification

- `devtools test tests/unit/security/test_excision_carrier_reach.py
tests/unit/security/test_excision.py
tests/unit/storage/test_archive_tiers_archive.py
tests/unit/daemon/test_maintenance_read_profiles.py
tests/unit/cli/test_machine_main.py
tests/unit/sources/test_refused_state_is_reported.py
tests/unit/operations/test_daemon_workload_probe.py
tests/unit/storage/test_store_ops.py
tests/unit/mcp/test_mcp_writer_boundary.py`: `PASSED exit=0` (run with
#5767's change applied)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@Sinity
Sinity merged commit 4cbf83b into master Sep 28, 2026
3 of 4 checks passed
@Sinity
Sinity deleted the claude/excision-carrier-duplicate branch September 28, 2026 23:34
Sinity added a commit that referenced this pull request Sep 29, 2026
## Summary

Closes the open Codex findings from the #5727 landing tracked in
polylogue-1s16n (9) and polylogue-qxm5u (2). This replaces the earlier
untested source batch on this branch. The polylogue-1tyq5.164/.165/.166
parts were dropped because another run owns them.

## Problem

Each finding was re-checked against master. All eleven reproduced on
master, apart from one that #5767 had already fixed:

- The browser selection save sent `message:<provider id>` to a daemon
actuator that accepted only session refs. Two further blockers on that
route came to light: the receiver treated the accepted mutation envelope
as "unavailable", and it passed the capture evidence ref as the
assertion scope, which `upsert_assertion` rejects. So no browser
candidate could persist.
- The compaction budget used a whitespace word count over compact JSON,
so 100 omission rows cost about one token.
- Once a schema was collapsed as high-cardinality, later keys went back
under `properties`. The existing 512-sample law was red on master.
- The trusted-parent baseline dropped AST context.
- An omitted `expected_targets` became `[]`, so a confirmed reset was
always refused.
- A swept audit domain that still had pending keys restarted itself
indefinitely, so the marker domain never ran.
- Only the first duplicate ChatGPT asset rendition got an attachment.
- `raw_existence_changes` was declared twice, and the TOMBSTONE
declaration won. #5767 already fixed this on master.
- Legacy scalar accepted-identity cache entries in the extension were
read as maps.
- The displaced-match fixture could not be parsed.
- Compaction evidence cited quarantined or authority-contradicted parent
prefixes.

## Solution

- The facade and daemon actuator now share one candidate ref resolver,
`resolve_assertion_candidate_refs`, which accepts canonical `message:`
refs. The receiver sends the canonical message ref and scopes the
candidate to its session. It follows the mutation with
`operation_to_completion` and maps a daemon rejection to 400.
- Compaction measures the whole serialized pack, including its own
estimate field, with `estimate_serialized_tokens`, the larger of the
word estimate and UTF-8 bytes/4. Truncations are named in
`manifest.unknown`. A budget below the empty envelope raises
`CompactionBudgetTooSmallError`. The prose estimator used by the context
compiler is unchanged.
- In a high-cardinality merge, a marked side keeps the property names it
already retained. Keys first seen later fold into
`additionalProperties`.
- Trusted baseline entries are compared as full `(file, digest,
context)` anchors.
- `ResetRequest.expected_targets` defaults to `None`.
- The session audit keeps an owed-domain set. It rotates past a swept
domain that still has pending keys, and a late completion re-owes the
domains after it.
- Every duplicate asset member becomes its own attachment with its own
blob, member-derived name and MIME type. This covers both the
prepared-carrier route and the in-memory route, and rollback restores
the attachment count.
- The extension migrates identity storage once at startup, recorded
under a version key. Reads and writes go through the storage queue.
- The compaction evidence SQL requires `inheritance = 'prefix-sharing'`
and `topology_status_composes_sql`.
- Three stale tests are fixed forward: the compaction anchor refs, the
promoted audit pass, and the displaced fixture.

## Verification

- `agentctl job start polylogue pytest_focused --workspace <wt> --
tests/unit/browser_capture/test_receiver.py
tests/unit/operations/test_mutation_actuators.py::TestCaptureAssertionCandidateActuator
tests/unit/cli/test_note.py tests/unit/surfaces/test_compaction.py
tests/unit/core/test_schema_laws.py
tests/unit/devtools/test_verify_patterns.py
tests/unit/cli/test_reset.py::TestResetCommandDeletion::test_confirmed_reset_without_a_preview_is_not_an_empty_preview
tests/unit/daemon/test_session_profile_composition.py
tests/unit/sources/test_chatgpt_sidecars.py
tests/unit/sources/test_assembly_chatgpt.py
tests/unit/security/test_excision_carrier_reach.py
tests/unit/insights/test_run_projection_materialization.py
tests/unit/context/test_compiler.py
tests/unit/operations/test_daemon_protocol.py`: all new tests pass. The
three remaining failures (`test_compiler` ×2 and `test_note` canary)
fail identically on master `origin/master` (baseline job 1403).
- Follow-up runs: `test_receiver.py` passed, and
`test_chatgpt_sidecars.py test_assembly_chatgpt.py
test_session_profile_composition.py` passed.
- `verify_quick`: succeeded (job 1520).
- Extension: `vitest run` gave 419 passed, and the new migration test
fails without the startup migration.

## Residuals

- `dynamic_keys.py`, `assembly_chatgpt.py` and
`run_projection_relations.py` are in the derived schema-identity
closure, so this moves the derived identity. Land it before the next
rebuild starts.
- Master already has unrelated failing tests (reset CLI suite, note
canary, context compiler, facade contract, preamble, tag overlay). They
are recorded in a separate Bead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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