Skip to content

fix(reindex): align fixtures with runtime authority - #3953

Merged
Sinity merged 13 commits into
masterfrom
feature/fix/suite-contract-fixtures
Aug 12, 2026
Merged

fix(reindex): align fixtures with runtime authority#3953
Sinity merged 13 commits into
masterfrom
feature/fix/suite-contract-fixtures

Conversation

@Sinity

@Sinity Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

Align archive and convergence fixtures with current durable authority, preserve legitimate repository attribution, and make production convergence publish the FTS readiness state that its property tests require.

Problem

The retained fixture lane assumed older generated message IDs, ad hoc tier schemas, direct blob references, permissive attachment-owner repair, and a broad temporary-path filter. Its convergence harness also repaired the work-event FTS freshness ledger after the production stages had returned, allowing tests to claim readiness through wiring users did not receive.

Solution

  • Publish raw payload and inline attachment bytes through ArchiveBlobPublisher, bind source-tier references to publication receipts, and consume those receipts in the durable write transaction.
  • Preserve deleted repository-owned paths while recognizing Claude/Codex spool noise only at direct temporary roots, so ordinary nested directories such as /tmp/project/claude-3 remain attributable.
  • Publish an exact session_work_events_fts invariant from every production insights execution route. The surface-specific probe avoids rescanning message FTS and removes the test harness's post-convergence repair.
  • Keep the derived-readiness law scoped to derived surfaces while retaining source authority in the compared canonical snapshot and its dedicated acceptance checks.
  • Make ambiguous attachment ownership raise MessageOwnerAmbiguityError before repair can write a guessed reference, and replace stale source-text assertions with behavioral contracts.

Verification

  • Production convergence stages plus all convergence property modules: 64 passed in 27.57s.
  • Attribution, derived-readiness, and convergence mutation selection: 22 passed in 13.03s.
  • Exact-head pre-push devtools verify --quick: all 25 steps passed in 116.30s.

Current exact head: 94ab1db874b0e5758f3e7f7fa0b4ebcd1b900ad8.

Anti-vacuity: the convergence properties exercise the real parsed-session writer and production FTS/insights stages. Removing production freshness publication leaves the work-event readiness row absent; restoring the harness-only write no longer helps. The attribution regression drives a deleted path under a numeric agent-prefixed directory inside a repository while the direct spool-root regression remains rejected. Publication tests bind and consume real source-tier receipts, and changing ambiguity handling to choose an owner fails the typed-error and no-reference assertions.

Summary by CodeRabbit

  • Bug Fixes

    • Repository attribution now correctly handles agent-related temporary paths while preserving repositories nested within them.
    • Health checks fail safely when lifecycle authority is unavailable and clearly report the reason.
    • Convergence now records accurate search-index freshness after insight processing, improving readiness reporting.
    • Attachment and raw-session processing now handles shared payloads and ambiguous message references more reliably.
  • Tests

    • Expanded coverage for archive readiness, convergence, repository identity, identifier namespacing, lifecycle failures, and attachment references.
    • Updated fixtures and validation rules for current archive schemas and session metadata.

Sinity and others added 6 commits August 11, 2026 19:12
Publish raw payload and attachment bytes through the archive publisher before admitting their source-tier references. Reject transient agent paths before repository-root attribution.

Co-Authored-By: Codex <noreply@openai.com>
Bootstrap canonical tiers, supply parser-census and raw-lifecycle evidence, and preserve read-only, idless, and attachment-owner failure boundaries.

Co-Authored-By: Codex <noreply@openai.com>
Regenerate protocol bytes, retain behavioral FTS coverage, and update runtime fixtures for current CLI, async dispatch, and readiness contracts.

Co-Authored-By: Codex <noreply@openai.com>
Problem: the rebased fixture suite retained stale payload mutation and ownership expectations after the current archive contracts changed.\n\nWhat changed: preserve typed blob receipts, widen the mixed status fixture, and assert the explicit ambiguous-owner failure boundary.\n\nCo-Authored-By: Codex <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 99da4db1-48d3-4275-8376-ad9e720166e1

📥 Commits

Reviewing files that changed from the base of the PR and between fc1984c and 94ab1db.

📒 Files selected for processing (8)
  • polylogue/archive/session/attribution.py
  • polylogue/daemon/convergence_stages.py
  • polylogue/storage/fts/fts_lifecycle.py
  • tests/infra/convergence_harness.py
  • tests/property/test_convergence_property_derived_readiness.py
  • tests/property/test_convergence_property_mutations.py
  • tests/unit/archive/test_repo_identity.py
  • tests/unit/daemon/test_convergence_stages.py

