Skip to content

feat(docs): docs check refuses unknown settings, variables and flags #4910

Done

Description

@dan-petty

Problem or Motivation

The content census found 5 living high findings (DEVOPS_CLI_GH_CLI_TIMEOUT, DEVOPS_CLI_AI_TASK_COMPOSE_MODEL and 3 flags in the knowledge base), 11 living low setting keys and 11 findings in ADRs in force. A wrong variable is ignored with no error. devops docs check checks commands, but not settings, variables, or flags that a document names alone.

Proposed Solution & Architectural Design

Add rules to the rule module of #4904:

  1. A DEVOPS_* variable must be in get_all_env_var_specs() or keyring_names().
  2. A dotted setting key in a code span or a config.yaml fence must walk the Settings model.
  3. A --flag on a line or table row that names a devops command must belong to that command. The rule uses the command tree that the docs row already loads.

The PR decides the 11 low-confidence keys in the documents. Precision rule as in #4904.

Target Subsystem

SDLC, Git & PR Governance (devops docs check, src/devops_cli/docs/).

Existing Tool Considered

The pydantic-settings model and the Typer tree, which are already the oracle of devops docs check. Cost: about 200 lines plus tests, about 120k tokens and 2.5 h.

Acceptance Criteria

  • Planted defects fail: an unknown variable, an unknown setting key and a flag of another command.
  • The rules give 0 findings on main at the merge.

Dependencies

#4894, #3917, #4904.

Source: #4880

Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches surfaced only CLI-docs generators (mkdocs-typer, sphinx-click) and generic YAML/markdown validators; none checks names in hand-written markdown against live env-var specs, the Settings model or the Typer tree.

Lacks:

  • Checks no DEVOPS_CLI_* name in a code span or fence
  • Walks no dotted key against the Settings model
  • Resolves no --flag against the command tree of a named command
  • Generators rewrite reference pages instead of flagging hand-written rows

Proposed design

Problem statement

Add three rules to devops docs check for unknown DEVOPS_CLI_* variables, dotted setting keys and flags of another command. The content census found 5 living high findings, 11 living low-confidence setting keys and 11 findings in ADRs in force. The check resolves a devops command in a document, but it ignores a setting, a variable or a flag that a document names alone, so a wrong name gives no error. The pull request also corrects the living findings, so the check gives 0 findings at the merge. The 11 findings in ADRs in force go to a separate issue, because a person corrects a record.

Acceptance criteria

Requirement: Unknown environment variable

The docs check SHALL report a finding for each DEVOPS_CLI_* variable that a document names and that neither get_all_env_var_specs() nor keyring_names() holds.

Scenario: Unknown variable fails the check

  • WHEN A test document names DEVOPS_CLI_NOT_A_SETTING in a code span, and no environment variable spec and no keyring name has that name.
  • THEN The variable rule returns one finding that names the document path and the line, and devops docs check exits with a non-zero status.

Requirement: Unknown setting key

The docs check MUST resolve each dotted setting key in a code span or a config.yaml fence against the Settings model and report a finding when no field is on that path.

Scenario: Unknown setting key fails the check

  • WHEN A config.yaml fence names ai.not_a_setting, and the Settings model has no field on that path.
  • THEN The setting rule returns one finding at the fence line, and devops docs check exits with a non-zero status.

Requirement: Flag of another command

The docs check MUST report a finding for each --flag on a line or a table row that names a devops command when the command tree has no such option.

Scenario: Unknown flag fails the check

  • WHEN A table row names devops docs check and --not-a-flag, and that command has no such option.
  • THEN The flag rule returns one finding at that row, and devops docs check exits with a non-zero status.

Requirement: Flag without a command is skipped

The flag rule SHALL skip a line or a table row that names no devops command.

Scenario: A flag in prose gives no finding

  • WHEN A test document has a line that names --help and no devops command.
  • THEN The flag rule returns no finding for that line.

Requirement: Setting key recognition

The setting rule SHALL consider only a dotted token whose first part is a top-level field of Settings.

Scenario: A domain is not a setting key

  • WHEN A test document names example.com in a code span.
  • THEN The setting rule returns no finding for that token.

Requirement: Valid names pass

The three rules SHALL report no finding for a variable, a setting key or a flag that resolves against the specs, the Settings model or the command tree.

Scenario: Known names give no finding

  • WHEN A test document names a variable from get_all_env_var_specs(), a field of the Settings model and an option of the named command.
  • THEN The three rules return no finding for that document, and devops docs check exits with status 0.

Requirement: Placeholder names are skipped

The rules MUST skip a name that is a placeholder or a shell variable.

Scenario: Placeholder gives no finding

  • WHEN A test document names <variable> and $DEVOPS_CLI_HOME in code spans.
  • THEN The variable rule returns no finding for that document.

Requirement: Clean repository at merge

The three rules MUST report 0 findings on the documents of main at the merge.

Scenario: Zero findings on main

  • WHEN uv run devops docs check runs after the pull request corrects the two unknown DEVOPS_CLI_* variables, the 3 flags in the knowledge base and the 11 low-confidence setting keys.
  • THEN The output reports no finding from the variable rule, the setting rule and the flag rule.

Existing Tool Considered

The alternatives check of 2026-11-27 in the issue body gives the verdict none and names no tool. No open, maintained tool covers the need, and the block lists what a tool would lack. This change builds the three rules in the rule module of #4904 with the pydantic-settings model and the Typer tree as the oracle. The written cost is about 200 lines plus tests, about 120k tokens and 2.5 h.

Key questions

  • Which module holds the three new rules?: The rule module that feat(docs): docs check refuses paths that do not exist #4904 adds under src/devops_cli/docs/. Each rule is one function with passing tests, and check_docs calls it as it calls check_documented_argv. (best practice) [sources: src/devops_cli/docs/generator.py, src/devops_cli/docs/markdown_argv_collector.py]
  • Where does each rule get the set of valid names?: At check time from the live oracles. The variable rule reads get_all_env_var_specs() and keyring_names() in src/devops_cli/config/env.py. The setting rule walks the fields of the Settings model in src/devops_cli/config/settings.py by dotted path. The flag rule walks the command tree that src/devops_cli/core/command_resolver.py resolves. [sources: src/devops_cli/config/env.py, src/devops_cli/config/settings.py, src/devops_cli/core/command_resolver.py]
  • How does the setting rule walk a dotted key?: It splits the key on ., starts at Settings.model_fields, follows each part through a BaseModel annotation, and reports a miss when a part is not a field. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/docs/generator.py]
    • Chosen: Walk model annotations. It resolves no value and works without a config file.
    • Rejected: Instantiate Settings and use getattr. It resolves values, can raise on a bad environment, and hides a missing field.
  • How does the setting rule tell a dotted setting key from a file name or a domain?: It considers only a dotted token whose first part is a top-level field of Settings. A token with another first part, such as example.com or foo.py, is not a setting key. (best practice) [sources: src/devops_cli/config/settings.py, src/devops_cli/docs/markdown_argv_collector.py]
    • Chosen: Require a top-level Settings section. It keeps domains and file names out of the rule.
    • Rejected: Treat every dotted token as a setting key. It reports example.com and foo.py as unknown settings.
  • How does the flag rule find the command of a line or row?: It reads the longest devops ... command path on the line or row, resolves it with the command resolver that the docs row already uses, and checks each --flag against that command's options. (best practice) [sources: src/devops_cli/core/command_resolver.py, src/devops_cli/docs/markdown_argv_collector.py]
    • Chosen: Resolve the longest devops command path. It uses the same command tree as the docs row and gives one owner to each flag.
    • Rejected: Treat each devops word as a command. It resolves a subcommand as a group and gives a false owner to a flag.
  • What does the flag rule do with a line that names no devops command?: It skips the line. A flag with no named command has no owner, so the rule reports nothing. (best practice) [sources: src/devops_cli/docs/markdown_argv_collector.py]
    • Chosen: Skip a line that names no devops command. A flag with no named command has no owner, so the rule cannot decide it.
    • Rejected: Report each --flag that has no named command. It reports a flag in prose, such as --help in an example, as a defect.
  • How does the pull request settle the 11 low-confidence setting keys?: It checks each key against the Settings model. A dotted path that walks to no field is a wrong document, so the pull request corrects the document. It adds a field only when a code path reads the key. (best practice) [sources: src/devops_cli/config/settings.py, AGENTS.md]
    • Chosen: Correct the key in the document. The document is the wrong side when the model has no field and no code reads the key.
    • Rejected: Add the key to the Settings model. It adds a setting that no code reads, and it hides the wrong document.
  • What precision rule keeps a false finding out?: A finding needs a positive miss against the live oracle. The rules skip a placeholder and a shell variable, and they report only a name that the oracle does not hold. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md, src/devops_cli/docs/markdown_argv_collector.py]
    • Chosen: Require a positive miss against the live oracle. It gives a finding only when the name is absent from the specs, the model or the tree.
    • Rejected: Report each name that does not match a pattern. It reports placeholders and shell variables as defects.
  • Which variable prefix do the rules check?: DEVOPS_CLI_. _VARIABLE_PREFIX is DEVOPS_CLI, and a variable is that prefix plus the setting's dotted key in upper case, with _ for .. The issue's DEVOPS_* is shorthand for this prefix. [sources: src/devops_cli/config/env.py, CONTRIBUTING.md]
  • Do the three rules read the ADRs?: No. The docs check reads the prompt and hand-written classes that src/devops_cli/config/constants.py defines, and an ADR under docs/adr/ is a record. The 11 findings in ADRs in force go to a separate issue, because a person corrects a record. (best practice) [sources: src/devops_cli/config/constants.py, docs/adr/0005-review-findings-come-from-tools-not-models.md]
    • Chosen: Keep ADRs out of the three rules. The check reads no record class, and this change does not correct a record.
    • Rejected: Add a fourth rule that reads docs/adr/. It fails the check on records that this change does not correct.
  • Which documents do the three rules scan?: The hand-written documents that the docs check already scans for code-span paths. A generated document is the output of DocGenerator, and the docs row refuses a stale one. The rules skip the class generated in the docs inventory. (best practice) [sources: src/devops_cli/docs/generator.py, CONTEXT.md]
    • Chosen: Scan hand-written documents. A generated page has its source, and the docs row checks it.
    • Rejected: Scan every document. It reports a finding in a generated page that a person cannot edit.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4894, #3917, #4904

