Skip to content

refactor: delete fixed-defect repair scaffolding and unfabricate archive-debt failures - #3457

Merged
Sinity merged 5 commits into
masterfrom
feature/refactor/escape-hatch-sweep
Jul 31, 2026
Merged

Sinity merged 5 commits into
masterfrom
feature/refactor/escape-hatch-sweep

Conversation

@Sinity

@Sinity Sinity commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Escape-hatch/defensive-scaffolding sweep: deletes two repair surfaces whose defects are fixed and whose invariants the automatic write path now maintains, and converts the archive-debt collectors' silent except sqlite3.Error: return [] swallows into loud failures. Files beads for the cases where a manual surface turned out to have live work (which is evidence of a broken automatic path, not a deletable hatch).

Problem

Standing operator policy: once an automatic path maintains an invariant, the redundant manual surface is deleted, not demoted to break-glass; degraded-mode paths must not silently produce a worse answer.

  • polylogue/maintenance/hook_deinflation.py was the one-time retroactive repair for hook events ingested as sessions (polylogue-31r1). The forward fix (write_source_hook_event) owns the invariant, the retroactive pass ran on the live archive, and the module has zero production callers (only its own test imported it). Live evidence: rows matching its repair predicate in source.db = 0.
  • The session_timestamp_backfill maintenance target existed for rows ingested before the writer learned to derive sessions.created_at_ms/updated_at_ms from message evidence (polylogue-m3p9). The writer path owns that invariant (covered by tests/unit/storage/test_archive_tiers_write.py derives/does-not-override/leaves-null tests) and index.db is rebuildable. Live evidence: sessions missing timestamps while having any occurred_at_ms message evidence = 0.
  • Five collectors in polylogue/operations/archive_debt.py fabricated "no debt" when they could not read a tier (except sqlite3.Error: return [] / return False) — the fabricated-answer class (polylogue-8zzs/oitx): the surface whose job is to reveal problems hid its own failure.

Solution

  • Delete hook_deinflation.py + its test; regenerate the topology projection.
  • Delete the session_timestamp_backfill catalog spec, storage module, storage/repair.py shims + handler-dict entries, and its test; update catalog-literal tests; regenerate cli-reference, test-quality-workflows, topology, and terminal snapshots.
  • archive_debt.py: let sqlite3.Error propagate in _assertion_candidate_rows, _raw_materialization_rows, _provider_usage_rows, _table_exists. Missing-file/missing-table guards remain explicit representable states. _read_user_version deliberately keeps returning None on unreadable files — that None is explicitly modeled downstream as a blocked version-debt row with a caveat, not a fabricated clean answer. The daemon status caller already wraps archive_debt_list and reports available: false on failure; the CLI now fails loudly.

Kept, with beads instead of cuts (a bypass with live work is a bug report, not a deletion):

  • message_type_backfill: a read-only scan of the live archive found 1,919 rows (of 1,219,627) the current classifier would reclassify — the ingest path diverged from persisted rows without a SEMANTIC_REPARSE delta. Bead polylogue-c831 owns fixing the automatic path first.
  • daemon/fts_startup.py (startup-only FTS repair duplicating the fts convergence stage) — bead filed, ppkj shape.
  • raw-authority frontier "break-glass" apply options + caller-less maintenance/raw_authority_reset.py — bead filed; not actioned because the subsystem is live-degraded (4,174 unresolved blockers) and polylogue-hjpx/lkrc/t93b own that convergence work.

Verification

  • devtools verify --quick — exit 0 (format, lint, mypy --strict, render all --check, 96s).
  • devtools test tests/unit/core/test_maintenance_targets.py tests/unit/devtools/test_artifact_graph.py tests/unit/devtools/test_scenario_coverage.py tests/unit/maintenance/test_targets.py — 21 passed.
  • devtools test tests/unit/maintenance/test_registry.py tests/unit/maintenance/test_idempotency.py tests/unit/maintenance/test_failure_routing.py tests/unit/maintenance/test_resume.py — ok.
  • devtools test tests/unit/cli/test_check_support_runtime.py tests/unit/core/test_artifact_graph.py tests/unit/storage/test_repair.py — ok.
  • devtools test tests/unit/cli/test_debt_command.py — ok.
  • devtools test tests/unit/cli/test_terminal_snapshots.py -- --snapshot-update — 4 snapshots updated (target list shrank).
  • Live-archive evidence gathered read-only via sqlite3 "file:...?mode=ro"; not run: full suite (devtools verify --all), integration tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 31, 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: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: 88b28f27-bcac-471e-9b57-16a31160e9b4

