headroom/scripts/tests
Tejas Chopra c4d1ae1a45 ci(governance): require a Conventional Commit PR title
The repo squash-merges, so the PR title -- not the commits inside the PR --
becomes the commit subject on main. Nothing validated it. commitlint
(ci.yml:429) lints a PR's commits and therefore cannot catch this by
construction: a PR with clean conventional commits and a prose title passes CI
and then lands a prose subject on main.

That is how 31452426 landed:

  Unify savings attribution across stats, perf, metrics, and dashboard (#2976)

release-please cannot parse it -- `unexpected token ' ' at 1:6`, because
`Unify` is five characters and position six is a space where the parser needs
`(`, `!` or `:`. The change is silently dropped from the changelog.

The check lives in pr-governance.py rather than ci.yml for two reasons: ci.yml's
pull_request trigger has no `edited` type, so a corrected title would never be
re-checked, and its paths-ignore skips docs-only PRs, which still squash-merge a
subject onto main. pr-health.yml already triggers on `edited` and reports through
the same governance comment the author is reading anyway.

Bot PRs keep their existing exemption; dependabot and release-please titles are
already conventional.

Validated against all 117 PRs opened in the last week: exactly one is flagged,
#2976 -- the one that jammed the release. No false positives.

The type vocabulary is asserted equal to .commitlintrc.json's type-enum, so the
two gates cannot drift apart.

The _event test helper gained the `title` field that a real pull_request
payload always carries; without it every existing case was exercising an
impossible shape.
2026-08-16 18:23:35 -07:00
..
test_changelog_gen.py chore: renormalize line endings to LF 2026-04-24 15:33:30 +02:00
test_ci_workflow.py fix(ci): restrict Codecov shard uploads (#2745) 2026-08-03 14:20:17 -07:00
test_pr_governance.py ci(governance): require a Conventional Commit PR title 2026-08-16 18:23:35 -07:00
test_pr_health_labels.py fix(codex): PR health label check state (#986) 2026-06-15 16:52:26 -05:00
test_pr_health_workflow.py ci: preserve merge labels while state is unknown 2026-07-09 19:51:41 -05:00
test_sync_plugin_versions.py test(scripts): cover branch-aware _should_sync in sync-plugin-versions 2026-05-19 12:49:21 -05:00
test_version_sync.py fix: publish headroom-opencode in release workflow (#2372) 2026-08-11 23:56:40 -05:00