📝 Walkthrough

Walkthrough

The PR updates repository attribution, material protocol fixtures, convergence ingestion, FTS freshness recording, archive-tier setup, health contracts, and runtime test expectations.

Changes

Archive convergence and validation

Layer / File(s) Summary
Attribution and identity validation
polylogue/archive/session/attribution.py, tests/unit/archive/test_repo_identity.py, tests/fixtures/material_protocol/v1/small-session/*
Attribution filters ambient agent and runtime roots while preserving repository-local paths. Fixtures use namespaced identifiers and updated hashes.
Convergence blob publication and FTS freshness
tests/infra/convergence_harness.py, polylogue/daemon/convergence_stages.py, polylogue/storage/fts/fts_lifecycle.py, tests/property/*, tests/unit/daemon/test_convergence_stages.py
The harness publishes blobs, consumes receipts, validates payloads, supports empty FTS fixtures, and checks required readiness surfaces. Insight stages record exact FTS freshness after materialization.
Archive-tier test setup
tests/benchmarks/test_archive_maintenance.py, tests/unit/operations/test_archive_debt.py
Tests use archive initialization APIs and tier-specific database paths.
Health and readiness contracts
tests/unit/daemon/*, tests/unit/storage/test_archive_readiness.py, tests/unit/core/test_claim_guard.py, tests/unit/cli/commands/test_status.py
Fixtures include raw-authority census and lifecycle metadata. Health expectations include archive-verification checks and unavailable lifecycle authority errors.
Runtime and storage test alignment
tests/unit/annotations/*, tests/unit/architecture/*, tests/unit/cli/*, tests/unit/core/*, tests/unit/maintenance/*, tests/unit/storage/*, tests/unit/sources/*
Tests align with writable archive reopen behavior, asynchronous insight dispatch, artifact graph declarations, ambiguity errors, message identity rules, delegation IDs, and updated CLI behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ConvergenceHarness
  participant ArchiveBlobPublisher
  participant source_db
  participant SessionWriter
  participant InsightMaterializer
  participant index_db
  ConvergenceHarness->>ArchiveBlobPublisher: publish raw and attachment bytes
  ArchiveBlobPublisher->>source_db: record publication receipts
  ConvergenceHarness->>source_db: consume receipts and validate payload size
  ConvergenceHarness->>SessionWriter: ingest payload with precomputed hash
  InsightMaterializer->>index_db: rebuild insight rows
  InsightMaterializer->>index_db: record exact FTS freshness
  ConvergenceHarness->>index_db: verify required readiness surfaces
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.48% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title identifies the fixture alignment with current runtime authority, which is a central change in the pull request.
Description check ✅ Passed The description includes the required summary, problem, solution, verification, scope, and disposition details.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/suite-contract-fixtures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity Sinity changed the title test: align contract fixtures with archive authority test: align contract fixtures with archive authority (#3953) Aug 11, 2026

@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: 5e513c9ca0

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

Comment thread polylogue/archive/session/attribution.py Outdated
@Sinity

Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

Exact-head Codex review completed against origin/master at 5e513c9ca0b9560f01e033d952e8053d7b8d2822.

Result: no actionable defects identified. The review covered the full base-to-head diff, including source-tier blob publication and receipt consumption, attachment-owner ambiguity, material-protocol fixture IDs, and contract-test coverage.

@Sinity

Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head e53fa1597a8ec53e988e5954ef94bf9963086797, including the repository-owned path/noise-filter repair. Verify that real files inside a checkout remain attributable while missing Claude/Codex spool paths remain excluded.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: e53fa1597a

ℹ️ 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 changed the title test: align contract fixtures with archive authority (#3953) test: align contract fixtures with archive authority Aug 12, 2026
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head fc1984c77fcf466846c3f8e1d5033a27e6a40721 after integrating current master. Focus on the source-tier blob publication and receipt transaction in tests/infra/convergence_harness.py, and verify that the conflict resolution in the pytest progress test preserves current terminal-outcome semantics. Current-head evidence: the order-invariance, interruption, incremental-vs-bulk, and idempotence property selection passed 5/5; pre-push quick verification passed all 25 steps.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: fc1984c77f

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/infra/convergence_harness.py`:
- Line 238: Capture the raw receipt immediately after
raw_blob_publisher.write_from_bytes(payload) in the convergence harness, before
publishing any attachments. Update the raw reference and corresponding
blob_publication_reservations consumption to use this saved receipt rather than
rereading ArchiveBlobPublisher.receipt_id(), while leaving attachment receipt
handling unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3b196252-228f-490c-b36d-327ee008766c

📥 Commits

Reviewing files that changed from the base of the PR and between ff83ec5 and fc1984c.

📒 Files selected for processing (26)
  • polylogue/archive/session/attribution.py
  • tests/benchmarks/test_archive_maintenance.py
  • tests/fixtures/material_protocol/v1/small-session/manifest.json
  • tests/fixtures/material_protocol/v1/small-session/segments/seg-00000.ndjson
  • tests/fixtures/material_protocol/v1/small-session/segments/seg-00001.ndjson
  • tests/fixtures/material_protocol/v1/small-session/segments/seg-00002.ndjson
  • tests/infra/convergence_harness.py
  • tests/unit/annotations/test_durable_storage.py
  • tests/unit/architecture/test_topology_invariants.py
  • tests/unit/archive/test_repo_identity.py
  • tests/unit/cli/commands/test_status.py
  • tests/unit/cli/test_check_runtime.py
  • tests/unit/cli/test_init.py
  • tests/unit/cli/test_insights_command_runtime.py
  • tests/unit/core/test_artifact_specs.py
  • tests/unit/core/test_claim_guard.py
  • tests/unit/core/test_insight_registry_runtime.py
  • tests/unit/daemon/test_convergence_restart_law.py
  • tests/unit/daemon/test_health_check_paths.py
  • tests/unit/daemon/test_health_contract.py
  • tests/unit/maintenance/test_blob_reference_closure.py
  • tests/unit/operations/test_archive_debt.py
  • tests/unit/sources/parsers/test_origin_regression_pack.py
  • tests/unit/storage/test_archive_readiness.py
  • tests/unit/storage/test_delegations_view.py
  • tests/unit/storage/test_search_text_write_tool_coverage.py
💤 Files with no reviewable changes (1)
  • tests/unit/storage/test_search_text_write_tool_coverage.py

Comment thread tests/infra/convergence_harness.py
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 1dc28a94ebcc9f48b618af1ca32ed6b26fd48fdc. Focus on the raw/attachment equal-hash publication-receipt binding and its mutation-sensitive regression. Exact-head local evidence: 10 convergence property tests passed; pre-push quick verification passed all 25 steps.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 1dc28a94eb

ℹ️ 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 Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 864f56b9878b2694ab0d5855bd43393a6bb40a7e after the current-master merge. Re-check the source-tier blob publication receipt binding, especially the equal-content raw/attachment regression, and report only actionable defects.

@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: 864f56b987

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

Comment thread polylogue/archive/session/attribution.py Outdated
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 54e8743f47d82802fed861323ac1542374978657. Focus on the deleted repo-owned path versus ambient-spool boundary and report only actionable defects.

@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: 54e8743f47

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

Comment thread polylogue/archive/session/attribution.py
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 5133d25c8ec66963b10ba5df973d3d9488fb20e3. Re-check the full repository-attribution/noise boundary, especially deleted paths, actual agent spool roots, and ordinary claude-*/codex-* repository directories. Report only actionable defects.

@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 5133d25c8ec66963b10ba5df973d3d9488fb20e3. Re-check the full repository-attribution/noise boundary, especially deleted paths, actual agent spool roots, and ordinary agent-prefixed repository directories. Report only actionable defects.

@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: 5133d25c8e

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

Comment thread polylogue/archive/session/attribution.py Outdated
Comment thread tests/infra/convergence_harness.py Outdated
Restrict temporary spool detection to direct temporary roots so nested repository directories remain attributable. Move post-insight work-event FTS freshness publication from the property harness into every production insights route, using a surface-specific exact invariant to avoid rescanning message FTS. Keep the derived-readiness law scoped to derived surfaces while retaining source authority in the compared snapshot.
@Sinity Sinity changed the title test: align contract fixtures with archive authority fix(reindex): align fixtures with runtime authority Aug 12, 2026
@Sinity

Sinity commented Aug 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact head 94ab1db874b0e5758f3e7f7fa0b4ebcd1b900ad8. Re-check direct temporary spool-root attribution and the production-owned, surface-specific post-insight FTS freshness path. Confirm the harness no longer supplies runtime wiring and report only actionable defects.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 94ab1db874

ℹ️ 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 4f384e6 into master Aug 12, 2026
3 checks passed
@Sinity
Sinity deleted the feature/fix/suite-contract-fixtures branch August 12, 2026 21:30
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