Skip to content

feat(docs): generate the job result contract and the setting bounds #5534

Open

Description

@dan-petty

Problem or Motivation

docs/roadmap/job-success.md and the agentic workflow spec (PR #5489) copy code facts by hand:

  • the form of the result line, the job names, the intended results, the infra classes, the value charset and the first-pass limits (src/devops_cli/roadmap/job_result.py);
  • the trend windows, the "broken" and "infra" thresholds, the version minimum and the number of top classes (src/devops_cli/roadmap/job_grade_report.py);
  • the default and the ceiling of each roadmap limit setting (Table 4-4).

Two copies were wrong on the day of writing. Table 4-5 gives 6 plan heads, and main has 7. Table 4-4 gives constant ceilings that #5440 had already made settings. This item does not generate the eval set sizes: devops roadmap eval <set> --dry-run already lists the cases, a count in git would change in each PR that adds a case (#5516 adds 26), and #3445 derives the stage counts in its test. The spec links the fixture folders and the command. docs/CONFIGURATION.md shows a nested section as one string and gives no bound. The owner direction of 2026-11-13: these values come from programs, not from an agent.

Proposed Solution & Architectural Design

Extend DocGenerator.synced_blocks() (src/devops_cli/docs/generator.py), the method that already writes the JOB_GRADES block and the ADR index. When the named marker-block function of #4889 is on main, write the block with it, and add no third copy of the partition code. This item is a child of the content freshness tracker #4880.

  1. Add a typed table to job_result.py for each job: the source of its line, all its results, its counts and its names. Use the form of GRADE_POLICIES.
  2. Write a block JOB_RESULTS_START / JOB_RESULTS_END in docs/roadmap/job-success.md from LINE_PREFIX, the field order, RoadmapJob, SUCCESS_RESULTS, INFRA_CLASSES, the _NAME charset, FIRST_PASS_LIMITS and the new table.
  3. Add the trend constants of job_grade_report.py to the JOB_GRADES block. Make them public constants first.
  4. In docs/CONFIGURATION.md, give each field of a nested settings model its own row with its type, its default and its bounds. Read them from pydantic model_json_schema() (minimum, maximum, exclusiveMinimum, exclusiveMaximum).
  5. devops docs check fails when a block or the page is stale. It runs offline, as now.

Target Subsystem

SDLC, Git & PR Governance

Existing Tool Considered

  • DocGenerator synced blocks (in this repository) already write and check the JOB_GRADES block and the ADR index. This item adds blocks to the same mechanism.
  • pydantic (MIT) model_json_schema() gives the types, defaults and bounds, so no code parses Field metadata by hand.
  • Cog (MIT) writes text between markers, but it duplicates the existing mechanism.

Cost to build: about 120 lines with tests, about 120k tokens, half an agent-day.

Acceptance Criteria

  • A test: a changed constant of job_result.py changes the JOB_RESULTS block, and devops docs check fails on the old page.
  • A test: docs/CONFIGURATION.md shows roadmap.implement.max_memory_limit with its default, and a bounded roadmap limit with its upper bound.
  • The hand text of docs/roadmap/job-success.md holds none of the generated values.
  • uv run devops docs check passes on the branch.

Source: #4880

Alternatives check of 2026-11-23: partly.
Tool: nedbat/cog (https://github.com/nedbat/cog), MIT, last activity 2026-11-18, maintained.
Reason: Searches found Cog (cogapp), an MIT marker-block generator that runs Python from a document and writes the output between markers, so it covers the generated-block part only; it reads no pydantic schema bounds, and ADR 0025 rejects it as a duplicate of the in-repo DocGenerator.

Covers:

  • Writes generated text between markers in a page
  • Runs Python in the document to read code values
  • Checks whether the generated output is stale

Lacks:

  • No pydantic schema types, defaults or bounds
  • No row per nested settings field
  • Second generator beside DocGenerator and its docs check

Proposed design

Problem statement

Two documents copy code facts by hand, and two copies were already wrong. docs/roadmap/job-success.md must take the job result contract from job_result.py and the trend constants from job_grade_report.py. docs/CONFIGURATION.md must show each nested setting with its type, default and bounds from the pydantic schema. devops docs check must fail when a generated block or page is stale.

Acceptance criteria

Requirement: Job result block from code

The JOB_RESULTS block in docs/roadmap/job-success.md SHALL be generated from the constants and the typed job table in job_result.py.

Scenario: Changed prefix

  • WHEN A test patches LINE_PREFIX and calls DocGenerator.synced_blocks().
  • THEN The JOB_RESULTS block holds the new prefix.

Requirement: Stale job result block

devops docs check MUST fail when the JOB_RESULTS block is stale.

Scenario: Stale block fails check

  • WHEN A test writes an old block into docs/roadmap/job-success.md in a temporary checkout and runs uv run devops docs check.
  • THEN The command exits nonzero and names the stale JOB_RESULTS block.

Requirement: Trend constants in grade block

The JOB_GRADES block SHALL include the trend windows, thresholds, version minimum and top-class count from public constants in job_grade_report.py.

Scenario: Changed trend constant

  • WHEN A test patches a public trend constant and calls DocGenerator.synced_blocks().
  • THEN The JOB_GRADES block holds the new value.

Requirement: Nested setting rows

docs/CONFIGURATION.md SHALL give each field of a nested settings model its own row with type, default and bounds from pydantic model_json_schema().

Scenario: Memory limit row

  • WHEN A test calls the settings-page generator for the nested roadmap limit model.
  • THEN The rendered table holds a row for roadmap.implement.max_memory_limit with its default, and a bounded roadmap limit with its upper bound.

Requirement: Offline docs check

devops docs check MUST run offline, pass on the generated branch and fail on a stale block or page.

Scenario: Offline check

  • WHEN A test runs uv run devops docs check on the generated branch and on a stale copy with no network access.
  • THEN The command exits 0 on the branch and nonzero on the stale copy.

Requirement: No hand copy of generated tables

The hand text of docs/roadmap/job-success.md outside the markers MUST hold no second table of job results or trend thresholds.

Scenario: One table source

  • WHEN A test reads the page outside the JOB_RESULTS and JOB_GRADES markers.
  • THEN It finds no Markdown table with the job result columns or the trend threshold values.

Existing Tool Considered

Cog (cogapp) is the named tool. The alternatives check of 2026-11-17 in the issue body records the verdict rejected by ADR 0025, with what the tool covers and lacks. This proposal extends the in-repo DocGenerator and reads setting bounds from pydantic model_json_schema(), which Cog lacks. Cost to build: about 120 lines with tests, about 120k tokens, half an agent-day.

Key questions

  • Which generator mechanism writes the new blocks?: Extend DocGenerator.synced_blocks(). Use the named marker-block function of feat(docs): generated pages name their source and stay complete #4889 when it is on main, and add no third copy of the partition code. (best practice) [sources: src/devops_cli/docs/generator.py, docs/roadmap/job-success.md]
    • Chosen: Extend DocGenerator.synced_blocks(). It already writes JOB_GRADES and the ADR index, and the issue asks for this method.
    • Rejected: Add a standalone generator. It adds a third copy of the partition code and a second check path.
    • Rejected: Use Cog. ADG 0025 rejects Cog as a duplicate of the in-repo generator.
  • Which source holds the job result facts for the block?: A typed table in job_result.py holds for each job the source of its line, all results, counts and names. The block also reads the line prefix, the field order, the job enum, the result mapping, the infra classes, the name charset and the first-pass mapping that is_first_pass() uses. (best practice) [sources: src/devops_cli/roadmap/job_result.py, src/devops_cli/roadmap/job_grade.py]
    • Chosen: Typed table in job_result.py. It keeps one source in code and follows the existing grade-policy mapping form.
    • Rejected: Hand text in the page. It is the duplicate that the issue removes.
    • Rejected: Parse the Markdown page. It makes the page the source and keeps the stale values.
  • How does the generator get the trend constants?: Make the constants of job_grade_report.py public, and add them to the JOB_GRADES block. Do not copy their values into the generator. (best practice) [sources: src/devops_cli/roadmap/job_grade_report.py, docs/roadmap/job-success.md]
    • Chosen: Public constants from job_grade_report.py. One code source, and the existing JOB_GRADES block already comes from code.
    • Rejected: Literal values in the generator. They become a second copy and can go stale.
    • Rejected: Read the module source text. It is brittle and bypasses the constants.
  • How does the docs page get the type, default and bounds of each nested setting?: Use pydantic model_json_schema() on each nested settings model, and render one row for each field with its type, default, minimum, maximum, exclusiveMinimum and exclusiveMaximum. (best practice) [sources: src/devops_cli/config/settings.py, docs/CONFIGURATION.md]
    • Chosen: Pydantic model_json_schema(). It gives the schema facts, so no code parses Field metadata by hand.
    • Rejected: Hand table in docs/CONFIGURATION.md. It gives no bound and already shows a nested section as one string.
    • Rejected: Parse Field metadata by hand. It duplicates pydantic and misses nested models.
  • Which first-pass mapping does the block use?: Use FIRST_PASS, the mapping that is_first_pass() reads and that docs/roadmap/job-success.md names. Do not use the older FIRST_PASS_LIMITS subset. (best practice) [sources: src/devops_cli/roadmap/job_result.py, docs/roadmap/job-success.md]
    • Chosen: FIRST_PASS. It holds every job with a first-pass rule and is the mapping that is_first_pass() reads.
    • Rejected: FIRST_PASS_LIMITS. It is an older subset with only stage, implement and fix_plan.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/feature
    scope/docs
    status/new
    value/medium
    effort/low
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 13, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: rejected

    Reason: Searches found Cog as the only maintained general marker-block generator: it writes blocks from code and checks staleness offline, but it has no typed code-fact tables, and ADR 0025 rejected it as a duplicate of the in-repo generator.

    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.

    Covers:

    • Writes generated text between named markers in Markdown pages
    • Check mode fails when a block or page is stale, offline
    • Runs from a CI step or a pre-commit hook

    Lacks:

    • Runs Python code embedded in the documents themselves
    • No typed tables of job results, results, counts or names
    • No setting bounds table read from pydantic JSON schema
    Searches (6)

    Tools considered:

    Searches run:

    • generate markdown docs from pydantic model_json_schema bounds minimum maximum, results: 5
    • Cog generate documentation blocks from Python code, check stale with cog --check, results: 5
    • cogapp PyPI nedbat cog marker blocks generated docs check, results: 5
    • mkdocstrings pydantic model fields schema documentation generation, results: 5
    • pydantic-jsonschema github generate markdown table from json schema, results: 5
    • cogapp, results: 5

    Sources:

    A person decides what this check of 2026-11-17 means for the item.

  6. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  7. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 86358b6 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: rejected, tool https://pypi.org/project/cogapp. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • cog tool check generated docs block up to date CI, results: 5
    • cogapp Cog generate text between markers in documentation from Python, results: 5
    • nedbat cog github repository, results: 5
    • cogapp PyPI package cog, results: 5
    • "cog" nedbat documentation check generated files markers, results: 5

    Sources:

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/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions