Skip to content

Unit 6: Move PR comment construction into the package #144

Description

@mairas

Target repo: halos-org/docs-tools

Goal: One command produces the comment body, and that body describes exactly
what the gate fails on.

Requirements: R10, R11

Dependencies: Unit 5

Files:

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

Approach:

  • The body covers every failing entry, not only pages the pull request touched.
    Under a repo-wide gate a touched-pages comment can omit the very page that
    turned the check red.
  • Keep what PR #48 established: the
    60000-character ceiling, and the fallback that drops the collapsed English
    diffs and points at the job summary when the full body exceeds it.
  • Keep the <!-- translation-status --> marker so the workflow can find and
    update its own previous comment.
  • The command writes a body. It does not call the GitHub API; posting stays in
    the workflow where the token lives.

Test scenarios:

  • Happy path: a tree with one stale page produces a body containing that page,
    its locale, its state, the stamp to record, and the marker comment.
  • Happy path: a fully current tree produces the "every translation is current"
    body rather than an empty one.
  • Edge case: a body that would exceed 60000 characters is regenerated without
    diffs and carries the job-summary pointer.
  • Edge case: the regenerated body is itself under the limit for a tree with
    every page stale in every locale — the case that produced the original
    HTTP 422.
  • Integration: the set of pages named in the body equals the set of entries that
    make check mode exit non-zero, for the same tree.

Verification:

  • Generated against PR #47's branch,
    the body stays under the ceiling and names every failing entry.

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