Skip to content

refactor(devtools): relocate diagnostics production code into polylogue (tranche 3) - #4010

Merged
Sinity merged 3 commits into
masterfrom
feature/devtools/tranche3-relocations
Aug 19, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/devtools/tranche3-relocations

Conversation

@Sinity

@Sinity Sinity commented Aug 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Relocates two production modules that lived under devtools/ despite being
runtime dependencies of native polylogue ops diagnostics CLI commands, and
prunes the two now-stale docs/plans/layering.yaml baseline entries that
allowlisted the resulting polylogue -> devtools import direction.

Problem

.agent/campaigns/2026-08-overhaul/ws-c-devtools-pruning.md's Tranche 3 row
names daemon_workload_probe (3,165 LOC) and archive_space_report (187
LOC) as production code living in the wrong package: both are the sole
implementation behind polylogue ops diagnostics workload and
polylogue ops diagnostics space
(polylogue/cli/commands/diagnostics.py), imported lazily inside the Click
command bodies, yet physically sat in devtools/ — the repo's control-plane
package, not a runtime dependency of the product. docs/plans/layering.yaml
already carries a target: polylogue, disallow: from: [devtools] rule
(added ahead of this PR) whose own description names
devtools/daemon_workload_probe.py by path as the motivating example and
records "the three existing importers" as an audited allowlist — this PR is
that allowlist's overdue shrink.

Neither module imports anything from devtools itself, so the move is a
pure relocation with no dependency untangling required.

Solution

  • git mv devtools/archive_space_report.py polylogue/operations/archive_space_report.py
  • git mv devtools/daemon_workload_probe.py polylogue/operations/daemon_workload_probe.py

polylogue/operations/ already holds "high-level archive operations and
their typed contracts" as a flat file layout — matches the CLI group these
modules back (ops diagnostics), so no new subpackage was needed.

  • Moved both test files to tests/unit/operations/ to match.
  • Updated every import site: polylogue/cli/commands/diagnostics.py (the
    CLI command bodies), devtools/degraded_archive_proof.py (a
    devtools-internal consumer of daemon_workload_probe.probe, untouched
    otherwise — it's a tranche-2 row, out of scope here),
    tests/integration/test_daemon_convergence_evidence.py,
    tests/benchmarks/test_archive_maintenance.py, and one
    docs/internals.md path reference. Fixed one now-stale "...same devtools build" string inside daemon_workload_probe.py's report-version-mismatch
    error message to say polylogue instead.
  • No CommandSpec entries existed for either module in
    devtools/command_catalog.py — they were never devtools commands.
  • Pruned the two now-unreproducible entries
    (polylogue/cli/commands/diagnostics.py -> devtools.archive_space_report
    / devtools.daemon_workload_probe) from
    docs/plans/layering-surface-baseline.json, and updated the rule's
    description in docs/plans/layering.yaml to reflect two remaining
    importers instead of three. devtools verify layering: 0 violations,
    stale-baseline count drops from 5 to 3 (the 3 remaining stale entries — one
    in polylogue/cli/commands/excise.py and two others — predate this change
    and are out of scope).

Explicitly not touched (per the campaign's own text)

  • polylogue/cli/click_app.py's devtools.checkout_guard import — a
    deliberate safety check, not incidental placement; stays on the allowlist.
  • polylogue/scenarios/execution.py's devtools.command_catalog import —
    the ledger's tranche-2/60gzo row already names
    polylogue/scenarios/{execution,runtime}.py importing devtools as a known
    pre-existing violation for that pass; still baselined, untouched here.
    (polylogue/scenarios/runtime.py only references the string "devtools"
    as a subprocess argv marker, not an import — it was never actually on the
    baseline.)
  • No Beads issue is cited against the Tranche 3 row in the ledger, so this
    PR uses the self_contained scope carrier.

Verification

  • devtools test tests/unit/operations/test_archive_space_report.py tests/unit/operations/test_daemon_workload_probe.py tests/unit/devtools/test_degraded_archive_proof.py tests/unit/cli/test_diagnostics.py tests/benchmarks/test_archive_maintenance.py -k "not benchmark" — 54 passed, 3 deselected.
  • python -m devtools.verify_layering — No layering violations found,
    stale-baseline count 5 -> 3.
  • devtools verify --quick — "status": "success", "exit_code": 0.
  • devtools verify (full) — "status": "success", "exit_code": 0,
    "terminal_green": true, "complete_corpus_covered": true,
    "non_green_count": 0, "release_baseline_allowed": true. (First run
    reported the two moved modules absent from the testmon dependency graph,
    complete_corpus_covered: false — expected bootstrap behavior for a git mv'd executable path per devtools why; the second run fingerprinted them
    and came back fully green.)
  • End-to-end smoke against a disposable fixture archive (never the live
    root), seeded via polylogue demo seed --root <tmp> --force --with-overlays --format json:
    • POLYLOGUE_ARCHIVE_ROOT=<tmp> polylogue ops diagnostics workload --json
      -> exit 0, well-formed archive_tiers/derived_readiness payload.
    • POLYLOGUE_ARCHIVE_ROOT=<tmp> polylogue ops diagnostics space --json --objects -> exit 0, well-formed dbstat-backed space report
      ("ok": true, 185 objects scanned).

Anti-vacuity: pure relocation plus a baseline prune; behavior is unchanged
and covered by the existing (moved, otherwise untouched) test suites plus
the fixture-archive smoke above proving the CLI wiring survives end to end.

Bead disposition matrix

No Beads issue is assigned to or cited by the ledger's Tranche 3 row.
mutated_beads is empty; this PR uses the self_contained scope carrier.

Verification commands run

devtools test tests/unit/operations/test_archive_space_report.py tests/unit/operations/test_daemon_workload_probe.py tests/unit/devtools/test_degraded_archive_proof.py tests/unit/cli/test_diagnostics.py tests/benchmarks/test_archive_maintenance.py -k "not benchmark"
python -m devtools.verify_layering
devtools verify --quick
devtools verify

Sinity added 2 commits August 19, 2026 02:31
…port into polylogue

Both modules are production code that happened to live under devtools/:
polylogue/cli/commands/diagnostics.py's `polylogue ops diagnostics
workload`/`space` commands import them directly, and neither module
itself imports anything from devtools. Moves them to
polylogue/operations/ (matching that package's existing flat-file
layout and its role as high-level archive operations), moves their
test files to tests/unit/operations/ to match, and updates every
import site: the CLI command module, devtools/degraded_archive_proof.py
(a devtools-internal consumer, untouched otherwise), the integration
test, the benchmark test, and one docs/internals.md path reference.
Also fixes one now-stale 'devtools build' error string inside
daemon_workload_probe.py's version-mismatch message.

No CommandSpec entries existed for either module in
devtools/command_catalog.py -- they were never devtools commands, only
implementation the native polylogue CLI happened to import lazily from
the wrong package.

Ref .agent/campaigns/2026-08-overhaul/ws-c-devtools-pruning.md (Tranche 3)
…-3 moves

The docs/plans/layering.yaml rule forbidding polylogue/ from importing
devtools was already in place and already named
devtools/daemon_workload_probe.py by path in its own description --
this just removes the two baseline entries for
polylogue/cli/commands/diagnostics.py's devtools.archive_space_report
and devtools.daemon_workload_probe imports, which no longer exist now
that both modules live in polylogue/operations/. `devtools verify
layering` confirms: 0 violations, stale-baseline count drops from 5 to
3 (the 3 remaining stale entries predate this change and are out of
scope here).

The two importers still on the allowlist -- polylogue/cli/click_app.py
(devtools.checkout_guard, a deliberate safety check) and
polylogue/scenarios/execution.py (devtools.command_catalog, the known
pre-existing violation the ledger's tranche-2/60gzo row already tracks
for its own pass) -- are untouched.

Ref .agent/campaigns/2026-08-overhaul/ws-c-devtools-pruning.md (Tranche 3)
@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 Aug 19, 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2447fc65-327f-4bd2-9ee4-06dd3f3bd7d0


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 merged commit fd67a5d into master Aug 19, 2026
3 checks passed
@Sinity
Sinity deleted the feature/devtools/tranche3-relocations branch August 19, 2026 01:14
Sinity added a commit that referenced this pull request Sep 28, 2026
## Summary

Realigns the master tests whose failures are stale tests rather than
code defects: 16 test ids, 12 from the coordinator's list plus the
pinned read-only store test. Each one asserted a contract that a later
PR changed on purpose. The fixes below are grouped by the PR that broke
them.

## Problem and fix, by breaking PR

| Breaking PR | Tests | Why they fail | Fix |
| --- | --- | --- | --- |
| #5564 (0723a95) |
`test_pinned_read_only_store_blocks_all_archive_tier_mutations`,
`test_convergence_one_shot_readers_cannot_mutate` | The read profile's
authorizer rejects writes at prepare time with `DatabaseError: not
authorized`, before SQLite's own `OperationalError: readonly` is
reached. | Expect `sqlite3.DatabaseError` matching `not
authorized\|readonly`. The existing checks that nothing changed stay. |
| #5550 (da5346d) | Seven `test_store_ops` tag tests | Facade writes
now belong to the daemon: `add_tag` and `remove_tag` raise
`FacadeDaemonRequiredError` when no daemon is running. | The three
parametrized tests run the resident writer on the archive's own socket,
through a new `tests/infra/daemon_operations.daemon_serving_archive`;
the MCP helper now reuses it. The Hypothesis tag law calls
`ArchiveStore.add_user_tags`, the primitive the daemon's actuator
applies. It clears `open_connection`'s per-path cache between examples,
because otherwise each new example archive keeps about 11 descriptors
and trips the fd-leak guard. |
| #5700 (f2562c3) |
`test_daemon_required_envelope_preserves_resolved_archive_root` | #5700
made a daemon-absent machine refusal exit with `FAILED_READ_EXIT_CODE`
(1). The test, added in #5722, asserted 2. | Assert
`FAILED_READ_EXIT_CODE`. |
| #5727 (ee567d0) |
`test_recent_attempts_report_the_file_count_not_the_session_count` |
Read-only opens now check derived schema identity, so a hand-built
`ops.db` is refused and the probe returns no attempts. | Seed a real ops
tier with `initialize_archive_database` and a valid status. |
| #5727 | `test_compare_reports_archive_derived_readiness_deltas` |
`compare` is now not ok when either side's convergence-debt ledger is
unavailable, and a missing `ops.db` counts as unavailable. | Initialize
`ops.db`. |
| #5727 |
`test_unavailable_debt_is_rendered_unknown_and_cli_fails_closed` | The
test was added in #5727 and never passed: `"0 failed" not in output`
also matched the attempt-count line (`0 running, 0 failed`), which has
existed since #4010. | Check only the convergence-debt line. |
| #5551 (aa19052) |
`test_daemon_workload_probe_does_not_claim_derived_ready_on_schema_mismatch`
| Under the fresh format every tier starts at `user_version = 1`, so
writing 1 no longer produces a mismatch. | Set `user_version = 2`. |

Not in this PR:
- `test_raw_existence_journal_is_declared_as_content_free_bookkeeping`
was a real duplicate declaration and is fixed in #5767.
- polylogue-njwky (sqlite-vec on async attaches) was confirmed real and
is fixed in #5765.

## Verification

- `devtools test tests/unit/security/test_excision_carrier_reach.py
tests/unit/security/test_excision.py
tests/unit/storage/test_archive_tiers_archive.py
tests/unit/daemon/test_maintenance_read_profiles.py
tests/unit/cli/test_machine_main.py
tests/unit/sources/test_refused_state_is_reported.py
tests/unit/operations/test_daemon_workload_probe.py
tests/unit/storage/test_store_ops.py
tests/unit/mcp/test_mcp_writer_boundary.py`: `PASSED exit=0` (run with
#5767's change applied)

🤖 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]>
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