Skip to content

fix(reindex): gate on raw failure lifecycle evidence - #3819

Merged
Sinity merged 4 commits into
masterfrom
feature/fix/parse-failures-current
Aug 5, 2026
Merged

Sinity merged 4 commits into
masterfrom
feature/fix/parse-failures-current

Conversation

@Sinity

@Sinity Sinity commented Aug 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Make stopped-daemon raw failure evidence an explicit pre-reindex readiness decision. Every retained parse or validation failure is classified as deferred, terminal, or unexplained, and unexplained failures block a full index rebuild before candidate generation.

Problem

The 2026-08-04 read-only census found 112 stopped-daemon failures: 111 raw parse failures and one maintenance failure. Only 59 raw parse failures had typed artifact observations. The remaining 52 failures had no durable lifecycle explanation, so a converged-archive claim could hide unresolved parser errors.

Solution

Add a read-only source-tier lifecycle projection over raw_sessions and the latest raw_artifacts observation. Wire it into the preflight ledger and archive verification. Full rebuilds now run this production verification path before creating an index generation and stop loudly when unexplained failures remain. Mutation-sensitive tests cover typed terminal evidence, validation-failure red twins, preflight blocking, and rebuild refusal.

Verification

  • direnv exec . devtools verify --quick passed with all 24 steps exiting 0, including format, lint, mypy, generated surfaces, layering, degradation policy, and schema/promotion checks.
  • direnv exec . devtools test tests/unit/maintenance/test_archive_verification.py passed: 91 tests.
  • direnv exec . devtools test tests/unit/devtools/test_preflight_ledger.py passed: 6 tests.
  • direnv exec . devtools test tests/unit/maintenance/test_rebuild_index_ownership.py passed: 5 tests.
  • Read-only live census reproduced 43,124 raw sessions, 111 parse failures, 0 validation failures, 59 typed artifact observations, and 52 unexplained failures. No live remediation or reindex was run.

Acceptance matrix

Acceptance criterion Status Evidence
1. Classify every current raw failure into deferred, terminal, or unexpected state with bounded preflight evidence. Satisfied raw_failure_lifecycle reports counts, origins, artifact kinds, and samples. Current unexplained rows remain visible as unexpected instead of being silently accepted.
2. Add production-route regression tests for parser or lifecycle defects. Satisfied Archive verification, preflight ledger, and full rebuild tests exercise real source-tier relations and the reindex gate, including mutation-sensitive red twins.
3. Stopped-daemon status distinguishes deferred work, terminal evidence, and unexplained failures, with unexplained failures critical before reindex. Satisfied The preflight ledger reports warn for typed deferred/terminal evidence and fail for unexplained or unavailable lifecycle data. rebuild_index_from_source rejects the failing verification result before generation creation.
4. Post-deploy backup-gated dry-run/apply receipt reduces known defect failures without hiding truncated hot files. Deferred by explicit scope This implementation performs no production mutation. The post-deploy backup, dry-run, and apply receipt remain an operator boundary after deployment.

Ref polylogue-dyica

Problem
Stopped-daemon raw parse and validation failures were counted as failed archive evidence without a readiness decision. Reindex could therefore proceed while unresolved failures remained unexplained.

What changed
Add a read-only source-tier lifecycle projection that accepts only durable deferred or terminal artifact evidence. Expose it in the preflight ledger and archive verification, and make full index rebuilds stop before creating a candidate generation when unexplained failures remain. Add mutation-sensitive tests for typed evidence, validation failures, preflight blocking, and rebuild refusal.

Compatibility/migration
The check is read-only and does not alter retained raws or run live remediation. Existing archives with historical failures require classification evidence before reindex; the operator remediation remains a separate backup-gated operation.

Ref polylogue-dyica

Co-Authored-By: Codex <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6214e8be-19af-48f3-8018-5d1249527357

📥 Commits

Reviewing files that changed from the base of the PR and between 8fe970a and c2d17ef.

