Skip to content

perf(identity): hash in one encoder pass; retire audit-tier adoption - #5764

Merged
Sinity merged 5 commits into
masterfrom
batch/polylogue-20260928-210350-0b31f196/integration
Sep 28, 2026
Merged

Sinity merged 5 commits into
masterfrom
batch/polylogue-20260928-210350-0b31f196/integration

Conversation

@Sinity

@Sinity Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Batch polylogue-20260928-210350-0b31f196 on base 82e84ec7515d.

polylogue-fdzb3 Compute content identity once, in the parse worker, byte-identical to stored digests

  • 1. session_content_hash is computed exactly once per session; message and block identities are computed in the parse worker and carried to the writer (shard or manifest), never recomputed. 2. Canonica

polylogue-nimnx Retire transition-era machinery after its required source/correctness owners take over

  • 1. Every removed table/path has its preserved evidence and necessary consumer handled explicitly.
  1. Obsolete active-schema history and global repair machinery are actually deleted where superseded.
    3

Sinity and others added 4 commits September 28, 2026 23:09
Audit adoption receipts, their continuity and restore records, and the
sealed-digest rebind chain were written only by the deleted
`ops maintenance migrate-tier --adopt-established-audit` /
`--restore-adopted-audit` route. A fresh v1 archive bootstraps audit.db
with the other durable tiers under one pending intent, so no current
writer produces any of those records.

Remove the adoption, restore and rebind engines from
operations/durable_change_train.py, the continuity `rebind` command from
AuditContinuityCoordinator, the two adoption/restore backup validators from
migration_runner, and every bootstrap, chain-floor, startup-reconciliation
and lost-tier consultation of the receipt. A lost audit.db in an
established archive still refuses startup by name and is never recreated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- core.digest: digest() takes frame_depth; hash_item_payload encodes one
  item (message, event) with one C encoder call. Bytes unchanged.
- pipeline.ids: per-item digests use hash_item_payload; _hash_field_value
  dispatches str/None/number/dict/tuple/Enum by concrete type (no
  model_dump probe or Mapping ABC check); session hash resolves message
  owners only when attachments exist, as the disk route already does.
- ingest_worker: the parse worker builds full-replace PreparedSessionRows
  for resident sessions; ingest_batch admits them through
  prepare_session_write's validated gate, so the process_ingest_batch
  writer no longer computes message identities.

Synthetic 6.46 MB/2,000 messages, pinned CPU, digests identical:
session_content_hash 26.3 -> 11.0 ms/MB, message_content_identities
18.5 -> 10.9, session_revision_projection 39.4 -> 17.4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lylogue-20260928-210350-0b31f196/integration
…lylogue-20260928-210350-0b31f196/integration
@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:39:25.503556Z b5d8d02 Manual request
🔒 Security Review ✅ Completed 2026-09-28T23:05:56.150343Z 78c1957 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 Sinity changed the title chore: Compute content identity once, in the parse worker, byte-identic… perf(identity): hash in one encoder pass; retire audit-tier adoption Sep 28, 2026
@Sinity
Sinity enabled auto-merge (squash) September 28, 2026 23:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78c1957c6b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity

Sinity commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: b5d8d026d1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity
Sinity merged commit 62ca68f into master Sep 28, 2026
3 of 4 checks passed
@Sinity
Sinity deleted the batch/polylogue-20260928-210350-0b31f196/integration branch September 28, 2026 23:42
Sinity added a commit that referenced this pull request Sep 29, 2026
…#5809)

## Summary

Realigns three tests in
`tests/unit/storage/test_lineage_normalization.py` that fail on master
(polylogue-ezvw3). Each one encodes a contract that a named PR changed
deliberately. No production code changes.

## Problem

At master 1beb2e5 (AgentCTL job 2441), these fail:

-
`test_prefix_sharing_child_provider_usage_keeps_its_own_reported_totals`
(line 352). The child's `total_tokens`-only event (272 000) stores NULL
input, cached and output totals, but the test expects 0. #5530
(904b2f8) replaced `_payload_int` with `_payload_optional_int` in
`_provider_usage_event_row`, so an unreported lane now stays NULL.
- `test_child_before_parent_reextracts_provider_usage_tail` (line 1730).
The child rollup reads 0 instead of 130. The test put an all-zero
cumulative tick after the child's 160/30/25 cumulative. #5530 also
changed `_provider_usage_row_has_lane_totals` from "any non-zero" to
"any present", and added
`test_explicit_zero_cumulative_supersedes_prior_positive`. An explicit
zero cumulative is now a measurement, and the latest one wins.
- `test_late_parent_resolution_invalidates_child_derived_products` (line
873). The child is non-valid right after the test seeds a fresh profile.
#5525 (ca25740) added trigger-captured `session_profile_demand`, and
`_classify_partition_with_demand` reports a demanded session as stale
until publication consumes the demand. The test's seed never consumed
it.

None of the suspects named on the bead (#5803, #5792, #5764, #5691) is
the cause. #5803's PR body already lists these three as pre-existing
failures.

## Solution

- Prefix-sharing test: the `total_tokens`-only row now expects NULL
input, cached and output totals. The docstring cites #5530. The rollup
assertion (130/25/30) is unchanged, which proves the NULL row does not
displace the latest lane totals.
- Child-before-parent test: the same measured-zero tick, unchanged, now
comes before the child's latest cumulative. The rollup stays exactly
130/25/30 before and after the parent arrives. The re-extraction
assertion keeps both `cy` rows, including the tick's `request_id`, in
their new order. A stale comment about the evidence predicate is
corrected.
- Late-parent test: `_seed_fresh_session_products` deletes the session's
`session_profile_demand` row, as
`publish_prepared_session_insight_partition` does. The docstring now
says the retained-row assertion carries the anti-vacuity, because
re-captured demand alone would also mark the child stale.

Schema classification: none. No production file changes, so nothing
enters the derived-identity closure.

## Verification

- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/polylogue-mh-lineage --
tests/unit/storage/test_lineage_normalization.py` → job 2573: `devtools
test: PASSED exit=0` (`105 passed` of 105, head 2d1d0a4).
- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/polylogue-mh-lineage` → job 2584: `verify: PASSED
exit=0` (head 2d1d0a4).

## Self-review

- **Contract, not bug.** For each failure I found the commit that
changed the behavior and checked that it was intended. #5530's summary
says "distinguish absent usage from explicit zero", and it added a test
asserting that a zero cumulative supersedes a prior positive one. #5525
added the demand table, its triggers and the demand-aware classifier on
purpose. No assertion was loosened. Every expected value is still exact.
- **Anti-vacuity.** Test 1 would fail if re-extraction kept the `c1`
row, dropped a `cy` row, or rebased the child against the parent. Test
2's NULL expectation fails if absent lanes are coerced to 0 again. Test
3's retained-row assertion fails if `_reextract_prefix_tail_db` stops
deleting profiles.
- **Siblings.** `_seed_fresh_session_products` has one caller. No other
test in this file seeds profiles or reads partition status.
- **Public boundary.** Test-only diff with synthetic fixtures.

## Residuals

- Under #5530, a zero cumulative that follows a positive one within a
session sets the rollup to 0. That is the declared contract. Whether a
real provider emits such a reset, and whether billing should then take
the maximum, is a product question this PR does not reopen.

polylogue-ezvw3

🤖 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