Commit Graph
2 Commits
Author SHA1 Message Date
Aleksei Sviridkin be55f6eb2b test(ci): load the shared bats helper in the labeler contract test
Every unit bats file under hack/ must load test_helper so it runs with
nounset, and hack/bats-strict-setup.bats fails the suite for a file
that does not.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-10-11 18:42:11 +03:00
shaurya703 79e95a1b30 test(ci): pin the label-writing workflows with contract tests
pr-labeler.yaml and stale.yaml decide which labels land on issues and
PRs, and neither had a test behind it. A mistyped label name is not an
error, it is a rule that silently stops matching.

hack/label-workflows-contract.bats pins:

- every label either workflow can write or match resolves against a
  name: in .github/labels.yml (typeToKind, scopeToArea, the three
  literal adds, stale/close labels, both exempt lists)
- the typeToKind mappings are exactly the rows of the type table in
  docs/agents/contributing.md, in both directions, and a type the table
  lists under "(no kind label)" has no key in the workflow
- the trigger list stays [opened, reopened, synchronize] and 'edited'
  does not come back in either YAML spelling
- the labeler stays additive-only (addLabels only, no removeLabel or
  setLabels) with the area/uncategorized fallback
- stale policy values: label choices, 12 issue and 4 PR exemptions,
  days-before-stale 60, days-before-close 14, operations-per-run 100
- stale runs from its daily cron and workflow_dispatch only

JS // and YAML # comments are stripped before matching, so a mapping or
a gate demoted to a comment cannot satisfy the contract. Negative checks
use the grep -c / -eq 0 form of the sibling contract files: a negated
pipeline is ignored by set -e, so it cannot fail a test under
hack/cozytest.sh and fails under bats only as the last command.

Every assertion was mutation-checked under both bats and
hack/cozytest.sh. POSIX-only constructs; picked up automatically by
BATS_UNIT_FILES.

Closes #3589

Signed-off-by: shaurya703 <kesar.shaurya@gmail.com>
2026-10-11 18:40:02 +03:00