📒 Files selected for processing (21)
  • devtools/preflight_ledger.py
  • docs/plans/degrade-loudly-allowlist.yaml
  • polylogue/cli/commands/status.py
  • polylogue/daemon/bulk_rebuild.py
  • polylogue/daemon/cli.py
  • polylogue/daemon/health.py
  • polylogue/daemon/http.py
  • polylogue/daemon/status.py
  • polylogue/daemon/status_snapshot.py
  • polylogue/maintenance/archive_verification.py
  • polylogue/maintenance/rebuild_index.py
  • polylogue/storage/raw_failure_lifecycle.py
  • tests/unit/cli/test_status.py
  • tests/unit/daemon/test_bulk_rebuild.py
  • tests/unit/daemon/test_daemon_http_contracts.py
  • tests/unit/daemon/test_daemon_status.py
  • tests/unit/daemon/test_health_contract.py
  • tests/unit/daemon/test_raw_failure_sample.py
  • tests/unit/devtools/test_preflight_ledger.py
  • tests/unit/maintenance/test_archive_verification.py
  • tests/unit/maintenance/test_rebuild_index_ownership.py

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 and others added 3 commits August 5, 2026 18:05
Problem
Daemon bulk rebuild could create or resume generation state and select raw pages without the raw-failure lifecycle decision used by offline reindex. Status also counted terminal artifacts without validating their support status or source identity.

What changed
Run the shared lifecycle preflight before daemon transaction resolution. Require matching raw identity and evidence-kind support status, and make daemon status consume the same projection. Add real-route mutation tests for pre-generation refusal, malformed or mismatched evidence, and status parity.

Compatibility/migration
Cursor authority mechanics are unchanged. Unexplained or unavailable raw failure evidence now fails closed before daemon bulk rebuild mutation.
Problem
Daemon and direct archive status could fall back to index relations or zero-valued output when source.db was missing or unreadable. The health route could then report no raw failures without lifecycle evidence.

What changed
Make source.db lifecycle evidence authoritative, carry explicit unavailable and blocked state through daemon, snapshot, and direct status, and make medium health return an error with the source reason. Add mutation-sensitive status and health route coverage for missing, malformed, unreadable, and healthy source tiers.

Compatibility/migration
Successful source archives retain their existing zero-failure and typed deferred or terminal status. Archives without readable lifecycle evidence now require source-tier recovery before status can be healthy.

Co-Authored-By: Codex <[email protected]>
Problem: fast health and status surfaces could treat missing or omitted raw-failure lifecycle evidence as healthy or actionable, while human status output did not always disclose the evidence gap.

What changed: require an explicit healthy zero-failure lifecycle for fast health and status claims, propagate unavailable and blocked states through daemon and root CLI status, align JSON and exit-code semantics, and add route-level regressions for source evidence failure shapes.

Compatibility: clean source-tier evidence remains healthy; typed degraded and blocked outcomes remain visible; bulk and offline rebuild safety paths are unchanged.

Ref #3819

Co-Authored-By: Codex <[email protected]>
@Sinity
Sinity merged commit 3be104e into master Aug 5, 2026
3 checks passed
@Sinity
Sinity deleted the feature/fix/parse-failures-current branch August 5, 2026 18:12
Sinity added a commit that referenced this pull request Sep 3, 2026
ops.db is disposable and evolves by re-applying its additive DDL, so an
absent or superseded identity stamp is a convergence input, not a
refusal; the derived-identity refusal now applies to the index tier
only. Writers that lazily created ops.db opened an empty version-0 file
the tier gate then refused; SLO samples, the context ledger, the context
image, and the daemon HTTP ops read bootstrap it through
initialize_archive_database when it is missing.

The write coordinator refused its own managed post-write tasks while
draining on shutdown, stranding the terminal whale receipt the drain
exists to deliver; managed tasks stay admissible while draining.

Tests: status reports a not-ready schema mismatch with exit 1 (#3819)
and asserts the integrity fields; the daemon-services test uses
tmp_path instead of a fixed /tmp archive.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
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