3 Commits
Author SHA1 Message Date
Beenu AroraandBeenu Arora f3348223a8 Five gates said OK over nothing; the probe that found them is now a gate (#823)
* Five gates said OK over nothing; the probe that found them is now a gate

Copying scripts/ into an empty git repository and running every wired check
found five reporting OK over a tree containing nothing: the detection
validator behind the rule count on the front page certifying zero rules as
valid, a dashboard check that failed on an empty directory and passed on a
missing one, "OK: 0 published Go module path(s)", every self-link healthy
over zero files, and a health-probe audit printing a table header and
exiting 0. Those five were fixed. The probe was a one-off, so the next gate
written could reintroduce the defect freely.

scripts/check_gate_contract.py is that probe made permanent. It runs all 69
inventoried checks the way a workflow runs each one, inside a git repository
holding only scripts/, and requires each to exit non-zero. The inventory
comes from check_gate_coverage.py rather than a second scanner here, because
two scanners drift the first time either learns something the other has not.
A run that failed for a reason the empty tree did not cause is INCONCLUSIVE
and fails rather than counting as a refusal. Every way CI runs a script is
probed and the worst result decides, because four subcommands under one name
are four gates.

Two properties come with it, both enforced with empty exception lists: a
root resolved through git rather than from __file__, and a declared
--self-test. Sixty of sixty-nine did the former; fifty-four lacked the
latter. scripts/gate_toolkit.py holds the single implementation of both.

Found while building it:

- check_gate_coverage.py decided "inspects the repository" partly by looking
  for Path(__file__) -- the idiom being migrated away from -- so moving six
  gates onto the shared resolver dropped them out of the inventory.
- The first spelling of the root property matched repo_root anywhere in the
  text, and check_gate_coverage.py emits it as a JSON key, so a gate rooted
  at __file__ read as compliant on a key in its own output.
- check_route_tenant_scope.py printed "scanned 0 routes across 0 files" and
  then "OK: every route taking a tenant identifier authenticates" against a
  services/ tree with no routes in it.
- security_audit.py's pnpm, python and go arms each printed "0 findings"
  over a tree with no manifests, and get_repo_root() fell back to cwd.

* Make every gate find gate_toolkit however it is loaded

Five CI jobs failed with ModuleNotFoundError: No module named 'gate_toolkit'.
Sixteen test modules load a gate with importlib.util.spec_from_file_location,
which executes the file without putting its directory on sys.path — so the
scripts were importable as programs and not as modules, and the scripts that
already import a sibling carry the same tweak for the same reason.

Each gate now inserts its own directory before the import. Also corrects the
claim-to-gate tally in the compliance evidence pack, which quotes it in prose
and was the second place the figure lives.

---------

Co-authored-by: Beenu Arora <beenu@MacBook-Pro-3.local>
2026-09-24 08:08:57 -07:00
c4a4e0bc52 fix(ci): give the breaking-change gate the escape hatch it documents (#799)
The workflow header told a maintainer to "re-run with --allow-breaking" and
openapi_diff.py claimed the flag was what "the release flow uses". Neither was
true: the workflow triggered on pull_request only, with no dispatch, no input
and no label check, and the diff step never passed the flag. --allow-breaking
had no caller anywhere in the tree, so a maintainer facing a correct,
deliberate break had no action that worked.

The hatch is now a PR label, breaking-change-approved, rather than a
workflow_dispatch boolean: applying a label leaves an attributable record of
who authorised the break and when on the PR timeline, and the job reads that
timeline and names the approver. It re-runs on labeled/unlabeled so the label
takes effect immediately instead of waiting for the next push.

Approval is not a skip. --allow-breaking now requires --changelog and
--changelog-base, so it cannot be wired up without also wiring up the thing
that records what was approved. The detector still runs and the job summary
lists every permitted break beside the CHANGELOG note justifying it. The
approval is refused when there is no "### BREAKING" section under
"## [Unreleased]", or when that section is byte-identical to the base
branch's -- checked both ways, since "a section exists" would let the first
note in a release cycle excuse every later break in it.

The version-bump half of the old promise is dropped rather than implemented:
this repo accumulates under [Unreleased] and bumps VERSION at release-cut, so
a per-PR version check would demand something no PR can correctly do.

Thirteen new tests, all failing against the pre-change tree. Four assert the
workflow YAML itself reaches the flag -- a unit-tested function with no caller
is indistinguishable from a working feature until something asserts the call.

Co-authored-by: Beenu Arora <beenu@MacBook-Pro-3.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-23 22:08:03 -07:00
e5b839e965 feat(phase-11): OpenAPI breaking-change gate (#436)
check-openapi.yml proved drift; it had no breaking-change semantics — a PR
could delete an endpoint / remove a response field / tighten a request /
drop an enum value with CI green while every generated SDK client broke.

- scripts/openapi_diff.py (pyyaml-only): classifies changes between two
  specs as breaking/non-breaking from an existing client's view (removed
  path/operation/schema/property, type change, optional->required, new
  required request field, removed enum value, new required param).
- openapi-breaking.yml: diffs the PR spec vs the base branch and fails on
  breaking changes; deliberate breaks ship with a version bump +
  --allow-breaking.
- tests/test_openapi_diff.py: 15 tests — every breaking class caught AND
  safe additive changes not flagged.
- Matrix: OpenAPI NO GATE -> GATED; ratchet lowered 2 -> 1
  (15 GATED / 11 PARTIAL / 1 NO GATE).

11b: per-language SDK generated-client contract-drift.

Co-authored-by: Beenu Arora <beenu@MacBook-Pro.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 10:26:16 -07:00