Skip to content

feat(docs): one generated block holds the quality limits #4915

Open

Description

@dan-petty

Problem or Motivation

Documents hold hand copies of quality limits: the coverage floor 85 (fail_under in pyproject.toml), the changed-line floor 90 (--fail-under 90 in ci.yml), C901 10, PLR1702 4, line length 100 and CONST_AGENTS_MD_MAX_CHARS 6,500. The standards pass fixed the coverage and nesting values by hand, and the knowledge base once said 90 for the coverage floor (#3904). A copied-constant rule cannot see these values, because pyproject.toml values have no CONST_ name.

Proposed Solution & Architectural Design

  1. Use the named marker-block function of feat(docs): generated pages name their source and stay complete #4889 to write a "quality-limits" block in CONTRIBUTING.md. Values come from pyproject.toml (tomllib) and the constants.
  2. Move the changed-line floor into [tool.diff_cover] fail_under in pyproject.toml. Make ci.yml run diff-cover with --config-file pyproject.toml and no number.
  3. The docs row compares the block.
  4. Other documents link to the block and copy no number. CONTRIBUTING.md states the rule: name the source and link to it, do not copy a value.
  5. Delete the per-fact coverage tests that the block replaces.

No cogapp: cog runs Python from documents, and the generator already has a marker-block function.

Target Subsystem

SDLC, Git & PR Governance (CONTRIBUTING.md, pyproject.toml, .github/workflows/ci.yml, the docs generator).

Existing Tool Considered

diff-cover reads fail_under from pyproject.toml; tomllib reads the values. Cost: about 80 lines plus tests, about 60k tokens and 1.5 h.

Acceptance Criteria

  • A change of fail_under in pyproject.toml makes the docs row fail until uv run devops docs generate runs.
  • ci.yml holds no coverage number.
  • A test finds no copy of the 6 limits in the hand-written classes outside the block.

Dependencies

#4889.

Source: #4880

Alternatives check of 2026-11-21: rejected.
Rejected by ADR 0025. A newer fact can change an ADR.
Tool: cogapp (https://pypi.org/project/cogapp), MIT, last activity 2026-11-15, maintained.
Reason: cogapp writes marker-delimited blocks in Markdown and can fail a check run when they are stale, so it covers the generation and the guard; ADR 0025 rejects it, and it does not cover the rest of the issue.

Covers:

  • Marker-delimited generated blocks inside a Markdown file
  • Check run that fails when the block is stale
  • Python in the block can read pyproject.toml values

Lacks:

  • No move of the changed-line floor into pyproject.toml
  • No scan that documents only link to the block
  • Runs Python written inside the document
  • No deletion of the per-fact coverage tests

Proposed design

Problem statement

Documents copy six quality limits by hand. The copies become different from pyproject.toml and the constants. One generated quality-limits block in CONTRIBUTING.md gives each value and its source. The docs row fails when the block is stale.

Acceptance criteria

Requirement: Generated quality-limits block

The docs generator SHALL write a quality-limits block in CONTRIBUTING.md from pyproject.toml and the constants.

Scenario: The generator writes all six limits

  • WHEN uv run devops docs generate runs with no change to the six limits
  • THEN The block lists the coverage floor 85, the changed-line floor 90, C901 10, PLR1702 4, line length 100 and CONST_AGENTS_MD_MAX_CHARS 6,500, each with its source.

Requirement: Stale block fails the docs row

The docs row SHALL fail when the quality-limits block differs from its generated form.

Scenario: A changed coverage floor leaves the block stale

  • WHEN fail_under in pyproject.toml changes and uv run devops docs generate does not run
  • THEN The docs row exits nonzero.

Requirement: Changed-line floor has one source

The changed-line coverage floor MUST live in [tool.diff_cover] fail_under in pyproject.toml.

Scenario: CI reads the changed-line floor from pyproject.toml

  • WHEN .github/workflows/ci.yml runs diff-cover
  • THEN The command uses --config-file pyproject.toml and holds no --fail-under number.

Requirement: Documents link to the block

Hand-written documents SHALL link to the quality-limits block and SHALL NOT copy one of the six limits.

Scenario: The scan accepts a link-only document

  • WHEN A test scans the hand-written documents outside the quality-limits block
  • THEN The test finds no copy of the six limits and passes only when each document links to the block.

Requirement: CONTRIBUTING.md states the no-copy rule

CONTRIBUTING.md SHALL state that a document names the source and links to it and does not copy a quality limit.

Scenario: The contributor reads the rule

  • WHEN CONTRIBUTING.md is rendered
  • THEN The quality-limits section states the no-copy rule and links to the generated block.

Requirement: Replaced coverage tests are deleted

The change SHALL delete the per-fact coverage tests that the quality-limits block replaces.

Scenario: No test asserts a copied coverage floor

  • WHEN The test suite runs after the change
  • THEN No test asserts a hand-copied coverage floor that the quality-limits block now checks.

Existing Tool Considered

cogapp (https://pypi.org/project/cogapp) is the open-source tool that writes marker-delimited generated blocks inside documents. ADR 0025 rejects it for generated blocks, and its last activity is 2025-09-21, so it is not maintained. It lacks the diff-cover configuration move, the link-only rule and the test deletion. The project uses its own marker-block function from #4889; the issue estimates about 80 lines plus tests, about 60k tokens and 1.5 h.

Key questions

  • Which tool writes the quality-limits block?: The project marker-block function from feat(docs): generated pages name their source and stay complete #4889 writes the block. Do not use cogapp: ADR 0025 rejects it for generated blocks, and it is not maintained. (best practice) [sources: CONTRIBUTING.md]
    • Chosen: Project marker-block function from feat(docs): generated pages name their source and stay complete #4889. It already writes and checks marker-delimited blocks and the project records its use.
    • Rejected: cogapp. ADR 0025 rejects it, it is not maintained, and it runs Python from documents.
    • Rejected: Hand-written block. It copies the values and lets them drift again.
  • Where does the changed-line floor live?: In [tool.diff_cover] fail_under = 90 in pyproject.toml. ci.yml runs diff-cover with --config-file pyproject.toml and no --fail-under number. (best practice) [sources: pyproject.toml, .github/workflows/ci.yml]
    • Chosen: Move to pyproject.toml. One source holds the value and diff-cover reads it.
    • Rejected: Keep --fail-under 90 in ci.yml. It keeps a copied number in CI.
  • How does the generator read the six limits?: Read pyproject.toml with tomllib for the coverage floor, changed-line floor, C901, PLR1702 and line length. Import CONST_AGENTS_MD_MAX_CHARS from src/devops_cli/config/constants.py. (best practice) [sources: pyproject.toml, src/devops_cli/config/constants.py:202]
    • Chosen: tomllib plus the constants import. The standard library and the existing constant avoid a second copy.
    • Rejected: Copy the values into the generator. It creates another copy that can drift.
  • How do other documents avoid copied limits?: Each hand-written document names the source and links to the quality-limits block in CONTRIBUTING.md. CONTRIBUTING.md states the no-copy rule. (best practice) [sources: CONTRIBUTING.md]
    • Chosen: Link to the block. The block holds the value and the document holds no number.
    • Rejected: Repeat the values. It makes a second copy that the docs row cannot check.
  • Which tests does the block replace?: Delete the per-fact coverage tests that assert the coverage floor, including the fail_under assertions in tests/commands/test_ci.py and tests/invariants/test_agents_md.py. (best practice) [sources: tests/commands/test_ci.py, tests/invariants/test_agents_md.py]
    • Chosen: Delete the replaced per-fact tests. The block and its docs row check the same values.
    • Rejected: Keep the tests. They assert copies that the change removes.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4889

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/docs
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  3. 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 prevents stale documentation values but does not block a release or fix a defect.
    • Value: Medium. It removes hand-copied numbers from docs and prevents drift, but the toolchain still functions without it.
    • Effort: Low. The body estimates about 80 lines, tests, and 1.5 hours of work.
    • Related: feat(ci): changed-line coverage on pull requests (diff-cover) #850, which asks for a different change. Both touch diff-cover settings in pyproject.toml and ci.yml, but #850 adds the changed-line coverage gate while this candidate generates a single docs block from those values.
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: rejected

    Reason: Searches pointed to cogapp as the only open tool that writes and re-checks marker-delimited generated blocks inside documents, which is the core of the requested "quality-limits" block: Python inside the block could read fail_under and the constants with tomllib, and check mode would fail the docs row until regeneration. It covers only that part, and ADR 0025 explicitly rejects cogapp for generated blocks (the issue says the same), so the project's own marker-block function is the intended path.

    Rejected by ADR 0025. A newer fact can change an ADR.

    Tool: cogapp (https://pypi.org/project/cogapp)

    • License: MIT
    • Last activity: 2025-09-21
    • Maintained: no

    Covers:

    • Writes and refreshes marker-delimited generated blocks inside a Markdown document
    • Runs Python inside the block, so it can read pyproject.toml values (tomllib) and the constants
    • A check mode makes the docs row fail while a generated block is stale

    Lacks:

    • Moving the changed-line floor into [tool.diff_cover] fail_under and running diff-cover with --config-file
    • The rule and check that other documents link to the block and copy no number
    • Deleting the per-fact coverage tests that the block replaces
    • Runs Python from the documents themselves, which the issue and ADR 0025 refuse

    Tools considered:

    Searches run:

    • tool that keeps documentation numbers in sync with pyproject.toml configuration, results: 5
    • cogapp generate marker blocks in documentation from source values, results: 5
    • cogapp PyPI cog content generation tool, results: 5
    • embedme markdown-magic embed generated content into markdown from source, results: 5
    • nedbat cog inline generation marker blocks check mode documentation, 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.

  6. 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.

  7. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor

    No check now compares the coverage floor in the documents with pyproject.toml: #6075 deleted the two guard tests, and the generated block of this item does not exist yet. This makes the item more urgent. Step 5 is already done, and the replacement must be the generated block, not a new test.

    Evidence (origin/main 0d90de5, 2026-11-19)

    Effect on this item

    • Step 5 ("Delete the per-fact coverage tests that the block replaces") and the requirement "Replaced coverage tests are deleted" are done already. The refine key question names tests/commands/test_ci.py and tests/invariants/test_agents_md.py. tests/invariants/test_agents_md.py holds no fail_under assertion now. tests/commands/test_ci.py:790 still asserts "--fail-under 90" in run for the step "Changed-Line Coverage" of .github/workflows/ci.yml. That is a test of a config value, not a test of a documented floor. Re-check which assertions remain before the build.
    • A new guard test is not a fix. fix(k8s): Drop the tests that assert values of manifests and config #6075 also added a test-tree check that refuses a new test that reads a committed config file, and pyproject.toml is on its list (tests/gate/tree_checks/config_values.py:50, docs/TESTING.md:62). The generated block of this item, which the docs row compares, is the correct guard.
    • Until the block exists, a change of fail_under or of the diff-cover floor leaves 2 documents wrong, and no check fails.

    Proposed action

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/lowpriority/p2-mediumscope/docssource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions