Repository navigation
Description
Problem or Motivation
Some drift has no PR cause, or a PR rule for it would give false positives. The census baseline has:
- closed items named as open with no PR cause (Metrics and logs are kept for two hours #550 at
k8s/README.mdlines 346 and 499); - identifiers (
docs/TESTING.mdFakeValkeyClient,valkey.mdis_safe_endpoint(), and 2 living low); - 11 bare file names;
- copied
CONST_/DEFAULT_values (docs/KNOWN_ISSUES.mdline 26); - 48 findings in ADRs in force;
- knowledge base review age;
- dead external URLs;
- duplicated rules.
No command finds them today. The census script of the study is not in the repository.
Proposed Solution & Architectural Design
Add devops docs drift [--rule <name>] [--offline] [--format json] [--dry-run]. It runs every rule of the rule module of #4904 and these scheduled rules:
- Closed items named as open: read the listing snapshot of perf(roadmap): intake reads only the issues that changed #4552 (0 requests), else paced REST.
- Identifiers in code spans, against an AST and import index of
src/andtests/. - Bare file names.
- Copied
CONST_/DEFAULT_values with unit conversions. When a measured run onmainshows 0 false positives, this rule moves to the docs row. - ADRs in force that name a removed path or command, as a finding that asks for a superseding ADR or a status change.
- Knowledge base review age (setting
docs.kb_review_max_age_days, default 180) and DriftManual. - A reader for lychee JSON output.
- Duplicated rules: Qdrant similarity between chunks of two standards documents in the existing RAG docs collection, with 0 model calls.
--offlineskips this rule and says so.
Each finding has file, line, token, rule, class, area, evidence and a proposed fix. --dry-run sends 0 requests. Add a "content census" routine to docs/ROUTINE_TASKS.md, so agents can run it before the brain runs exist.
Target Subsystem
SDLC, Git & PR Governance (devops docs, docs/ROUTINE_TASKS.md).
Existing Tool Considered
lychee (external URLs), Qdrant (the existing collection), ast, git and the listing snapshot. No open tool covers the project-specific rules. Cost: about 300 lines plus tests, about 250k tokens and 5 h.
Acceptance Criteria
- Tests use the census findings as fixtures, and each of the 8 rules finds its planted defect.
--dry-runsends 0 requests (a test).- On
main,--offlinefinishes in under 60 s on the devcontainer. - The duplicated-rule rule finds the coverage-rule pair of
CONTRIBUTING.mdanddocs/TESTING.mdin a fixture. docs/ROUTINE_TASKS.mdhas the routine.
Dependencies
Source: #4880
Alternatives check of 2026-11-27: partly.
Tool: lycheeverse/lychee (https://github.com/lycheeverse/lychee), Apache-2.0, last activity 2026-11-23, maintained.
Reason: Searches found lychee, a maintained open link checker with JSON output, which covers only the dead external URL rule; nothing found covers the seven project-specific rules (closed items, identifiers, constants, stale ADRs), so the command must build them.
Covers:
- Dead external URL detection in Markdown and HTML
- JSON report that a drift command can convert
- Deterministic CLI check with no model calls
Lacks:
- Closed issues still named as open in documents
- Code-span identifiers checked against an AST and import index
- Bare file names, copied constants, stale ADR references, duplicated rules
Proposed design
Problem statement
Add devops docs drift to report documentation drift that no pull request check finds. The command uses the rule module of #4904 and the scheduled rules of this issue. It reads lychee JSON for dead external URLs and builds the project-specific rules. It waits on #4904 and #4910.
Acceptance criteria
Requirement: Drift command runs the rule set
The devops docs drift command SHALL run each rule of the rule module of #4904 and each scheduled rule of this issue.
Scenario: All rules run
- WHEN A test runs the command against a fixture repository built from the census findings with one planted defect for each rule.
- THEN The command reports at least one finding for each planted defect.
Requirement: Closed item from snapshot
The command SHALL report a closed item that a document names as open from the listing snapshot of #4552 when the snapshot is present.
Scenario: Closed item from snapshot
- WHEN A fixture document names issue 550 as open and the listing snapshot marks issue 550 closed.
- THEN The command reports a finding at the document line with rule
closed-item-openand sends no REST request.
Requirement: Closed item from REST fallback
The command SHALL use paced REST to get the open or closed state of an item when the listing snapshot of #4552 is absent.
Scenario: Closed item from REST
- WHEN A test runs the command on a fixture with no listing snapshot and a stub REST client that marks issue 550 closed.
- THEN The command reports a finding with rule
closed-item-openand the stub records one paced REST request.
Requirement: Identifier checked against code index
The command SHALL report an identifier in a code span that the AST and import index of src/ and tests/ does not define.
Scenario: Unknown identifier
- WHEN A fixture document has the code span
FakeValkeyClientand the fixture index has no such symbol. - THEN The command reports a finding with the file, line, token
FakeValkeyClientand ruleidentifier.
Requirement: Bare file name
The command SHALL report a bare file name that has no repository path.
Scenario: Bare file name
- WHEN A fixture document contains
valkey.mdwith no repository path. - THEN The command reports a finding with rule
bare-file-nameand the tokenvalkey.md.
Requirement: Copied constant mismatch
The command SHALL report a copied CONST_ or DEFAULT_ value when the document value differs from the code value after unit conversion.
Scenario: Copied constant mismatch
- WHEN A fixture document states
DEFAULT_SAMPLE_TIMEOUT_SECONDS = 3600.0and the fixture source setsDEFAULT_SAMPLE_TIMEOUT_SECONDSto1200.0. - THEN The command reports a finding with rule
copied-constantand the two values.
Requirement: Copied constant unit conversion
The command SHALL convert units before it compares a copied CONST_ or DEFAULT_ value.
Scenario: Copied constant with unit conversion
- WHEN A fixture document states
DEFAULT_SAMPLE_TIMEOUT_SECONDS = 60and the fixture source sets it to60.0seconds. - THEN The command reports no
copied-constantfinding.
Requirement: ADR names a removed command
The command SHALL report an ADR in force that names a removed path or command and SHALL propose a superseding ADR or a status change.
Scenario: ADR names removed command
- WHEN A fixture ADR with status
acceptednames a command that the fixture command index marks removed. - THEN The command reports a finding with rule
adr-stale-referenceand a proposed fix that names a superseding ADR or a status change.
Requirement: Superseded ADR gets a count only
The command SHALL count a superseded ADR and SHALL report no stale-reference finding for it.
Scenario: Superseded ADR gets a count
- WHEN A fixture ADR with status
supersedednames the same removed command. - THEN The command reports one count for the ADR and no
adr-stale-referencefinding.
Requirement: Knowledge base review age
The command SHALL report a knowledge base document whose review age exceeds docs.kb_review_max_age_days, with default 180, and SHALL read the DriftManual.
Scenario: Old knowledge base review
- WHEN A fixture knowledge base document has a review date older than 180 days, the setting is unset, and the DriftManual lists the document.
- THEN The command reports a finding with rule
kb-review-ageand the age in days.
Requirement: Lychee JSON reader
The command SHALL read lychee JSON output and convert each dead external URL into a finding.
Scenario: Lychee dead URL
- WHEN A test feeds lychee JSON with one error for
https://example.invalid/dead. - THEN The command reports one finding with rule
external-urland the URL.
Requirement: Duplicated rules
The command SHALL report duplicated rules from Qdrant similarity of chunks in the existing RAG docs collection, with 0 model calls.
Scenario: Duplicated coverage rule
- WHEN A Qdrant stub returns two similar chunks from
CONTRIBUTING.mdanddocs/TESTING.mdin the RAG docs collection. - THEN The command reports a finding with rule
duplicated-ruleand makes no model call.
Requirement: Offline mode skips Qdrant
The command SHALL skip the duplicated-rule rule in --offline mode and SHALL state that it skipped the rule.
Scenario: Offline skips Qdrant
- WHEN A test runs
devops docs drift --offlinewith a Qdrant stub. - THEN The command sends no Qdrant request and prints a message that names the skipped rule.
Requirement: Dry run sends no request
The command SHALL send 0 requests in --dry-run mode.
Scenario: Dry run sends no request
- WHEN A test runs
devops docs drift --dry-runwith a request counter on the REST and Qdrant clients. - THEN The counter records 0 requests.
Requirement: JSON finding schema
The command SHALL write each finding with file, line, token, rule, class, area, evidence and proposed fix in --format json.
Scenario: JSON finding schema
- WHEN A test runs
devops docs drift --format jsonon a fixture with one defect. - THEN Each finding object in the JSON output has the eight keys.
Requirement: Rule filter
The command SHALL run only the named rule when --rule <name> is given.
Scenario: Rule filter
- WHEN A test runs
devops docs drift --rule bare-file-nameon a fixture with a bare file name and a closed item. - THEN The command reports the bare file name finding and no closed item finding.
Requirement: Content census routine
docs/ROUTINE_TASKS.md SHALL hold a content census routine that agents run before the brain runs exist.
Scenario: Routine present
- WHEN The docs test suite runs after the routine is added.
- THEN The test finds a content census section in
docs/ROUTINE_TASKS.mdthat names the commanddevops docs drift.
Requirement: Offline run time
On main, devops docs drift --offline SHALL finish in under 60 s on the devcontainer.
Scenario: Offline run time
- WHEN The live check
uv run devops docs drift --offlineruns on the devcontainer atmain. - THEN The elapsed time is under 60 s.
Existing Tool Considered
The alternatives check in the issue body gives verdict partly for lycheeverse/lychee (Apache-2.0, maintained). The proposal uses lychee JSON output for the dead external URL rule and refers to that block for what lychee covers and lacks. The proposal builds the other seven project-specific rules because the block lists them as lacks. The built rules cost about 300 lines plus tests, about 250k tokens and 5 h.
Key questions
- Which tool covers the external URL rule?: Use lycheeverse/lychee for the dead external URL rule. The alternatives check in the issue body gives verdict
partly. The command reads lychee JSON output. The command builds the other rules. (best practice) [sources: AGENTS.md, docs/adr/0005-review-findings-come-from-tools-not-models.md]- Chosen: lycheeverse/lychee. The check gives verdict
partlyand lychee writes JSON for dead external URLs. - Rejected: custom external URL checker. It duplicates lychee and adds code to keep.
- Rejected: markdownlint. It checks Markdown style, not dead external URLs.
- Rejected: vale. It checks prose style, not dead external URLs.
- Chosen: lycheeverse/lychee. The check gives verdict
- Should the drift findings come from deterministic rules with no model calls?: Yes. Use deterministic rules. The duplicated-rule rule uses Qdrant similarity with 0 model calls. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md, AGENTS.md]
- Chosen: deterministic rules. ADR 0005 admits findings from tools and checked facts, not models.
- Rejected: model review. ADR 0005 rejects model-generated findings for this work.
- How does the command get the open or closed state of an item?: Read the listing snapshot of perf(roadmap): intake reads only the issues that changed #4552 first. Use paced REST only when the snapshot is absent. (best practice) [sources: CONTEXT.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
- Chosen: listing snapshot first. The snapshot sends 0 requests and CONTEXT.md names the lane listing snapshot.
- Rejected: paced REST every run. It spends rate limit and adds latency.
- Rejected: no check. It misses the closed-item drift class.
- Does
--dry-runsend no request?: Yes. The command sends 0 requests in--dry-runmode. (best practice) [sources: CONTEXT.md]- Chosen: no requests. CONTEXT.md defines a dry run as a step that sends no request.
- Rejected: read-only requests. It breaks the
--dry-runcontract.
- Should the duplicated-rule rule use the existing Qdrant RAG docs collection?: Yes. Use the existing RAG docs collection in Qdrant. Make 0 model calls. (best practice) [sources: src/devops_cli/ai/rag/indexer.py, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
- Chosen: existing Qdrant collection. The RAG docs collection already holds the chunks and adds no store.
- Rejected: new vector store. It adds a dependency and cost.
- Rejected: text diff. It misses semantic duplication.
- What does a finding in an ADR in force ask for?: Ask for a superseding ADR or a status change. Do not edit the ADR text to remove drift. A superseded ADR gets a count only. (best practice) [sources: CONTEXT.md]
- Chosen: superseding ADR or status change. The issue body asks for one of these and an ADR is a record.
- Rejected: edit the ADR text. An ADR is a record and a later change supersedes it.
- Rejected: note at the top only. The issue body asks for a superseding ADR or a status change.
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(docs)scope of the title gives the scope.It adds a new command, and no current failure blocks users.It finds documentation drift that no current check finds for maintainers and agents.It adds 8 rules, tests and integrations in about 300 lines.Both find closed issues named as open, but 4912 adds a PR-time check from change folders and the candidate adds a scheduled drift command.dan-petty commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(docs)scope of the title gives the scope.It is a valuable new command but depends on #4904 and #4910 and is not blocking current work.Eight categories of docs drift are invisible today and affect project governance and accuracy.Eight rules, multiple external integrations (lychee, Qdrant, AST), roughly 300 lines plus tests and 5 h of work.Both detect recurring problems that go unnoticed, but #2346 targets agent session patterns while this targets documentation drift across 8 specific rules.9 remaining items
devops-cli-service commentedon Dec 1, 2026
Plan state: branch
feat/4920-devops-docs-drift-reports-the-drift, draft pull request #7989. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
A model review of the plan found these points. They stop no draft, and a person judges them:
ignores_existing_codeat tasks (3): Group 3 tells the implementer to editdocs/CONFIGURATION.mdby hand. A tool generates that file fromsettings.pyand the file says not to edit it. A hand edit fails the docs check. The group should regenerate the file withuv run devops docs generate, as group 7 does fordocs/commands/docs.md. Evidence: "Editdocs/CONFIGURATION.mdto describe the keydocs.kb_review_max_age_daysand its default 180"spec_delta_wrongat spec docs-drift (Content census routine): The scenario THEN says the routine section names the drift command.uv run devops ci docsexit 0 does not assert that. No test in the plan checks the section. The issue body asks for a docs test that finds the section. Evidence: "The command exits 0 and the routine task document holds a content census section that names the drift command."devops-cli-service commentedon Dec 1, 2026
The stage job staged the plan of draft pull request #7989. The plan state comment of #7989 holds the branch, the task groups and the findings.
The default branch changed these paths that the plan names, after the commit that the planner read. Read the commits before you judge the plan:
src/devops_cli/config/settings.py: f64a8af feat(roadmap): limit plan and implement jobs to bugs and security (feat(roadmap): limit plan and implement jobs to bugs and security #7982)src/devops_cli/config/defaults.py: f64a8af feat(roadmap): limit plan and implement jobs to bugs and security (feat(roadmap): limit plan and implement jobs to bugs and security #7982)docs/CONFIGURATION.md: f64a8af feat(roadmap): limit plan and implement jobs to bugs and security (feat(roadmap): limit plan and implement jobs to bugs and security #7982)The runs of the planner and the review made 65 model request(s), and used 5847553 input tokens and 78876 output tokens. The tool calls, in order:
Run 1 (stage):
read_issue({"number":4904})repo_map({"directory":"src/devops_cli/docs"})search_code({"text":"docs_app.command","path":"src/devops_cli/commands"})search_code({"text":"devops docs","path":"src/devops_cli/commands"})file_symbols({"path":"src/devops_cli/commands/docs.py"})read_file({"path":"src/devops_cli/commands/docs.py"})read_issue({"number":4910})search_code({"text":"path_collector"})read_file({"path":"src/devops_cli/docs/stale_issue.py"})search_code({"text":"drift_manual"})search_code({"text":"class DriftManual","path":"src"})read_file({"path":"src/devops_cli/ai/kb.py","start_line":200,"end_line":340})search_code({"text":"class DocsSettings","path":"src"})search_code({"text":"kb_review","path":"src"})search_code({"text":"alternatives_recheck_days","path":"src"})search_code({"text":"docs: ","path":"src/devops_cli/config/settings.py"})search_code({"text":" docs","path":"src/devops_cli/config/settings.py"})search_code({"text":"class Settings(","path":"src/devops_cli/config/settings.py"})read_file({"path":"src/devops_cli/config/settings.py","start_line":2913,"end_line":3000})references({"name":"UIConfig"})references({"name":"DEFAULT_ROADMAP_ALTERNATIVES_RECHECK_DAYS"})references({"name":"recheck_days"})read_issue({"number":4552})search_code({"text":"class SnapshotStore","path":"src"})file_symbols({"path":"src/devops_cli/roadmap/stores/listing_snapshot.py"})read_file({"path":"src/devops_cli/roadmap/stores/listing_snapshot.py","start_line":60,"end_line":185})search_code({"text":"class IssueRecord","path":"src"})read_file({"path":"src/devops_cli/roadmap/stores/store.py","start_line":748,"end_line":790})search_code({"text":"def ","path":"src/devops_cli/ai/rag/indexer.py"})read_file({"path":"src/devops_cli/ai/rag/indexer.py","start_line":790,"end_line":884})search_code({"text":" def ","path":"src/devops_cli/ai/rag/qdrant.py"})read_file({"path":"src/devops_cli/ai/rag/qdrant.py","start_line":322,"end_line":376})search_code({"text":"site_strict"})read_file({"path":"src/devops_cli/lang/en/help.py","start_line":1340,"end_line":1385})read_spec({"capability":"docs-reference-checks"})read_spec({"capability":"docs-code-span-paths"})search_code({"text":"## ","path":"docs/ROUTINE_TASKS.md"})search_code({"text":"lychee"})read_file({"path":"src/devops_cli/roadmap/steps/pages_health.py","start_line":598,"end_line":645})search_code({"text":"site build","path":"docs/commands"})search_code({"text":"site_outside_nav","path":"src/devops_cli/lang"})search_code({"text":"class GitHubRoadmapStore","path":"src/devops_cli/roadmap/stores"})Run 2 (stage):
file_symbols({"path":"src/devops_cli/commands/docs.py"})read_file({"path":"src/devops_cli/commands/docs.py","start_line":1,"end_line":70})file_symbols({"path":"src/devops_cli/roadmap/adr.py"})file_symbols({"path":"src/devops_cli/docs/path_collector.py"})search_code({"text":"def adr_of(","path":"src/devops_cli/roadmap/adr.py"})Run 4 (stage_verify):
search_code({"text":"class DocsConfig"})search_code({"text":"class DriftManual"})search_code({"text":"def rag_collection_names"})search_code({"text":"def scroll_points","path":"src/devops_cli/ai/rag/qdrant.py"})read_file({"path":"src/devops_cli/ai/rag/qdrant.py","start_line":350,"end_line":375})search_code({"text":" docs: ","path":"src/devops_cli/config/settings.py"})search_code({"text":"def setting_default"})Run 5 (stage):
search_code({"text":"CONFIGURATION.md","path":"src/devops_cli/docs"})Run 6 (stage_verify):
search_code({"text":"class DocsCommandHelp","path":"src/devops_cli/lang/en"})search_code({"text":"CONST_SETTINGS_SECTION_METADATA","path":"src/devops_cli"})read_file({"path":"src/devops_cli/docs/generator.py","start_line":1015,"end_line":1060})search_code({"text":" docs: ","path":"src/devops_cli/config/settings.py"})Tool calls: file_symbols=5 (empty=0), read_file=13 (empty=0), read_issue=3 (empty=0), read_spec=2 (empty=0), references=3 (empty=0), repo_map=1 (empty=0), search_code=32 (empty=8)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
The plan request held these comments of the item whole: #4920 (comment), #4920 (comment), #4920 (comment), #4920 (comment), #4920 (comment), #4920 (comment).
Warnings:
tests/docs/test_docs_drift.pydoes not exist.tests/docs/test_docs_drift_text_rules.pydoes not exist.tests/config/test_docs_settings.pydoes not exist.tests/docs/test_docs_drift_adr_rules.pydoes not exist.tests/docs/test_docs_drift_remote_rules.pydoes not exist.tests/docs/test_docs_drift_duplicates.pydoes not exist.tests/commands/test_docs_drift_command.pydoes not exist.docs(spec): plan #4920 Add the docs drift command
docs(spec): plan #4920 Add the docs drift command
docs(spec): plan #4920 Add the docs drift command (#7989)
dan-petty commentedon Dec 1, 2026
Review of #7989 on 2026-12-01: the plan is merged, but the Service does not build it. #7975 limits its jobs to bug and security items, and the implement job also excludes
effort/high. A person or an agent must claim the item, run it with--item, or close it. It counts towardroadmap.stage.planned_limit. One open defect: the routine scenario states thatci docsproves that the section exists, and that check does not.dan-petty commentedon Dec 1, 2026
Closed by the owner decision of 2026-12-01. The Service builds bug and security items only (#7975), and no person or agent claims this item. The plan of #7989 stays in
openspec/changes/until a cleanup removes it. File a new item ifdevops docs driftis wanted again.