📥 Commits

Reviewing files that changed from the base of the PR and between 7e11be7 and dddd077.

📒 Files selected for processing (16)
  • .beads/issues.jsonl
  • docs/cli-reference.md
  • docs/maintenance.md
  • docs/plans/topology-target.yaml
  • docs/test-quality-workflows.md
  • polylogue/maintenance/hook_deinflation.py
  • polylogue/maintenance/targets.py
  • polylogue/operations/archive_debt.py
  • polylogue/storage/repair.py
  • polylogue/storage/session_timestamp_backfill.py
  • tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr
  • tests/unit/core/test_maintenance_targets.py
  • tests/unit/devtools/test_artifact_graph.py
  • tests/unit/devtools/test_scenario_coverage.py
  • tests/unit/maintenance/test_hook_deinflation.py
  • tests/unit/storage/test_session_timestamp_backfill.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 4 commits July 31, 2026 15:31
… repair

Problem: polylogue/maintenance/hook_deinflation.py was the retroactive
repair for hook events ingested as standalone sessions (polylogue-31r1).
The forward fix (write_source_hook_event) has owned the invariant since
PR #3265, the retroactive pass ran on the live archive, and the module
has zero production callers — only its own test imported it.

Evidence: live source.db count of rows matching the repair predicate
(source_path LIKE '%/hooks/pending/%' AND source_path IN raw_hook_events)
is 0; grep for repair_hook_session_inflation finds no caller outside the
deleted test.

Repair scaffolding for a fixed defect is pure surface area; the invariant
(hook events are never persisted as raw sessions) is maintained by the
write path and covered by its own tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
Problem: the target existed to derive sessions.created_at_ms/updated_at_ms
for rows ingested before the write path learned to fall back to message
evidence (polylogue-m3p9). That automatic path has owned the invariant
since it landed — covered by the writer tests in
tests/unit/storage/test_archive_tiers_write.py (derives-from-evidence,
does-not-override-provider, leaves-null-without-evidence) — and index.db
is a rebuildable tier, so any residual pre-fix row is regenerated by an
ordinary rebuild.

Evidence the manual surface is dead: on the live archive, sessions
missing created_at_ms/updated_at_ms while having any message with
occurred_at_ms evidence = 0 (the remaining NULL-timestamp sessions are
genuinely evidence-free and the backfill would never touch them).

What changed: removed the catalog spec, the storage backfill module, the
repair.py preview/repair shims and handler-dict entries, the module's
test file, and regenerated the generated surfaces (cli-reference,
test-quality-workflows, topology projection, terminal snapshots).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
…ors fail

Problem: five collectors in polylogue/operations/archive_debt.py wrapped
their SQLite reads in 'except sqlite3.Error: return []' (and
_table_exists in 'return False'), so a debt-listing surface that could
not read a tier reported an empty debt list — indistinguishable from a
genuinely clean archive. This is the fabricated-answer class
(polylogue-8zzs/polylogue-oitx shape): the one surface whose job is to
reveal problems silently hid its own failure.

What changed: _assertion_candidate_rows, _raw_materialization_rows,
_provider_usage_rows, and _table_exists now let sqlite3.Error propagate;
missing-file and missing-table guards remain explicit representable
states. _read_user_version keeps returning None on unreadable files
because that None is explicitly modeled downstream as a 'blocked'
version-debt row with a caveat, not a fabricated clean answer. The
daemon status caller already wraps archive_debt_list and reports
'available: false' on failure, so daemon status degrades explicitly
instead of showing an empty debt table; the CLI now fails loudly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
polylogue-c831: message_type persisted-classification drift (1,919 live
candidates) — the manual backfill target has live work, which is evidence
the automatic path diverged, so it stays until the automatic path is
fixed. Two more beads: fold fts_startup.py into the fts convergence
stage (startup-only repair shape, ppkj-adjacent), and resolve the
raw-authority break-glass surfaces against the no-break-glass policy
once the blocker backlog work (hjpx/lkrc/t93b) lands.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
@Sinity
Sinity force-pushed the feature/refactor/escape-hatch-sweep branch from 4d79fdc to 12bec08 Compare July 31, 2026 13:32
@Sinity
Sinity merged commit 21477ec into master Jul 31, 2026
1 of 3 checks passed
@Sinity
Sinity deleted the feature/refactor/escape-hatch-sweep branch July 31, 2026 13:37
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