Skip to content

chore: delete the manual rebuild engine and the generic repair product - #4698

Open
Sinity wants to merge 12 commits into
masterfrom
lane/repair-engine-delete
Open

chore: delete the manual rebuild engine and the generic repair product#4698
Sinity wants to merge 12 commits into
masterfrom
lane/repair-engine-delete

Conversation

@Sinity

@Sinity Sinity commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

Daemon convergence becomes the only build path. Deletes the manual rebuild
engine, the generic repair product, the storage/index FTS shim and the
declared-not-routed candidate-build operation, with the commands, HTTP routes,
MCP operations, docs and tests they owned.

215 files, +1081 / -39861.

Problem

Two mechanisms built the same derived state. The manual rebuild engine
(rebuild_index, sharded_rebuild, replay, reindex_canary, the daemon
bulk_rebuild route) and the generic repair framework (REPAIR_HANDLERS,
run_selected_maintenance, the maintenance planner/registry/preview/envelope)
duplicated the raw-materialization drain the DaemonConverger already runs,
each with its own resume, promotion and failure vocabulary. storage/index.py
had no production caller, and the candidate-build operation contract existed
only for the retired engine.

Solution

Deleted per file (largest first):

file deleted
polylogue/maintenance/rebuild_index.py 2748
tests/unit/maintenance/test_rebuild_index_provenance_gate.py 1651
polylogue/maintenance/replay.py 1559
polylogue/storage/repair.py 1426 (34 kept as raw_convergence.py)
tests/unit/storage/test_incremental_rebuild_equivalence.py 1139
tests/unit/maintenance/test_resume.py 1108
tests/unit/storage/test_repair.py 1069
tests/unit/cli/test_archive_maintenance_cli.py 1061
tests/infra/rebuild_cost_model.py 1034
polylogue/maintenance/planner.py 764
tests/unit/maintenance/test_inactive_candidate_durable_barrier.py 739
tests/unit/maintenance/test_blob_reference_closure.py 709
polylogue/daemon/bulk_rebuild.py 692
devtools/rebuild_safety_scenario.py 685
tests/unit/daemon/test_bulk_rebuild.py 679
polylogue/maintenance/sharded_rebuild.py 612
polylogue/cli/commands/maintenance/_rebuild_index.py 595
tests/infra/reindex_campaign.py 575
polylogue/operations/candidate_build.py 560
polylogue/maintenance/blob_reference_closure.py 540

storage/repair.py's daemon-path closure moves to
storage/raw_convergence.py; RepairResult is RawConvergenceResult and
repair_raw_materialization is converge_materialization.

Surviving proofs move to the owners that still reach them: the exact-hash
closure predicate to test_archive_verification.py through verify_archive,
and the append-merge attachment position to test_attachment_relink.py
through write_parsed_session_to_archive. Retirement is pinned by tests: the
maintenance MCP tool neither declares nor dispatches preview/execute/
status/list, and the nine retired ops maintenance verbs fail discovery.

The layering baseline ratchets 297 -> 288.

Verification

.venv/bin/python -m devtools verify --quick

13 gates ok, exit 0. gate layering: "count":0,"stale_baseline_count":0.
devtools render all --check reports nothing out of sync.

.venv/bin/python -m devtools test tests/unit/storage/test_raw_convergence.py \
  tests/unit/cli/test_status.py tests/unit/mcp/test_tool_discovery.py \
  tests/unit/maintenance/test_archive_verification.py

288 passed, 1 failed (pueue 1661).

An earlier 14-file batch reported 649 passed / 15 failed. Eleven were
OSError: [Errno 24] Too many open files in one xdist worker and passed on
re-run. Three were real and are fixed here: the retired-operation assertion
read inspect.signature, which returns the unevaluated string under postponed
annotations, and two test_status.py cases measured the maintenance failure
count this branch removes.

Residuals

test_archive_verification.py::test_empty_covered_table_without_stats_is_not_missing_coverage
fails, inherited from master and not touched here: the test is byte-identical
to origin/master at f80542b, and running master's own copy against master's
source fails identically. Its premise is wrong — ANALYZE writes one
sqlite_stat1 row per index (3 for action_pairs) on an empty indexed table.
Bead filed.

Verification is focused, not a corpus run; it proves the selected scope only.

Beads: polylogue-hwwtq, polylogue-6kur.2, polylogue-6kur.3, polylogue-5vps8

Sinity and others added 12 commits September 5, 2026 03:58
…oute

Ordinary daemon convergence (the raw-materialization drain) is the only
build path. Removes maintenance/rebuild_index.py, sharded_rebuild.py,
replay.py, reindex_canary.py, daemon/bulk_rebuild.py, the rebuild-index,
rebuild-index-status and reindex-canary CLI verbs, the four daemon HTTP
routes that served them, the daemon loop's bulk-rebuild routing, the
devtools rebuild-safety scenario, and the writer-less
active_rebuild_index_attempts readers; next-action prose points at
`polylogued run`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
…wner

storage/repair.py's daemon-path closure (raw materialization conveyor,
whale pass, backlog census, raw-authority frontier strategies) moves to
storage/raw_convergence.py with RepairResult renamed RawConvergenceResult
and repair_raw_materialization renamed converge_raw_materialization.
The generic framework goes: REPAIR_HANDLERS, run_selected_maintenance,
empty-session/superseded-snapshot/session-insight mutators, archive-debt
previews and readiness vocabulary, maintenance planner/targets/replay/
failure_routing/envelope/registry/preview/cost_backfill/scope, the
doctor --repair/--cleanup/--target/--preview/--vacuum flags, the
maintenance plan/run/run-preview/preview/status CLI verbs, the daemon
HTTP maintenance plan/run/status/operations routes, MCP maintenance
preview/execute/status/list, the failures.jsonl status projection, and
the blob-reference-closure mutation half.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
… for the sole route

storage/index.py had no production caller; tests reach the FTS lifecycle
owner through tests/infra/fts.py. docs/maintenance.md, cost-model,
security, daemon, configuration, onboarding, atlas/mcp and the design
inventory describe daemon convergence as the only build path.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
The inactive-candidate construction operation and its domain check plan
existed only for the retired rebuild engine; nothing routed them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
The blob-reference-closure suite proved the deleted mutation half. Its two
tests that outlive it move to their owners: the exact-hash predicate proof to
test_archive_verification.py (reached through verify_archive) and the
append-merge position proof to test_attachment_relink.py (reached through
write_parsed_session_to_archive). The archive-debt readiness component and
MaintenanceCategory died with the repair product, so their readiness case
goes; ArchiveDebtStatus is no longer a legacy readiness source.
raw_authority.repair_materialization is converge_materialization.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
Post-merge follow-through for the repair/rebuild deletion. The archive-debt
operation reads the blob limit from storage/raw_convergence. The layering
baseline ratchets 297 -> 288: entries for deleted files go, and the two
status readers' baselined edge follows the storage/repair rename. The stuck-
source runbook points at commands that exist. Tests pin the retirement: the
maintenance MCP tool neither declares nor dispatches preview/execute/status/
list, and the nine retired `ops maintenance` verbs fail discovery.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
mypy resolves a missing attribute but silently ignores a missing module, so
imports of the deleted modules survived every static gate. The Codex 804
proof keeps acquisition, append planning, raw authority and both
converge_materialization passes, and reads the archive convergence built; its
crash/resume/promotion half went with the engine that drove it. The
maintenance CLI registration suite keeps operation-recovery, blob-conservation
and blob-integrity. The single-basis cost backfill and the maintenance
failure-sample status projection have no route left. operation_ids guarded a
path lookup that no longer exists, and rebuild_receipt has no caller.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
get_type_hints resolves the handler's operation Literal; inspect.signature
returns the unevaluated string under postponed annotations, so the retired-
operation assertion read an empty set. The status payload counts no
maintenance failures, so its key leaves the expected projection and the count
test goes with the projection it measured.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
…delete

# Conflicts:
#	polylogue/maintenance/rebuild_index.py
#	tests/unit/maintenance/test_archive_verification.py
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 8e69fe05-561c-46c0-87dc-e7e58e602b35


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 enabled auto-merge (squash) September 5, 2026 18:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 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-05T19:08:07.991533Z 253f99c 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.

@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: 253f99cd0c

ℹ️ 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 on lines +2450 to +2453
"""Rebuild derived indexes and inspect or adjudicate operation recovery.

Destructive/full-effect operations require ``confirm=True``:
``execute`` with ``dry_run=false``, ``rebuild_index``, and
``rebuild_insights`` and ``recovery_adjudicate`` all fail closed without it (interim
mitigation, polylogue-jn40).
Full-effect operations require ``confirm=True``: ``rebuild_index``,
``rebuild_insights`` and ``recovery_adjudicate`` fail closed without it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore session_ids for retained maintenance operations

The retained update_index operation is now unusable: the MCP tool signature no longer accepts session_ids, and the forwarding payload never supplies it, while _dispatch_maintenance unconditionally rejects update_index when that key is absent. The same omission prevents callers from requesting a scoped rebuild_insights; a confirmed call silently rebuilds the entire archive instead. Keep session_ids in the tool contract and forward it for these two operations.

AGENTS.md reference: AGENTS.md:L124-L126

Useful? React with 👍 / 👎.

Comment on lines 112 to +115
if (root / ".index-active-pointer").exists():
raise click.ClickException(
"reset --index is unsafe for a managed active generation; "
"use `polylogue ops maintenance rebuild-index` to create and promote a replacement"
"the pointer-managed index.db must not be deleted in place"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Provide a rebuild path for pointer-managed indexes

For an existing archive with .index-active-pointer whose active index has an older schema, both reset --index and reset --database now stop at this refusal, while daemon schema preflight classifies the mismatch as critical and parks the convergence loops. Since this commit also removes the only command that could create and promote a replacement generation, such archives have no supported way to reach the current schema without manually dismantling their topology. Preserve a daemon-owned replacement path before retiring the manual engine.

AGENTS.md reference: AGENTS.md:L76-L77

Useful? React with 👍 / 👎.

schema_quarantine_malformed: bool,
) -> None:
"""Health check with optional maintenance and cleanup previews."""
"""Read-only health check over the archive, runtime, daemon, blobs, and schemas."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retarget scenarios that still invoke retired doctor flags

The doctor command is read-only now, but polylogue/scenarios/operational_surfaces.py still defines the session-insight preview, session-insight repair, and maintenance memory-budget lanes with --repair, --cleanup, --preview, and --target. Building and executing any of those authored surfaces at this head produces a Click unknown-option error instead of exercising a production route, so the live and memory verification lanes no longer test what their names claim; remove or retarget those families together with this option removal.

AGENTS.md reference: AGENTS.md:L175-L179

Useful? React with 👍 / 👎.

Comment on lines 235 to +236
"polylogue.mcp.server_cutover.maintenance:inspect.signature",
(("operation", "list"),),
(("operation", "recovery_status"),),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate the agent maintenance contract for retained verbs

Although this declaration now advertises recovery_status, the separately published agent contract in polylogue/agent_integration/spec.py and its generated manual/data still teach maintenance(operation="preview", targets=["index"], dry_run=True) and list all of the removed planner arguments. An agent following that contract reaches the new handler with an unsupported operation and unexpected keywords rather than receiving the promised preview receipt. Update the agent-integration source contract and regenerate its tracked artifacts alongside the dispatcher change.

AGENTS.md reference: AGENTS.md:L124-L126

Useful? React with 👍 / 👎.

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