Skip to content

chore: Enforce the prose-logging form the old ratchet could not see - #5074

Merged
Sinity merged 1 commit into
masterfrom
chore/prose-logging-ratchet
Sep 14, 2026
Merged

Sinity merged 1 commit into
masterfrom
chore/prose-logging-ratchet

Conversation

@Sinity

@Sinity Sinity commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

The gate meant to enforce "no legacy logging" was blind to the form the tree actually uses. This adds the rule that sees it, at the honest count.

Problem

legacy-stdlib-logger matches logging.getLogger(...) — the acquisition of a stdlib logger. That is no longer the dominant legacy form.

About 100 modules acquire their logger through polylogue.logging.get_logger, whose returned _StdlibBoundLogger has a no-op bind() and discards every structured keyword it is given. The evidence that this matters: converting the two largest daemon modules — 59 and 31 prose sites in daemon/cli.py and daemon/http.py — eliminated zero baseline entries, because neither file had ever called logging.getLogger.

So a green legacy-stdlib-logger means "no module acquires a stdlib logger directly", not "no module logs prose". It was being read as the latter.

Solution

Add legacy-prose-logging, matching prose calls on a logger/_logger name, enforcing against a baseline recorded at the true remaining count: 374 matches across 282 anchors.

Widening the existing rule was not available. An enforcing baseline may only shrink, and widening would have grown it by every wrapper module at once. A new ratchet, by contrast, may start wherever reality is and shrink from there — which is the whole point of recording it at 374 rather than at zero.

docs/structured-logging.md now states how to read the two together: neither number alone answers "is the tree converted".

Verification

devtools gate patterns    -> exit 0, legacy-prose-logging: enforcing (374 matches, 0 prunable)
devtools verify --quick   -> exit 0, all 15 gates

Proven to block, not assumed: appending a logger.warning to daemon/health.py produced exit 1 naming that file and that anchor; removing it returned exit 0.

Also: six stale entries pruned

Left behind by the logging wave. Two of them needed their counts decremented rather than their lines deleted — dropping a whole path:sha:N anchor when only some of its matches are gone turns the remainder into a new violation, which is the opposite of a prune. Both directions are now clean: 0 new, 0 stale.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

`legacy-stdlib-logger` matches `logging.getLogger(...)` — the *acquisition* of a
stdlib logger. That is no longer the dominant legacy form. Roughly 100 modules
acquire their logger through `polylogue.logging.get_logger`, whose returned
`_StdlibBoundLogger` has a no-op `bind()` and discards every structured keyword
it is given. Converting the two largest daemon modules (59 and 31 prose sites)
eliminated zero baseline entries for exactly that reason.

So a green `legacy-stdlib-logger` meant "no module acquires a stdlib logger
directly", not "no module logs prose" — and it was being read as the latter.

Add `legacy-prose-logging`, matching prose calls on a `logger`/`_logger` name,
enforcing against a baseline recorded at the true remaining count: 374 matches
across 282 anchors. Widening the existing rule was not available, since an
enforcing baseline may only shrink and widening would have grown it by every
wrapper module at once. A new ratchet may start wherever reality is.

Verified to block: appending a `logger.warning` to `daemon/health.py` produced
exit 1 naming that file, and removing it returned exit 0.

Also prune six stale entries left by the logging wave. Two needed their counts
decremented rather than their lines deleted — dropping a whole `:N` anchor when
only some of its matches are gone turns the remainder into a new violation,
which is the opposite of a prune.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
@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, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 5cb31313-98a1-4e4d-8655-e771b78a4f8e

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb2707 and 4aca79f.

📒 Files selected for processing (6)
  • devtools/patterns/baselines/legacy-prose-logging.txt
  • devtools/patterns/baselines/legacy-stdlib-logger.txt
  • devtools/patterns/baselines/sqlite-error-default.txt
  • devtools/patterns/legacy-prose-logging.yml
  • devtools/patterns/registry.yaml
  • docs/structured-logging.md

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 14, 2026 12:24
@Sinity
Sinity merged commit c7601b5 into master Sep 14, 2026
3 checks passed
@Sinity
Sinity deleted the chore/prose-logging-ratchet branch September 14, 2026 12:26
Sinity added a commit that referenced this pull request Sep 14, 2026
## Summary

Delete the raw-authority frontier **apply/recover/validate** chain,
which has
been unreachable from production since PR #5002. 12 files, +16/−2,443.

The inspect/census side is untouched and remains production-reachable.

## Problem

`polylogue-6kur` ("Eliminate repair as a product concept") requires that
no
public generic repair, cleanup, doctor-apply, or break-glass route
remains.
The generic repair framework (`storage/repair.py`) is gone, but a
generic
*actuator* route survived as dead code:

PR #5002 ("Retire the all-valid raw materialization scanner from
production")
deleted the legacy `_run_raw_materialization_pass` wholesale, and with
it the
only call site of `_converge_raw_authority_frontier`:

```
-            frontier_repaired = _converge_raw_authority_frontier(config, limit=min(limit, 8))
```

Nothing in the #5027 derivation-kernel rewrite re-wired it. At this head
the
caller list is empty at every level:

- `_converge_raw_authority_frontier` — referenced only by its own
definition
  and one test that called it directly.
- `_emit_raw_materialization_pass` — same; the
`raw_materialization_pass`
  event it shaped has no other emitter anywhere in the tree.
- `maintenance.raw_authority.apply_frontier` /
`recover_interrupted_frontier`
  / `_validate_frontier_apply_report` — reachable only from the above.
- `raw_reconciler.apply_raw_authority_frontier` and friends — reachable
only
  from those.

So the last thing in the tree that could *execute* a historical repair
strategy was already incapable of being invoked. It was a generic repair
actuator kept alive only by its own tests.

## Solution

Delete the dead closure, computed with a reachability analysis seeded
from
every symbol referenced outside the two storage modules:

- `daemon/cli.py`: `_converge_raw_authority_frontier`,
`_emit_raw_materialization_pass`
- `maintenance/raw_authority.py`: `apply_frontier`,
`_validate_frontier_apply_report`, `recover_interrupted_frontier`
- `storage/raw_reconciler.py`: `apply_raw_authority_frontier`,
`recover_interrupted_raw_authority_frontier`,
`validate_raw_authority_frontier_apply_report`,
`_validate_raw_authority_frontier_apply_counts`,
`RawAuthorityFrontierApplyReport`, `_apply_strategy`,
`_preview_plan_ids`, `_terminalized_preview_items`, `_state_counts`
- `storage/raw_convergence.py`: the `_apply_*` / `_stage_*` /
`_finalize_*` / `_restore_*` strategy actuators for browser-capture
origin, duplicate raw identity, and quarantined accepted raw

**Deliberately retained**, because it is still the only route to
something
real and still production-reachable: the whole inspect/census side —
`inspect_raw_authority_frontier`, `_classify_frontier`, the three
`inspect_*` strategies, the `maintenance
raw-authority-frontier|census|detail|blockers`
commands, `mutate-resolve-raw-authority-blocker`, the readiness payload
fields, and the MCP census resources. Operators can still see the
frontier
and its blockers; they just cannot invoke an actuator that no production
route could reach anyway.

Tests covering the removed route were deleted, not weakened — no test
was
skipped, xfailed, loosened, or stubbed. Where a test mixed inspect and
apply
assertions, only the apply half was removed and the test kept its real
inspect checks (four such tests, three renamed to match what they now
prove).
Atlas citations into `daemon/cli.py` were re-verified and their line
ranges
corrected against the new content.

## 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_quarantine_repair_budget.py tests/unit/product/test_raw_authority.py
  => 102 passed, 1 warning in 114.96s   (devtools test: PASSED exit=0 diagnosis=pytest_passed)

devtools test tests/unit/daemon/test_daemon_cli.py
  => 104 passed, 1 warning in 43.92s    (devtools test: PASSED exit=0 diagnosis=pytest_passed)

devtools verify --quick
  => all 15 gates ok, exit 0            (incl. oracle-integrity, consumer-reachability, layering, schema-manifest)
```

Anti-vacuity: a scripted reachability closure over both storage modules
reports zero unreachable module-level definitions after the deletion,
and a
tree-wide grep for every deleted symbol across `polylogue`, `tests`,
`devtools` and `docs` returns nothing.

## Residuals (honest)

- **This moves the derived schema identity.**
`storage/raw_convergence.py` is
`IN` the closure per `devtools schema closure`. It must land **before**
the
  fresh rebuild starts, never during one.
- **`devtools gate atlas` still reports the daemon/00-core sections as
stale.** This is structural, not ignorable-by-choice: the stamp is a
commit
  SHA, so a PR that edits an anchored file can never stamp itself, and a
squash merge changes the SHA again. Master is already red on this gate
for
the same reason (`docs/structured-logging.md` after #5074). The
*anchors*
in this PR were re-verified by hand and their line ranges corrected;
only
  the `verified:` stamp is unchanged. `atlas` is not a `--quick` gate.
- This does **not** close `polylogue-6kur`. It advances AC 1/2. The
durable
  raw-authority census/plan/blocker tables, the operator-facing census
commands, and the three historical inspect strategies all survive; their
  disposition belongs to `polylogue-2x6xu` and depends on the operator's
  archive-wipe decision.
- Remaining `repair` vocabulary in the tree (FTS membership convergence,
  stale-observation reconciliation) names live derivations, not a repair
  product; renaming belongs to `polylogue-z07nu`.
- Pre-existing and untouched: `docs/design/raw-decision-authority.md`
cites
  `raw_convergence.py:4608-6194`, anchors that died when the engine was
  removed in #5005/#5027.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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