Skip to content

docs: fix doc-vs-code drift across the Reference-docs table - #2610

Merged
Sinity merged 4 commits into
masterfrom
chore/beads/claim-9e5.13
Jul 9, 2026
Merged

Sinity merged 4 commits into
masterfrom
chore/beads/claim-9e5.13

Conversation

@Sinity

@Sinity Sinity commented Jul 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Sweeps every doc in CLAUDE.md's Reference-docs table for checkable factual claims that drifted from current source, fixes each one, and adds a rerunnable devtools lint (devtools lab policy docs-drift) so the sweep is a repeatable gate rather than a one-off.

Problem

Free-text docs have nothing forcing them to track a renamed table, a moved file, a bumped schema version, or a renamed CLI command. Found via mechanical + manual sweep across docs/architecture.md, docs/internals.md, docs/architecture-spine.md, docs/cost-model.md, docs/mcp-reference.md, docs/devtools.md.

Solution

  • artifact_observations → raw_artifacts (pre-split-file-cutover table name still asserted as current, 3 sites) — spot-verified against the live DDL (storage/sqlite/archive_tiers/source.py:84).
  • Dead file pipeline/prepare_enrichment.py corrected to the real idempotency skip-decision site (pipeline/services/ingest_batch/_core.py:398-400), plus several other moved/missing-prefix file paths.
  • internals.md's Index schema version history extended v24→v28 (content_hash anchors, actions-view rank rewrite, primary_model fields, delegations view).
  • boundary_table_counts prose fixes (typo, renamed table, phantom entry, stale flag name).
  • Blob GC description corrected from "link counting" to the real snapshot-reference + pending-lease mechanism.
  • CLI command drift: polylogue cost outlook → analyze --cost-outlook, polylogue diagnostics usage → analyze usage, polylogue insights audit → ops insights audit.
  • docs/mcp-reference.md rewritten — was listing 3 of ~100 tools, with two fictional resource URIs and a nonexistent polylogue mcp subcommand.

Explicitly left untouched: the FTS5 content='messages' claim (owned by polylogue-3tl.14, do not duplicate).

Follow-up filed: polylogue-iyew for a real code bug found along the way — devtools/daemon_workload_probe.py's _BOUNDARY_TABLES tuple still has the stale artifact_observations name, silently reporting -1 for that slot since the split-file cutover. Left unfixed since it's code, not docs, and out of this bead's scope.

Verification

Independently re-verified (not just the authoring agent's own report):

  • python3 -m devtools lab policy docs-drift → zero unhandled drift
  • python3 -m mypy --strict devtools/verify_docs_drift.py devtools/command_catalog.py devtools/verify.py → clean
  • python3 -m devtools test tests/unit/devtools/test_verify_docs_drift.py → 12 passed
  • python3 -m devtools render all --check → clean (no "out of sync" surfaces)

Ref polylogue-9e5.13, polylogue-iyew.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a new docs-drift verification check to catch outdated references in documentation.
  • Bug Fixes

    • Corrected multiple documentation references so architecture, MCP, cost, and internals docs better match the current product behavior and command names.
    • Updated blob-store wording and related GC guidance for clearer, more accurate lifecycle behavior.
  • Tests

    • Added coverage for the new docs-drift verification flow and its command-line output.

Sinity and others added 3 commits July 9, 2026 06:51
Ref polylogue-57bg, polylogue-9e5.13.

Co-Authored-By: Claude <[email protected]>
## Summary
Sweep every doc in CLAUDE.md's Reference-docs table for checkable
factual claims (file paths, schema versions, table names, CLI command
names) that have drifted from current source, fix each one, and add a
rerunnable devtools lint so the sweep is a repeatable gate rather than
a one-off.

## Problem
Free-text docs have nothing forcing them to track a renamed table, a
moved file, a bumped schema version, or a renamed CLI command. Found
via mechanical + manual sweep:
- `artifact_observations` (pre-split-file-cutover table name) still
  asserted as the current blob-linking table in architecture.md and
  internals.md; the real table has been `raw_artifacts` since #1787.
- Several file paths pointing at files that moved or were split into
  packages: `pipeline/prepare_enrichment.py` (gone; real idempotency
  skip-decision lives in `pipeline/services/ingest_batch/_core.py`),
  `pipeline/services/ingest_batch.py` (now a package, `_core.py` is the
  largest file), `archive_tiers/bootstrap.py` (missing `storage/sqlite/`
  prefix), and the provider-parser table in architecture.md (missing
  `sources/` prefix; Claude web/Code split into `claude/ai_parser.py`
  and `claude/code_parser.py`).
- internals.md's Index schema version history stopped at v24; the
  current constant is v28 (delegations view, primary_model_name/family,
  actions-view transcript-rank rewrite, blocks.content_hash) with no
  entries for v25-v28.
- The `boundary_table_counts` table list in internals.md had a typo
  (`session_profile` vs `session_profiles`), a wrong name
  (`live_convergence_debt` vs `convergence_debt`), a table not actually
  in the probe's tuple (`actions`), and a stale CLI flag
  (`--exact-table-counts` vs the real `--exact-derived-counts`).
- Both internals.md and architecture-spine.md described blob GC as
  "link counting" when the real (and separately, accurately documented
  elsewhere in internals.md) mechanism is a snapshot reference check
  plus a pending-lease check.
- cost-model.md referenced two CLI commands that don't exist:
  `polylogue cost outlook` (real: `polylogue analyze --cost-outlook`)
  and `polylogue diagnostics usage` (real: `polylogue analyze usage`).
- devtools/command_catalog.py's `insight-honesty` use_when text (source
  of the generated devtools.md table) said `polylogue insights audit`;
  real command is `polylogue ops insights audit`.
- mcp-reference.md was severely stale: 3 of ~100 registered tools
  listed, both documented resource URIs don't exist (real ones are
  `polylogue://stats`, `polylogue://session/{conv_id}`, etc.), and the
  configuration block invoked a nonexistent `polylogue mcp` subcommand
  instead of the real standalone `polylogue-mcp --role read` entrypoint.

Not touched: internals.md's FTS5 `content='messages'` claim vs the
actual contentless build — that fix is owned by polylogue-3tl.14.

## Solution
- `devtools/verify_docs_drift.py` (new, registered as
  `devtools lab policy docs-drift`, wired into `devtools verify --lab`):
  mechanically checks (1) every backtick-quoted, extension-bearing path
  referenced in a Reference-docs entry exists on disk (tried as-is, then
  under `polylogue/`/`tests/`, with a historical-reference exemption for
  paths explicitly described as retired/superseded), (2) every
  "<Tier> schema version N" claim does not exceed the tier's current
  `*_SCHEMA_VERSION` constant, and (3) a short explicit watchlist of
  renamed/removed table names (starting with `artifact_observations` ->
  `raw_artifacts`) isn't asserted as current.
- Fixed every drift found above directly in the docs (and in
  command_catalog.py's use_when text, since docs/devtools.md is
  generated from it).
- Filed polylogue-iyew (discovered-from 9e5.13) for a real code bug
  found incidentally: `daemon_workload_probe.py`'s `_BOUNDARY_TABLES`
  still lists `artifact_observations` too, so that probe slot has
  silently reported -1/missing since the split-file cutover. Left
  unfixed here — it's a probe-code bug, not a doc, and outside this
  bead's docs-only scope.

## Verification
- `python3 -m devtools lab policy docs-drift`: "zero unhandled drift
  across the reference-docs sweep."
- `python3 -m devtools test tests/unit/devtools`: 816 passed (includes
  the 12 new tests in test_verify_docs_drift.py).
- `python3 -m mypy devtools/verify_docs_drift.py devtools/command_catalog.py devtools/verify.py --strict`: clean.
- `python3 -m devtools render all --check`: clean (no "out of sync"
  surfaces; regenerated docs/devtools.md picks up the corrected
  insight-honesty use_when text and the new docs-drift catalog entry).
- `python3 -m devtools verify --quick`: all 14 steps exit 0.
- `python3 -m ruff format --check` / `ruff check`: clean on all touched
  Python files.

Ref polylogue-9e5.13.

Co-Authored-By: Claude <[email protected]>
Ref polylogue-9e5.13, polylogue-iyew.

Co-Authored-By: Claude <[email protected]>
@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 Jul 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new devtools docs-drift verifier (devtools/verify_docs_drift.py) that checks Reference-docs markdown files for stale file paths, schema-version overclaims, and renamed-table mentions, wires it into the command catalog and verify pipeline, adds unit tests, corrects drifted content across multiple documentation files, and updates beads issue/interaction logs.

Changes

Docs-drift verification and corrections

Layer / File(s) Summary
Docs-drift checker implementation
devtools/verify_docs_drift.py
New script defines REFERENCE_DOCS, watchlist/regex constants, MissingPath/SchemaVersionOverclaim/WatchlistHit/DriftReport dataclasses, _resolve_path, _check_paths, _check_schema_versions, _check_watchlist, collect_drift(), _format_report(), and CLI main() with --json and exit-code behavior.
Command catalog and verify pipeline wiring
devtools/command_catalog.py, devtools/verify.py
Adds a "lab policy docs-drift" CommandSpec and registers it in VERIFICATION_LAB_COMMAND_NAMES, tweaks insight-honesty wording, and appends the new step to build_verify_steps() under --lab.
Docs-drift checker unit tests
tests/unit/devtools/test_verify_docs_drift.py
Adds tests for _check_paths, _check_schema_versions, _check_watchlist, collect_drift() integration sweep, and CLI main() for JSON output and empty doc lists.
Reference-docs content corrections
docs/architecture-spine.md, docs/architecture.md, docs/cost-model.md, docs/devtools.md, docs/internals.md, docs/mcp-reference.md
Corrects parser module paths, blob-store link_group_key/GC wording, schema version history (v25–28), bootstrap path, CLI command names, and MCP tools/resources/configuration documentation; adds docs-drift command entries.
Beads issue/interaction bookkeeping
.beads/issues.jsonl, .beads/interactions.jsonl
Closes polylogue-9e5.13 with completion notes and appends new issues polylogue-iyew, polylogue-4ts.8, polylogue-57bg, polylogue-lqxx.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Verify as devtools verify --lab
  participant Catalog as command_catalog
  participant Checker as verify_docs_drift.main()
  participant Docs as Reference docs / source

  Verify->>Catalog: resolve "lab policy docs-drift" step
  Catalog->>Checker: invoke entrypoint
  Checker->>Docs: read REFERENCE_DOCS markdown, check paths/schema versions/watchlist
  Docs-->>Checker: drift findings
  Checker-->>Verify: DriftReport, exit code
Loading

Possibly related issues

Possibly related PRs

  • Sinity/polylogue#577: Both modify build_verify_steps() in devtools/verify.py to adjust the lab verification step sequence.
  • Sinity/polylogue#1015: Both update blob-store GC documentation to describe the snapshot-reference-check plus pending-lease safety model.
  • Sinity/polylogue#2137: Both modify the verification-lab command inventory and step sequencing in devtools/command_catalog.py and devtools/verify.py.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing documentation drift across the Reference-docs table.
Description check ✅ Passed The description is mostly complete, with clear Summary, Problem, Solution, and Verification sections plus a follow-up note.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/beads/claim-9e5.13
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch chore/beads/claim-9e5.13

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/mcp-reference.md`:
- Around line 3-31: Remove the hardcoded “~100 tools” estimate from the MCP
tools overview in docs/mcp-reference.md and rely on the test-enforced contract
instead. Update the introductory paragraph near the tool category list to avoid
a drifting numeric claim, while keeping the reference to
tests/infra/mcp.py:EXPECTED_TOOL_NAMES as the source of truth for the registered
tool set.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f0bf0842-8d52-4163-b540-a6f701a7c08e

📥 Commits

Reviewing files that changed from the base of the PR and between c327df7 and 187dda5.

📒 Files selected for processing (12)
  • .beads/interactions.jsonl
  • .beads/issues.jsonl
  • devtools/command_catalog.py
  • devtools/verify.py
  • devtools/verify_docs_drift.py
  • docs/architecture-spine.md
  • docs/architecture.md
  • docs/cost-model.md
  • docs/devtools.md
  • docs/internals.md
  • docs/mcp-reference.md
  • tests/unit/devtools/test_verify_docs_drift.py

Comment thread docs/mcp-reference.md
Comment on lines 3 to +31
Polylogue exposes an MCP (Model Context Protocol) server that coding agents can use to query
AI chat archives during sessions.
AI chat archives during sessions. This is the primary continuity surface — richer than the
CLI or Python API for agent-facing recall, corrections, and context assembly.

## Tools

- `list_sessions` — List recent sessions, filterable by path and sort order.
- `get_session` — Retrieve a full session by ID with optional prose-only projection.
- `search` — Full-text search across sessions with filter chains.
~100 tools registered across `polylogue/mcp/server_*.py`, gated by capability role (see
Configuration below). A representative sample by category:

- **Search / list / get**: `search`, `list_sessions`, `get_session`, `get_messages`,
`get_session_tree`, `get_session_summary`, `get_logical_session`, `facets`.
- **Insights**: `get_stats_by`, `session_costs`, `cost_rollups`, `usage_timeline`,
`tool_usage`, `workflow_shape_distribution`, `session_latency_profile`.
- **Continuity / recall**: `compile_context`, `build_context_image`,
`compose_context_preamble`, `get_resume_brief`, `find_resume_candidates`,
`find_abandoned_sessions`, `find_stuck_sessions`.
- **Correlation / topology**: `correlate_session`, `correlate_sessions`,
`get_session_topology`, `neighbor_candidates`, `find_similar_sessions`,
`compare_sessions`.
- **Postmortem / pathology**: `get_postmortem_bundle`, `get_pathologies`,
`insight_rigor_audit`.
- **Corrections / assertions** (write role): `add_tag`, `bulk_tag_sessions`,
`blackboard_post`.
- **Maintenance** (admin role): `maintenance_preview`, `maintenance_execute`,
`rebuild_index`, `update_index`, `rebuild_session_insights`.

The exhaustive, currently-registered tool name set is a test-enforced contract, not hand
duplicated here: `tests/infra/mcp.py:EXPECTED_TOOL_NAMES`. Adding a tool requires updating
that set plus its tool contract (see `CLAUDE.md` § MCP gotchas).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Drop the hardcoded tool count.

The ~100 tools claim will drift independently of tests/infra/mcp.py:EXPECTED_TOOL_NAMES, which is the actual contract this section points readers to. Consider removing the numeric estimate or deriving it from that contract instead.

Suggested rewrite
-~100 tools registered across `polylogue/mcp/server_*.py`, gated by capability role (see Configuration below). A representative sample by category:
+Tools registered across `polylogue/mcp/server_*.py`, gated by capability role (see Configuration below). A representative sample by category:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Polylogue exposes an MCP (Model Context Protocol) server that coding agents can use to query
AI chat archives during sessions.
AI chat archives during sessions. This is the primary continuity surface — richer than the
CLI or Python API for agent-facing recall, corrections, and context assembly.
## Tools
- `list_sessions` — List recent sessions, filterable by path and sort order.
- `get_session` — Retrieve a full session by ID with optional prose-only projection.
- `search` — Full-text search across sessions with filter chains.
~100 tools registered across `polylogue/mcp/server_*.py`, gated by capability role (see
Configuration below). A representative sample by category:
- **Search / list / get**: `search`, `list_sessions`, `get_session`, `get_messages`,
`get_session_tree`, `get_session_summary`, `get_logical_session`, `facets`.
- **Insights**: `get_stats_by`, `session_costs`, `cost_rollups`, `usage_timeline`,
`tool_usage`, `workflow_shape_distribution`, `session_latency_profile`.
- **Continuity / recall**: `compile_context`, `build_context_image`,
`compose_context_preamble`, `get_resume_brief`, `find_resume_candidates`,
`find_abandoned_sessions`, `find_stuck_sessions`.
- **Correlation / topology**: `correlate_session`, `correlate_sessions`,
`get_session_topology`, `neighbor_candidates`, `find_similar_sessions`,
`compare_sessions`.
- **Postmortem / pathology**: `get_postmortem_bundle`, `get_pathologies`,
`insight_rigor_audit`.
- **Corrections / assertions** (write role): `add_tag`, `bulk_tag_sessions`,
`blackboard_post`.
- **Maintenance** (admin role): `maintenance_preview`, `maintenance_execute`,
`rebuild_index`, `update_index`, `rebuild_session_insights`.
The exhaustive, currently-registered tool name set is a test-enforced contract, not hand
duplicated here: `tests/infra/mcp.py:EXPECTED_TOOL_NAMES`. Adding a tool requires updating
that set plus its tool contract (see `CLAUDE.md` § MCP gotchas).
Polylogue exposes an MCP (Model Context Protocol) server that coding agents can use to query
AI chat archives during sessions. This is the primary continuity surface — richer than the
CLI or Python API for agent-facing recall, corrections, and context assembly.
## Tools
Tools registered across `polylogue/mcp/server_*.py`, gated by capability role (see
Configuration below). A representative sample by category:
- **Search / list / get**: `search`, `list_sessions`, `get_session`, `get_messages`,
`get_session_tree`, `get_session_summary`, `get_logical_session`, `facets`.
- **Insights**: `get_stats_by`, `session_costs`, `cost_rollups`, `usage_timeline`,
`tool_usage`, `workflow_shape_distribution`, `session_latency_profile`.
- **Continuity / recall**: `compile_context`, `build_context_image`,
`compose_context_preamble`, `get_resume_brief`, `find_resume_candidates`,
`find_abandoned_sessions`, `find_stuck_sessions`.
- **Correlation / topology**: `correlate_session`, `correlate_sessions`,
`get_session_topology`, `neighbor_candidates`, `find_similar_sessions`,
`compare_sessions`.
- **Postmortem / pathology**: `get_postmortem_bundle`, `get_pathologies`,
`insight_rigor_audit`.
- **Corrections / assertions** (write role): `add_tag`, `bulk_tag_sessions`,
`blackboard_post`.
- **Maintenance** (admin role): `maintenance_preview`, `maintenance_execute`,
`rebuild_index`, `update_index`, `rebuild_session_insights`.
The exhaustive, currently-registered tool name set is a test-enforced contract, not hand
duplicated here: `tests/infra/mcp.py:EXPECTED_TOOL_NAMES`. Adding a tool requires updating
that set plus its tool contract (see `CLAUDE.md` § MCP gotchas).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/mcp-reference.md` around lines 3 - 31, Remove the hardcoded “~100 tools”
estimate from the MCP tools overview in docs/mcp-reference.md and rely on the
test-enforced contract instead. Update the introductory paragraph near the tool
category list to avoid a drifting numeric claim, while keeping the reference to
tests/infra/mcp.py:EXPECTED_TOOL_NAMES as the source of truth for the registered
tool set.

…e5.13

# Conflicts:
#	.beads/interactions.jsonl
#	.beads/issues.jsonl
github-actions Bot pushed a commit that referenced this pull request Jul 9, 2026
@Sinity
Sinity merged commit feacd83 into master Jul 9, 2026
13 checks passed
@Sinity
Sinity deleted the chore/beads/claim-9e5.13 branch July 9, 2026 05:39
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