Repository navigation
refactor: retire repair tooling and delete unreachable code - #5680
Merged
Merged
Conversation
…gin census tools No current write path produces missing blob references: raw-deleting routes remove blob_refs with their raw row, publication reserves bytes before the referencing row commits, and GC reclaims only unreferenced hashes. The replace-from-source, prune-orphans and recovery-plan commands, their daemon operations, actuators, retirement framework and the Beads-origin census (origin removed in #4363) are deleted. The read-only blob-reference-debt classifier and health alert remain. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
POST /api/demo/augment applied the demo writes through the write bridge while maintenance.demo.augment held a second executor for the same effect; the route now submits the declared operation. Also pin the single ref-resolution plan across the daemon import and the facade (polylogue-j5u2b) and derive the seed ontology's grain check from ref admission instead of a hand tuple (polylogue-kqlb4). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Zero-consumer modules (provenance, session_mutations, plan_execution, streaming_markdown, attachment_relink, user_overlay orphan check, the code_detection.detection shim, the query-store run-projection mixin), the unused retrieval candidate/search layer, the orphaned whole-archive convergence pledge, the legacy sqlite-vec provider subclass and ~130 never-referenced functions. Each was checked for importers, string dispatch and entry points. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
Keep run_sync_with_completion, which cold-build preparation now uses; drop create_managed_task and reset_archive_tier_init_counts, which lost their last callers; shrink the schema-closure baseline by the modules that left the closure. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sinity
enabled auto-merge (squash)
September 27, 2026 22:51
Sinity
added a commit
that referenced
this pull request
Sep 28, 2026
## Problem #5680 deleted `_ProcessBoundedThreadPoolExecutor._adjust_thread_count` as unreachable. Nothing in the repository names it, but `ThreadPoolExecutor.submit` calls it: it was the hook that made census parse workers daemon threads. Without it a wedged parse worker is an ordinary non-daemon thread, so it can hold daemon process exit, and `tests/unit/daemon/test_parse_prefetch.py::test_shutdown_is_process_bounded_with_wedged_parse_worker` fails deterministically on master (`assert all(thread.daemon for thread in stage._executor._threads)`). ## Change Restore the override unchanged in behavior. Its docstring now says `submit` calls it, so the next dead-code sweep does not remove it again. ## Verification - `devtools verify --quick`: PASSED. - `devtools test tests/unit/daemon/test_parse_prefetch.py`: PASSED (the wedged-worker test included). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6 Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Sep 28, 2026
Sinity
added a commit
that referenced
this pull request
Sep 29, 2026
#5790) ## Summary Lands the real fixes from the worker-5 pass over storage Codex review debt (beads `polylogue-1tyq5.98`, `.99`, `.100`, 75 findings). 28 findings are fixed here with production-route regressions. 13 were already fixed on master, 8 are stale, 2 are refuted and 24 were not reached. Every kept fix was re-checked against current master. None of the cited or touched storage files changed on master after the salvage base `ab28700c1b`, and the later master merge touched none of this PR's files. ## Problem Each defect below was confirmed on master by a regression test that fails against master's production code (revert-proof job 2488): - **Archive location and tuples.** A root named `.index-generations` resolved to its parent. Local ops/embeddings tiers refused a durable symlink farm. The tuple manifest loader normalized unknown, missing and coerced fields before recomputing the seal, and it admitted a sealed obsolete schema fingerprint. An inactive destination could be a symlink or hard link to a foreign database, which SQLite then initialized; this happened both through bootstrap and through embedding preparation. A forged destination generation passed when the caller gave no hint. A replaced `audit.db` escaped the authority digest. Neither new directory entry was fsynced. Any root that merely contained `.archive-tuples` was refused. - **Readiness.** With a zero denominator the result was `UNMEASURED` even when blocking evidence loss had been measured. - **Block anchors.** Relocation followed NULL-inheritance edges. A private 512-node composer hid blocks that production reads expose. It also bound one SQL variable per transcript message, returned the first sibling match instead of `ambiguous`, and skipped same-session drift when the anchored message had vanished. - **Profiles and status.** `selected_part_facts` reported `valid` while ordinary inspection reported `stale` under pending demand. A session missing only its latency sibling was never rediscovered. Sync hydration dropped `direction`/`producer_ref`. A shared dependency superset zeroed `run_count` on archives that lacked `session_events`. - **Lineage and topology.** A compact-lineage page with `node_limit=1` could not advance past the seed. `siblings()` listed a child once per evidence edge. An unrelated component's cycle or conflict flagged a healthy topology. - **Markers, embeddings and FTS.** One accepted-marker convergence sweep delivered one batch and stopped. Reordered request options changed the recipe hash, and non-float32 recipes produced usable-looking contracts. A failing owned `COMMIT` in FTS repair ran outside rollback protection and left the transaction open. ## Solution - `archive_identity.py`: the innermost generations marker owns the path. Symlink-farm admission counts only the source, user and audit tiers. - `archive_tuple_location.py`: exact manifest key and type validation before the seal. Schema fingerprints must equal the running writer's. The final tier entry must be absent or an unshared regular file (`lstat`, `st_nlink == 1`). The destination generation must equal the manifest's. The live location is re-resolved and the audit identity rechecked. Both new directory entries are fsynced. Only `.archive-tuples/tuple-<id>` marks a candidate path. The unused whole-tuple `expected_tier` is removed; single-tier writers keep it on `validate_inactive_destination`. - `archive_readiness.py`: positive blocking counts are evaluated before the zero-denominator return. - `block_anchor.py`: the private composer and its cap are deleted. Relocation walks every prefix-sharing and spawned-fresh neighbour once and collects the distinct own physical rows that match the hash. Each query binds two values. More than one match is `ambiguous`. Same-session drift is checked before lineage, even when the message is gone. - `derivation.py`: required-page discovery includes sessions missing a latency sibling. Selected facts use the demand-aware classifier. - `rebuild.py`: the sync loader selects and hydrates the attachment provenance columns. The `input_binding.py` exclusion reasons are updated to match. - `status.py`: each run projection declares exactly the relations its own body reads. - `compact.py`: the seed rides every page outside the `node_limit` budget. - `topology.py`, `topology/derivation.py`: siblings are deduplicated as nodes, while evidence edges stay on `edges`. Cycle and conflict flags come from the returned edges. - `marker_domain.py`: `required_page` returns the head as its continuation, and it ends the sweep when the head has not moved (held or failed). One pass drains every committed batch without looping on or overtaking a held head. - `embeddings/identity.py`: request options are sorted and duplicate keys refused; only float32 output is accepted. Production recipes carry no options, so no stored recipe hash or vector address moves. - `fts_lifecycle.py`: the owned `COMMIT` moves inside the rollback guard. ## Derived-identity closure This PR is identity-moving: it must land before the fresh rebuild, never mid-run. It touches 12 members of the committed closure baseline (`docs/plans/schema-closure-baseline.json`, unchanged; the `schema-closure` gate passed): `polylogue/analysis/topology.py`, `polylogue/storage/archive_identity.py`, `polylogue/storage/archive_readiness.py`, `polylogue/storage/archive_tuple_location.py`, `polylogue/storage/derived/lineage/compact.py`, `polylogue/storage/derived/session/{derivation,input_binding,rebuild,status}.py`, `polylogue/storage/derived/topology/derivation.py`, `polylogue/storage/embeddings/identity.py`, `polylogue/storage/fts/fts_lifecycle.py`. Not in the closure: `polylogue/storage/block_anchor.py`, `polylogue/storage/derived/session/marker_domain.py`. ## Verification All checks ran as AgentCTL jobs on this worktree; nothing ran in-process. - `agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w5` returned job **2686** on head `2136284cf0`: `verify: PASSED exit=0` (all gates, including `schema-closure`, `layering` and `mypy`). - `agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w5 -- <36 test modules covering every changed module and its consumers>` returned job **2687** on `2136284cf0`: 855 passed, 3 failed, 1 error. The 3 failures and the error are `test_archive_readiness::test_pinned_materialization_readiness_degrades_like_its_path_twin`, `test_read_view_operations::test_lineage_and_topology_use_the_pinned_graph_engines`, `test_session_partition_convergence::test_the_partition_input_columns_are_projected_or_declared_excluded`, and a descriptor-leak teardown error in `test_event_order_permutations_converge_to_the_same_relation`. All four fail identically on master `1beb2e516a` (job **2643**) and are untouched by this PR. - Revert proof: the new regression tests ran on a master checkout (`1beb2e516a`, production code unchanged) in job **2488**: `38 failed in 273.95s`, which is every named regression. The rebuilt deep-anchor test then ran alone in job **2685** and failed on the assertion (`message_id not found in the named session or its lineage neighborhood`) in 10.6 s. On this branch it passes (job **2684**, 22 passed). - Hosted: `ci/circleci: quick-gate` and `stacked-review-threads` gate the merge. ## Self-review - **Sibling sites.** The final-entry link check sits in `validate_inactive_destination`, the one gate that bootstrap, embedding preparation and whole-tuple validation all call. The `COMMIT`-outside-`try` pattern also occurs in `fts_invariant_snapshot_sync`, but that closes a read-only snapshot transaction whose `COMMIT` cannot lose writes, so it is left as it is. The FTS derivation writers (`fts/derivation.py`) already commit inside their guard. The status dependency map was re-derived for all three run projections from the tables their SQL actually reads. - **Cancellation, shutdown and loops.** The marker page loop cannot spin. The kernel rejects a continuation it has already visited, and `required_page` returns no keys and no cursor once the head stops moving. The anchor neighbourhood walk visits each session once through a `visited` set, and it terminates on cycles. - **Unbounded reads.** The anchor walk is now bounded by the lineage component rather than by an arbitrary 512-node cap, which had produced wrong `missing` answers. Each step is one indexed edge query and one two-bind hash query. Removing the per-transcript `IN` list removes the only unbounded bind list. - **Fail-open fallbacks.** The manifest loader no longer defaults a missing `state` to inactive. Readiness no longer lets a zero denominator mask measured loss. Anchors refuse on ambiguity and never pick the first match. - **Compatibility shims.** There are none. The removed `expected_tier` parameter had no caller, and mypy (`verify_quick`) proves none remains. The `float16` case was removed from `test_embedding_request_identity.py` because that element type is now refused. - **Removed symbols still referenced.** `_MAX_LINEAGE_SEARCH_NODES`, `_prefix_edge`, `_composed_message_ids` and `_hash_matches_in_composed_session` have no remaining references in code, tests or monkeypatch targets (grep, plus the mypy gate). - **Tests on the production route.** The regressions drive `initialize_archive_database`, `prepare_inactive_embedding_generation`, `ArchiveTupleAllocator.load`, `resolve_block_anchor` over `write_parsed_session_to_archive` data, `converge()` over a real derivation registry, `load_sync_batch` + `hydrate_sessions`, `session_insight_status_sync`, and `repair_message_fts_index_sync` with a real SQLite authorizer denying the first `COMMIT`. The 520-deep anchor test asserts that the cited session's `read_archive_session_envelope` really contains the block. Every named test fails on master (job 2488). ## Per-finding dispositions | key | disposition | evidence | test | |---|---|---|---| | 98.01 | fixed | archive_identity innermost marker | A::test_generation_root_uses_the_final_index_shape | | 98.02 | fixed | farm admission over durable tiers | A::test_durable_symlink_farm_allows_local_disposable_tiers | | 98.03 | fixed-already | archive_readiness.py:798,1167 `attach_readonly_database` | — | | 98.04 | fixed | blockers before zero denominator | A::test_zero_denominator_does_not_erase_measured_evidence_loss | | 98.05 | fixed-already | archive_readiness.py:1886 `attach_readonly_database` | — | | 98.06 | fixed | exact manifest shape before seal | A::test_tuple_loader_rejects_unsealed_manifest_shape_changes | | 98.07 | fixed | fingerprints equal running writer | A::test_tuple_loader_rejects_a_sealed_obsolete_schema | | 98.08 | fixed | unshared regular final entry | A::test_inactive_writer_refuses_foreign_final_file_links | | 98.09 | fixed | generation bound to manifest | A::test_destination_generation_must_match_its_manifest_without_a_caller_hint | | 98.10 | fixed | live re-resolve + audit identity | A::test_tuple_writer_rechecks_audit_identity_after_allocation | | 98.11 | fixed | whole-tuple `expected_tier` removed (no caller; mypy) | — (removed parameter) | | 98.12 | fixed | fsync archive root and tuples root | A::test_allocation_fsyncs_both_new_directory_entries | | 98.13 | fixed | typed `tuple-<id>` child required | A::test_reserved_name_alone_is_not_an_inactive_tuple | | 98.14 | not reached | — | — | | 98.15 | fixed-already | blob_gc.py:235,258 catch SchemaSkewError | — | | 98.16 | fixed-already | blob_gc.py:438-444 fsync marker + dir | — | | 98.17 | fixed-already | blob_gc.py:497 64-hex check | — | | 98.18 | refuted | pre-reset index as GC authority is forbidden legacy authority | — | | 98.19 | not reached | — | — | | 98.20 | fixed-already | blob_gc.py:1352-1355 marker only when `not dry_run` | — | | 98.21–98.24 | not reached | — | — | | 98.25 | stale | `_write_jsonl_rows` removed in e20f6f5 (#5680) | — | | 99.01, 99.02 | stale | writer removed in e20f6f5 (#5680) | — | | 99.03 | fixed-already | blob_integrity.py:1262 subtracts unowned | — | | 99.04 | stale | no generation-scoped projection remains | — | | 99.05–99.07 | not reached | — | — | | 99.08 | fixed | only classified inheritance edges | L::test_anchor_does_not_relocate_through_an_unclassified_edge | | 99.09 | fixed | private capped composer deleted | L::test_anchor_relocation_reaches_an_ancestor_beyond_the_former_search_cap | | 99.10 | fixed | two binds per lookup | L::test_anchor_hash_lookup_does_not_bind_every_transcript_message | | 99.11 | fixed | drift before lineage for a vanished message | L::test_anchor_relocates_locally_after_its_original_message_disappears | | 99.12 | fixed | all distinct matches before uniqueness | L::test_anchor_refuses_two_distinct_sibling_hash_matches | | 99.13 | not reached | — | — | | 99.14 | fixed-already | iterative walk landed in df70214 (#5685); worker rewrite dropped | — | | 99.15 | fixed | seed outside page budget | test_compact_lineage.py::test_one_node_pages_advance_past_the_seed | | 99.16–99.18 | not reached | — | — | | 99.19 | stale | plan-no-progress path gone | — | | 99.20, 99.21 | not reached | — | — | | 99.22 | fixed | demand-aware selected facts | P::test_selected_profile_facts_do_not_certify_pending_demand | | 99.23 | fixed | latency sibling in discovery | P::test_required_profile_page_recovers_a_missing_latency_sibling | | 99.24, 99.25 | not reached | — | — | | 100.01 | not reached | — | — | | 100.02 | fixed | head as continuation; stop on unmoved head | test_accepted_marker_consumer.py::test_one_convergence_sweep_delivers_every_accepted_marker_batch | | 100.03 | stale | per-session marker-set cursor gone | — | | 100.04 | fixed-already | `applied_sequence` + `expected_prior_sequence` in BEGIN IMMEDIATE | — | | 100.05 | fixed | provenance through sync loader | P::test_sync_hydration_preserves_stored_attachment_provenance | | 100.06, 100.07 | fixed-already | rebuild retires absent families; revision-matched acks | — | | 100.08 | stale | thread-row stamping gone | — | | 100.09 | refuted | retaining removed fields is a forbidden compatibility path | — | | 100.10 | fixed | per-projection dependencies | P::test_status_counts_runs_without_unrelated_product_tables | | 100.11 | fixed | siblings deduplicated as nodes | L::test_topology_siblings_are_nodes_not_duplicate_evidence_rows | | 100.12 | fixed | flags from returned edges | L::test_topology_fault_flags_are_scoped_to_the_returned_component | | 100.13–100.15 | not reached | — | — | | 100.16 | fixed-already | generations.py:759 contract before child | — | | 100.17 | fixed | options sorted, duplicates refused | C::test_equal_provider_requests_have_equal_recipe_identities | | 100.18 | fixed | float32 only | C::test_embedding_recipe_refuses_unimplemented_output_encodings | | 100.19–100.21 | not reached | — | — | | 100.22 | fixed | shared final-entry check via embedding preparation | A::test_embedding_preparation_rejects_a_foreign_final_symlink | | 100.23 | fixed | COMMIT inside rollback guard | C::test_fts_owned_commit_failure_rolls_back_and_allows_retry | | 100.24 | fixed-already | index_generation.py:892,949 restore predecessor | — | | 100.25 | stale | `commit_candidate_membership` removed in 0b1e99d (#5336) | — | A = `tests/unit/storage/test_archive_location_admission.py`, L = `test_block_anchor_lineage_and_topology.py`, P = `test_profile_selection_and_hydration.py`, C = `test_embedding_recipe_and_fts_commit.py`. Counts: `.98` 11 fixed / 6 fixed-already / 1 stale / 1 refuted / 6 not reached. `.99` 8 / 2 / 4 / 0 / 11. `.100` 9 / 5 / 3 / 1 / 7. ## Residuals - 24 findings are not reached and remain open on their beads. - The link check on the final entry is a pre-open `lstat`. A process that swaps the entry between the check and SQLite's open is outside the single-writer contract. - The anchor neighbourhood walk costs grow with the size of the lineage component; the walk is not capped, because a cap produced wrong answers. 🤖 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]>
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deletes repair-shaped tooling whose producing code is gone, routes the demo-augment HTTP route through its declared operation, and removes unreachable modules and functions. Four themed commits.
Problem
blob-reference-replace-from-source,-prune-orphans,-recovery-plan, their daemon operations, actuators and the campaign-actuator retirement framework) existed to repair missing blob references from a pre-fresh-start incident. No current write path produces that state: raw-deleting routes removeblob_refswith their raw row, publication reserves bytes before the referencing row commits, and GC reclaims only unreferenced hashes.POST /api/demo/augmentapplied demo writes through the write bridge whilemaintenance.demo.augmentheld a second executor for the same effect.polylogue/,devtools/,tests/,docs/).Solution
blob-reference-debtclassifier and the daemon health alert, whose docs now say a non-zero count is a producer defect.maintenance.demo.augment; the route declaration names that operation instead of a migration reason. New tests prove bothwith_overlaysvalues reach the operation and that a refused operation is not reported as success.plan_ref_resolution, and the facade gives the same answers for an existing and a missing message.phasekind is checked by ref admission, not a hand-written tuple.plan_execution, the retrieval candidate/search layer,streaming_markdown,attachment_relink, the user-overlay orphan check, thecode_detection.detectionre-export shim, the whole-archive convergence pledge (its only writer left in feat: Admit intake pages as one batch and delete the watcher chunk route #5233), and the legacy sqlite-vec provider subclass.Verification
devtools testover 141 affected files before the rebase: 2886 passed, 55 failed; 11 passed when rerun alone. The remaining failures were run on cleanorigin/master(one run of those IDs) and all failed there too, except my own new test (fixed) and two workload-artifact tests that time out under host load.devtools testover the annotation-import, maintenance registration/declarations, archive-maintenance CLI, discovery-progress, write-coordinator, demo-augment route, route-family and blob-integrity files: 157 passed, 2 failed. Both failures aretest_workload_artifactsseeding tests that hit the 120 s pytest timeout; on clean master the same tests take 115-130 s under the current host load.devtools gatelayering, rebuild-routes, declaration-bindings, controlled-read, api-parity, doc-commands, mypy, schema-closure all pass;devtools render all --checkclean.Residuals
🤖 Generated with Claude Code
https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4