Moved to new items

#7754

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/docs
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. added
    effort/medium
    and removed
    effort/medium
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. The change improves documentation accuracy but does not block a release.
    • Value: Medium. The rules catch wrong settings, variables and flags in documents.
    • Effort: Medium. The candidate estimates about 200 lines plus tests and 2.5 hours.
    • Related: feat(docs): docs check refuses paths that do not exist #4904, which asks for a different change. Both items add rules to the docs check module, but #4904 checks paths and the candidate checks settings, variables and flags.
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/docs. The (docs) scope of the title gives the scope.
    • Priority: P2-Medium. It catches silent documentation errors that mislead users, but does not block a release or expose a security risk.
    • Value: Medium. Users who follow a wrong variable or flag in the docs lose time and trust in the tool.
    • Effort: Medium. The body estimates about 200 lines of code plus tests, roughly 2.5 hours of work.
    • Related: feat(docs): documentation syntax, code fence nesting, and mermaid link validator #227, which asks for a different change. Both add rules to devops docs check, but #227 validates document syntax and structure while this candidate validates that named settings, variables, and flags exist in the codebase.
  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches returned only unrelated pages (MDN CSS environment-variable guides, Docker Hub image pages) and no maintained tool that cross-checks names a document mentions — DEVOPS_* variables, dotted setting keys and --flags — against a project's pydantic-settings model and Typer command tree. Nothing found could replace the rule module described in the issue, so the need stays in-repo.

    Tool: none found

    Lacks:

    • A check that a documented DEVOPS_* variable exists in get_all_env_var_specs() or keyring_names()
    • A check that a dotted setting key in a code span or config.yaml fence walks the Settings model
    • A check that a --flag on a line or table row naming a devops command belongs to that command's Typer tree
    • Findings on the 5 high and 11 low-confidence findings already in the content census, with zero findings on main at merge

    Searches run:

    • lint markdown docs for unknown CLI flag options that do not exist in argparse typer, results: 5
    • tool to validate CLI flags and environment variables mentioned in documentation against source code, results: 5
    • detect stale documentation CLI reference flags drift checker GitHub action, results: 5
    • pytest-examples validate documentation code examples lint print statements, results: 5
    • vale prose linter documentation rules, results: 5
    • mkdocs-code-validator check code blocks in documentation, results: 5
    • "pytest-examples" PyPI package documentation tests, results: 5
    • github action check README environment variables exist in settings code, results: 5
    • python library verify documentation environment variable names against pydantic settings model, results: 5
    • "docs" linter "flags" "environment variables" consistency code source of truth tool open source, results: 5

    Sources:

    Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.

  7. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at fccb781 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  8. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  9. added
    status/ready
    and removed
    status/new
    on Nov 29, 2026
  10. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  11. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 29, 2026
  12. removed
    status/in-review
    on Nov 29, 2026
  13. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:50 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/docssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions