Repository navigation
refactor(config): delete two inert config keys and the whale off-switch - #3455
Conversation
Problem: the operator's standing complaint is knobs whose existence is pure cost -- documented keys nothing reads, and default-on flags whose off branch reintroduces a policy bug. What changed: - log_level: property + default + inventory entry deleted. Read by nothing (polylogue/logging.py derives its level from the --verbose flag alone); its only trace outside config.py was a docs-coverage baseline entry recording that it was never even documented. - slow_query_notice_seconds: property + default + inventory entry + POLYLOGUE_SLOW_QUERY_NOTICE_SECONDS env mapping + commented doc example deleted. The consumer was removed generations ago (last real reader traced to the pre-split archive era); zero reads in polylogue/, devtools/, or tests/. - daemon_whale_raw_materialization: flag deleted, whale pass now unconditional. Default was True since introduction (polylogue-t93b), never set anywhere (live config, history pickaxe), and the flag's own docstring described the off branch as 'the pre-polylogue-t93b behavior' -- i.e. the policy bug the feature exists to close. The off-switch unit test is deleted with the flag; the two behavior tests (candidate found / no candidate) are unchanged. Ref polylogue-8249 (inert-knob pattern), polylogue-t93b. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
…rift polylogue-010x: pre-existing environment-dependent failure of the two whale-pass daemon tests (verified identical against pristine origin/master code), classified during this branch's verification. polylogue-v6xh: notification_*/health_* typed config properties are dead accessors -- consumers read cfg.raw -- recorded as a judgement call rather than cut in the knob-excision PR. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
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. Comment |
… select (#3466) ## Summary Fixes the raw-authority-quarantine absorbing state (polylogue-u19l) by making its root cause (polylogue-w32w) structurally unrepresentable: a frontier item's actuator must have a real apply() handler only if its state is in the executability gate's admitted set. ## Problem Audit 2026-07-31 (live `source.db`, read-only) found: 4,147 open `raw_authority_blockers` rows all reading "accepted raw authority remains quarantined pending exact refinement proof"; 15,205/17,384 frontier plans residual (87%); `fixed_point=0` on all 256 retained censuses; total gap count that only ever grew (16,874 -> 17,384, never shrinking). Root cause: a quarantined raw whose refinement proof came back "ineligible" got no strategy override, so `_classify_frontier`'s default fallback assigned it `state=UNRESOLVED_PROVENANCE, actuator=REFINE_QUARANTINE`. But `REFINE_QUARANTINE` has a real apply() dispatch branch that only ever runs for `_EXECUTABLE_STATES = {SAFELY_REKEYABLE, DUPLICATE_ALIAS}` — both the daemon and the operator break-glass path (`apply_raw_authority_frontier`, which raises `RuntimeError` on any non-executable selected item) select only executable items. The handler at `raw_reconciler.py:1297` was unreachable through every path that exists. Two corrections from the audit preserved unchanged: - `unresolved_raw_replay_blockers()` already deliberately excludes frontier plan blockers from starving unrelated work. - `REFINE_QUARANTINE` is not entirely dead — the strategy override for eligible/already_repaired quarantined raws (promoting to `SAFELY_REKEYABLE`) is the real, executable 2,179-plan lane draining at 8/pass. Only the ineligible complement was absorbing. ## Solution - `_strategy_overrides` now records an override for "ineligible" quarantine proofs too: state stays `UNRESOLVED_PROVENANCE` (still tracked in `state_counts` and `raw_authority_blockers` — still an operator-visible obligation), actuator becomes `NONE` with the real ineligibility reason folded into the item's `reason` text. The ineligibility reasons enumerated in `_inspect_quarantined_accepted_raw` (missing rows, mismatched hashes, competing authority, incompatible typed envelopes) are permanent structural facts about a raw's own data, not transient states — matching the existing apply()-time code comment ("not transiently"). This is the "record a terminal, countable, operator-visible state" branch of the two legitimate options the bead named, chosen over building a refinement-proof actuator that cannot exist for permanently mismatched bytes. - Same fix applied to two more `classify_frontier` call sites with the identical shape: the no-`logical_source_key` `REFINE_QUARANTINE` fallback, and `REPLAY` on a logical-source-key mismatch (confirmed 0 live rows today via the `raw_authority_blockers` reason distribution; `REPLAY` has no apply() handler at all, fixed pre-emptively). - `polylogue-w32w`'s invariant, made structurally enforceable: `RawAuthorityFrontierItem.__post_init__` now rejects constructing an item whose actuator has a real apply() dispatch branch (`_APPLY_DISPATCHED_ACTUATORS`) paired with a non-executable state. Fires on every construction path (`_item()`, `dataclasses.replace()` in `_apply_judgment_dispositions`). `REACQUIRE`/`REQUEST_JUDGMENT` are deliberately exempt — both resolve out-of-band (ordinary re-acquisition; an operator judgment assertion promoted by `_apply_judgment_dispositions`). - `test_apply_dispatched_actuators_match_apply_branches` regex-parses the actual apply() dispatch branches out of the module source and asserts they equal `_APPLY_DISPATCHED_ACTUATORS`, so the allowlist can't silently drift. - `test_quarantine_refinement_fanout_scopes_by_logical_source_key` previously asserted the now-fixed sibling's actuator as `REFINE_QUARANTINE` — it was the direct reproduction case for this defect, encoded as expected behavior. Updated to assert `NONE`. - Also restores `polylogue/storage/sqlite/archive_tiers/common.py`'s `literal_check()` helper, deleted by #3458 on stale "uncalled" evidence after #3451 had already wired it into `archive_tiers/index.py` — broke every import of `polylogue.storage` on `origin/master` HEAD. Discovered while setting up verification for this fix; restored as a prerequisite since nothing here (or in the wider suite) can import without it. **What this fix does NOT do**: it does not reduce the 4,147 existing blocker rows or shrink `raw_authority_census_plans`' ~709K carried_forward rows (polylogue-f4z9, tracked separately) — those are pre-existing durable rows from the old misclassification and need their own migration/backfill, out of scope here. Going forward, every new census records these raws with the honest `NONE` actuator instead of reproducing the false promise. **No index rebuild is required** (`polylogue ops reset --index && polylogued run`) — `source.db`'s `revision_authority` column is unaffected; only the derived frontier classification (an index-tier read model) changes on the next census. ## Verification - `devtools test tests/unit/storage/test_raw_authority_ledger.py tests/unit/storage/test_quarantined_accepted_raw_repair.py tests/unit/storage/test_duplicate_raw_identity_repair.py tests/unit/storage/test_browser_capture_origin_repair.py tests/unit/storage/test_archive_tiers_common.py` — 81 passed - `devtools verify --quick` — exit 0 (ruff format, ruff check, mypy --strict, render all --check, layering, closure-matrix, schema-versioning policy, and the rest of the quick-tier gates) - Not run: full suite / testmon (fresh unseeded worktree); per-PR CI skips the heavy `test` suite by design. - Pre-existing, unrelated failure found and left alone (filed as polylogue-jsxj): `tests/unit/daemon/test_daemon_cli.py::test_maybe_run_raw_materialization_whale_pass_*` (`TypeError: lambda got unexpected keyword '_bootstrap'`) — introduced by #3455's `load_polylogue_config()` signature change, touches neither `raw_reconciler.py` nor `common.py`; reproduces identically on `origin/master` HEAD before this branch's changes. Ref polylogue-u19l Ref polylogue-w32w --------- Co-authored-by: Claude <[email protected]>
## Summary
Repairs
`test_maybe_run_raw_materialization_whale_pass_{runs_scoped_pass_and_emits_events,no_candidate_skips_writer}`
in `tests/unit/daemon/test_daemon_cli.py`, which fail on `master` both
in isolation and file-scope with:
```
TypeError: <lambda>() got an unexpected keyword argument '_bootstrap'
```
raised from `polylogue/config.py:2173` (`resolve_archive_root` ->
`load_polylogue_config(_bootstrap=bootstrap)`).
## Problem
`#3455` ("refactor(config): delete two inert config keys and the whale
off-switch") touched `polylogue/config.py` and this exact test file in
the same commit, and the failing tests are named after that PR's
whale-pass feature.
## Which side was wrong, and why
Production is correct; the tests are the stale side. Diagnosis:
- `_maybe_run_raw_materialization_whale_pass`
(`polylogue/daemon/cli.py:1265`) calls `archive_root()` (from
`polylogue.paths`) first.
- Both tests' autouse `_clear_polylogue_env` fixture
(`tests/conftest.py:447`) removes `POLYLOGUE_ARCHIVE_ROOT`, so
`archive_root()`'s env fast path is empty and it falls through to
`config.resolve_archive_root()`, which calls
`load_polylogue_config(_bootstrap=bootstrap)`.
- Both tests monkeypatch `polylogue.config.load_polylogue_config` with a
zero-argument lambda (originally added only to satisfy
`_resolve_raw_materialization_whale_blob_limit_bytes`'s separate
zero-arg `load_polylogue_config().raw_authority_whale_payload_bytes`
call) — it was never updated to accept the `_bootstrap` keyword the
`archive_root()` fallback path actually needs.
- Widening the lambda's signature to `**kwargs` would still fail:
`resolve_archive_root` reads `settings.archive_root` off the return
value, and a bare
`SimpleNamespace(raw_authority_whale_payload_bytes=None)` has no such
attribute.
Fix: patch `polylogue.paths.archive_root` /
`polylogue.paths.render_root` directly — the exact seam ~20 other tests
in this same file already use to sidestep this identical env-fallback
path. This keeps `load_polylogue_config`'s existing zero-arg patch
scoped to the one call site it's actually meant for
(`_resolve_raw_materialization_whale_blob_limit_bytes`).
This also resolves `polylogue-010x`: patching `load_polylogue_config`
alone made these tests pass only when some other test's
`POLYLOGUE_ARCHIVE_ROOT` override happened to leak into this test's
environment (order-dependent). Patching `archive_root()` directly makes
the archive root deterministic regardless of run order.
## Solution
- `tests/unit/daemon/test_daemon_cli.py`: both whale-pass tests now take
a `tmp_path` fixture and
`monkeypatch.setattr("polylogue.paths.archive_root", ...)` /
`render_root` before invoking
`_maybe_run_raw_materialization_whale_pass`.
- No production code changed — `archive_root()`'s env-fallback behavior
is correct as designed (per its own docstring, polylogue-4ma3).
## Anti-vacuity
The production dependency exercised is the real `archive_root()` ->
`resolve_archive_root()` -> `load_polylogue_config(_bootstrap=...)`
fallback chain in `polylogue/config.py` and `polylogue/paths/_roots.py`;
reverting this diff (restoring the zero-arg lambda) reproduces the
original `TypeError` deterministically, both in isolation and
file-scope.
## Verification
```
python -m devtools test tests/unit/daemon/test_daemon_cli.py -k whale_pass # 4 passed (isolation)
python -m devtools test tests/unit/daemon/test_daemon_cli.py # 113 passed (full file)
python -m devtools verify --quick # exit 0
```
Ref polylogue-jsxj, polylogue-010x
Co-authored-by: Claude <[email protected]>
Problem: polylogue-t93b (daemon must converge whale raw components) was dispatched for implementation, but the escalation-tier whale pass was already fully implemented and merged (#3256, #3268, #3455, #3489) prior to this session, per a same-day RECONCILE note already on the bead. What changed: independently re-verified the mechanism from source (daemon/cli.py _maybe_run_raw_materialization_whale_pass, storage/repair.py raw_materialization_whale_pass_candidate + stream-safe gating), ran the relevant tests (test_repair.py -k whale_pass, test_daemon_cli.py -k whale — 8 passed, covering the synthetic-fixture convergence AC, the non-stream-safe-fails-safely AC, and the bounded-commit-batch AC), and checked the live archive read-only for witness codex:019f49d8's current state. Appended a confirmation note: mechanism is done, witness has not converged yet purely because the ordinary trickle conveyor has not reached quiescence (whale pass only fires when quiescent), not because of a code gap. No production code changed. No PR opened — there was nothing to change. Co-Authored-By: Claude <[email protected]>
…#3694) ## Summary Drops two confirmed-dead schema surfaces named in polylogue-yp5p's write-only-table/unconsumed-config census: the `query_runs` ops.db table (write-only telemetry with zero readers) and the `active_index_db` config property (a no-op alias with zero callers). The other five findings in that bead were re-verified against current source and turned out to already be resolved by unrelated prior work -- see Verification below for the disposition of each. ## Problem polylogue-yp5p (2026-07-29 exhaustive rg-based read/write census, `.agent/handoffs/polylogue-deep-research-2026-07-09/2026-07-09-codebase-structure-audit.md` section 3) flagged three write-only tables and seven unconsumed config properties ahead of the reindex campaign. This PR re-verifies each finding against present source (~5 days of drift since the census) and purges what's still genuinely dead, per the operator's explicit schema-pruning request this session. ## Solution **`query_runs` (ops.db, disposable tier) -- still write-only, deleted:** - `ArchiveCanonicalPlanEvaluator.evaluate()` (`polylogue/archive/query/production_evaluator.py`) wrote one bounded telemetry row per standing-query evaluation (`daemon/convergence_stages.py`) and per MCP `from query:<hash>` resolution (`mcp/server_cutover.py`), but no surface anywhere read the table back -- confirmed by grepping for `FROM query_runs`/`SELECT ... query_runs` across the tree. - Dropped the table + its two indexes from `storage/sqlite/archive_tiers/ops.py`. ops.db is the disposable tier (`OPS_SCHEMA_VERSION` stays at 1, no migration chain, not tracked by `devtools lab policy schema-versioning`), so this is a plain DDL edit. - Removed `record_query_run` (and its now-unused `_json_or_none` helper) from `ops_write.py`, and `ArchiveCanonicalPlanEvaluator._record_query_run` + its call site from `production_evaluator.py`. The evaluator's now-dead `surface` constructor parameter went with it; updated its one caller (`mcp/server_cutover.py`). - Removed it from `docs/plans/layering.yaml`'s writer-module entrypoint inventory (`devtools verify layering` enforces this list matches the module's actual exports). - Deleted `tests/unit/storage/test_query_runs.py` (tested the writer function directly) and trimmed the query_runs assertions out of `tests/unit/archive/query/test_production_evaluator.py` and `tests/unit/daemon/test_standing_queries_default_evaluator.py` -- their real assertions (exactness, member_refs, stage completion) are untouched. - Updated doc comments in `cli/commands/diagnostics.py`, `operations/route_observation.py`, and `core/query_identity.py` that described `query_runs` as a peer/exclusion of the tables they document. Not touched: `ArchiveStore.query_runs()` / `run_projection_reads.query_runs()` (repository methods for querying session *runs*) and `retained_query_runs` (a durable, user.db table backing `query-run:` refs, with real readers) -- both are unrelated same-named things the original grep also had to disambiguate from. **`active_index_db` (config.py) -- still dead, deleted:** `ResolvedArchivePaths.active_index_db` was a trivial `@property` returning `self.index_db`, with zero attribute-access call sites anywhere in prod or tests. The real resolver production code actually uses is the unrelated `_active_index_db_path()` function in `daemon/cli.py`. Deleted the dead property. **Findings that drifted resolved -- left alone, documented here per the task's "if it gained a reader, leave it and note why":** | Finding | Disposition | | --- | --- | | `otlp_telemetry` table | Gone entirely -- PR #3665 already removed the whole OTLP receiver path (writer + table). `devtools/daemon_workload_probe.py` even carries a "v19 removes dead OTLP ops-tier table inventory" comment marking this cleanup. Nothing to delete. | | `session_commits` table | Gained a real reader: polylogue-cijx.3 wired `get_session_commits` into `api/archive.py`'s correlation payload (`checkout_commits`) and `insights/correlation_view.py`. No longer write-only. | | `hook_sidecar_dir` config | False positive in the original census (or fixed since) -- consumed internally in `config.py` to build `hooks_pending`, which feeds the local source-discovery candidate list (`("hooks", source_paths.hooks_pending)`). Real production consumer. | | `ingest_parse_workers` config | Not a dead property -- it's a `ConfigInventoryEntry` documenting that `POLYLOGUE_INGEST_PARSE_WORKERS` is read directly by `resolve_parse_worker_count()` (bypassing the `Settings` object), which is genuinely wired into the rebuild path (`maintenance/rebuild_index.py`, `maintenance/replay.py`, `storage/repair.py`). The rebuild is NOT silently ignoring it. | | `log_level` config | Already gone -- PR #3455 ("delete two inert config keys and the whale off-switch") removed it. | | `slow_query_notice_seconds` config | Already gone -- same PR #3455. | | `effective_path` config | False positive -- it's a helper `@property` on `ConfigInventoryEntry` used internally by `polylogue config --format json` diagnostics rendering (2 call sites in `config.py`), not a settings value itself. | | `layer_paths` config | Real production consumer: `cli/commands/maintenance/_shared.py` reads `settings.layer_paths.get(layer)`. | **Deliberately out of scope:** while verifying `otlp_telemetry`, found that its current-day incarnation `otlp_spans` (source.db, durable tier) is now *fully* dead -- zero writer (the receiver that wrote it is already gone) AND zero reader, worse than merely write-only. `docs/schema.md` already flags it: "The empty durable table remains pending an explicit migration decision." Dropping a durable-tier table needs the copy-forward-design + explicit-consent gate this repo's schema policy requires, and it wasn't the bead's literal target, so it's left for a follow-up rather than folded into this PR silently. ## Verification - `devtools test tests/unit/archive/query/test_production_evaluator.py tests/unit/daemon/test_standing_queries_default_evaluator.py tests/unit/storage/test_archive_tiers_ddl.py tests/unit/storage/test_durable_migrations.py tests/unit/mcp/test_reference_query_pipeline.py` -- `87 passed` - `devtools test tests/unit/storage/test_index_generation.py tests/unit/daemon/test_daemon_cli.py tests/unit/storage/test_archive_identity.py tests/unit/core/test_config.py tests/unit/core/test_config_inventory.py` -- `332 passed` - `devtools test tests/unit/archive/query/test_predicate_payload_roundtrip.py tests/unit/operations/test_route_observation.py` -- `28 passed` - `devtools verify --quick` -- `exit_code: 0` (ruff format/check, mypy --strict, render all, layering, closure-matrix, schema roundtrip, manifests, ci-workflows, doc-commands, docs-coverage, test-infra-currency, pytest-timeout-overrides, degrade-loudly, schema-versioning, classifier-fingerprints, demo-tour-freshness, raw-payload-hash-purity, position-derived-identity, raw-authority-frontier-executability, table-exists-duplication, schema promotion audit) - `devtools verify layering` after removing the `record_query_run` entrypoint from `docs/plans/layering.yaml` -- `No layering violations found` (confirmed the pre-existing "2 baseline entries no longer reproduce" note is unrelated drift, present identically on `master` before this change via `git stash`/re-run comparison) - Not run: full `devtools verify --seed-testmon` / testmon-affected suite -- this worktree's testmon cache wasn't pre-seeded (main checkout has `testmondata` but no `seed.json` marker, so the linked-worktree auto-bootstrap didn't trigger) and reseeding is a full-suite operation out of scope for this change's size; relied on explicit `devtools test` selection across every file/test that imports or exercises the touched modules instead. Ref polylogue-yp5p
Summary
Knob-excision sweep (operator's standing complaint: flags and conditionals that are not pointless but harmful). Deletes three config knobs where one branch strictly dominates or no branch exists at all: two documented-but-inert config keys (
log_level,slow_query_notice_seconds) and one default-on off-switch whose off branch reintroduces the policy bug its feature exists to close (daemon_whale_raw_materialization). Net: -103 lines, 3 config keys, 2 env-var mappings, 1 runtime conditional; the whale escalation pass is now unconditional.Problem
Bead polylogue-8249 established the pattern: a documented knob nothing reads is worse than no knob — it costs operator trust, test matrix, and mental model. Sweeping every
PolylogueConfigproperty for production readers (rg two ways, excluding config.py itself) found:log_level: property + default + inventory entry (logging.level), read by nothing.polylogue/logging.pyderives its level exclusively from the--verboseflag. Its only trace elsewhere was a docs-coverage baseline entry recording that it was never even documented.slow_query_notice_seconds: property + default + inventory +POLYLOGUE_SLOW_QUERY_NOTICE_SECONDSenv mapping + commented example indocs/configuration.md. Zero reads inpolylogue/,devtools/, ortests/. Pickaxe traces the last real consumer to the pre-split-archive era (perf: report slow query progress #359 introduced it; the reporter was deleted generations ago, the key survived).daemon_whale_raw_materialization: defaultTruesince introduction (polylogue-t93b, feat(daemon): converge whale raw components via bounded streaming escalation pass (polylogue-t93b) #3256), never set to any other value in the live config, any deployment, or git history (pickaxe shows only the introducing commit). The flag's own docstring described the off branch as "the pre-polylogue-t93b behavior" — i.e. holding whale components permanently offline-manual, the exact policy bug t93b closed. A default-on flag whose off branch is a known bug is pure cost: the on branch strictly dominates.Solution
polylogue/config.py: three properties, three defaults, three inventory entries, and the_FLOAT_CONFIG_KEYS/_BOOL_CONFIG_KEYSmemberships deleted (-64 lines).polylogue/daemon/cli.py:_maybe_run_raw_materialization_whale_passno longer consults config; docstring states the pass is unconditional and why.docs/configuration.md,docs/plans/docs-coverage-baseline.yaml,polylogue/sources/revision_backfill.py: stale rows/example/comment references removed in the same change (surgical renewal, no deprecation theater).tests/unit/daemon/test_daemon_cli.py: the off-switch existence test deleted with the flag; the two behavior tests (candidate found / no candidate) are unchanged. Per CLAUDE.md, no tests were added that merely assert the flags are gone.Deliberately not cut (real losing axis exists):
browser_capture_allow_remote/allow_no_auth(security valves),embedding_enabled/judgment_automation_enabled(cost opt-ins),mcp_*_enabled(role-gate contract), parse-stage worker/byte knobs (measured tuning surface),sinex_mode(permanent product mode). Judgement call recorded as bead polylogue-v6xh instead of cut: the 16notification_*/health_*typed properties are dead accessors (consumers readcfg.raw), but the keys themselves are live — that is accessor drift, not an inert knob.Verification
devtools verify --quick— exit 0 (format, lint, mypy --strict, render all --check, 18 steps).devtools test tests/unit/core/test_config.py— 95 passed.devtools test tests/unit/daemon/test_daemon_cli.py— 111 passed, 2 failed; the same 2 tests fail identically with pristineorigin/mastercode restored into the same worktree (2 failed, 112 passed), so they are pre-existing and environment-dependent, not introduced here — mechanism (autouse env scrub defeats the tests'load_polylogue_configmonkeypatch via thearchive_root()fallback) filed as bead polylogue-010x.Ref polylogue-8249, polylogue-t93b.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso