Skip to content

Unit 5: Add the blocking check mode #143

Description

@mairas

Target repo: halos-org/docs-tools

Goal: translation-status can fail a build. This is the unit that makes the
gate possible; it does not turn it on anywhere.

Requirements: R6, R7, R8, R9

Dependencies: Unit 2

Files:

  • Modify: src/halos_docs_tools/translation_status.py
  • Modify: tests/test_translation_status.py

Approach:

  • Default behaviour is unchanged and still exits 0, so nothing that calls the
    command today changes meaning.
  • The check mode exits non-zero when any entry is stale, missing,
    unstamped or orphaned, evaluated across the whole repository rather than a
    subset of pages.
  • The failure output must name what failed. A non-zero exit with only a summary
    count forces the reader into the job log to learn anything.
  • Consequence to document in the repo README, not to code around: adding a
    locale to mkdocs.yml makes every page missing in that locale until its
    pages land, so a new locale arrives in one pull request (R9).

Execution note: Test-first — each of the four failing states should have a
red test before the exit-status logic exists.

Test scenarios:

  • Happy path: a fully current tree exits 0 in check mode.
  • Error path: one stale page exits non-zero.
  • Error path: one missing page exits non-zero.
  • Error path: one unstamped page exits non-zero.
  • Error path: one orphaned page exits non-zero.
  • Edge case: a page that is current in eight locales and stale in the ninth
    still exits non-zero.
  • Edge case: --only-pages does not narrow what the check mode considers —
    the gate stays repo-wide even when the report is filtered.
  • Happy path: without the check flag, the same failing tree still exits 0.

Verification:

  • Against a clone of halpi2 at main, check mode exits 0. Against PR
    #47's branch, it exits non-zero
    and names 108 entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions