Commit Graph
3 Commits
Author SHA1 Message Date
Beenu AroraandBeenu Arora e78f31768c Move all fourteen ruff declarations to 0.16, and stop the lint gate at services/ (#861)
* Reformat the tree under ruff 0.16, excluding the subtree nobody may edit

Mechanical. `ruff format` with no other change, so the diff can be read as
"the formatter moved" rather than reviewed line by line: 218 files, 862
insertions against 1075 deletions, almost all of it collapsing calls that
0.4.10 wrapped and 0.16 fits inside the 140-column limit.

`plans/` is excluded in `ruff.toml` rather than reformatted. It is the
archived prototype subtree that `.github/workflows/codeql.yml` already
excludes and `scripts/check_mypy_baseline.py` excludes from every coverage
direction, and the project rules forbid editing anything under it -- so
formatting it would be a diff nobody may take. 844 lint findings and ~280
unformatted files live there. They are excluded because they cannot be
fixed, which is a different statement from saying the code is clean.

* Move all fourteen ruff declarations to 0.16, and stop the lint gate at services/

The bump alone reds every open pull request: `ruff format --check` is a hard
gate on the required `Python - Lint & Type-check` job and 0.16 formats
differently from 0.4.10. The reformat is the previous commit; this one moves
the pin, fixes the findings, and answers the scope question.

Fourteen declarations now read `>=0.16.8,<0.17` -- seven manifests, three
workflows, `.devcontainer/Dockerfile`, and the three `poetry.lock` files that
resolve it (now 0.16.9, which is byte-identical to 0.16.8 on both format and
lint across this tree).

The three findings 0.16 reports on `services/` are fixed, not suppressed: two
`C420` comprehensions become `dict.fromkeys` (both values are string literals,
so the shared-value hazard does not apply) and one `UP031` percent-format
becomes an f-string in a test that counts characters. All three rewrites were
asserted equal to the originals before being kept.

Scope. `ruff check services/` left `scripts/` -- every CI gate in this
repository, the code the rest of its claims are verified by -- linted by
nothing. Lint now covers `services/ scripts/ tests/ tools/`, the trees the
root `ruff.toml` governs that nothing else lints, and `ruff format --check .`
covers everything, because formatting has no semantic content and `.` needs
no edit when a tree is added. That surfaced 17 findings outside `services/`,
each fixed at the source: two `B007` loops switched to `.values()`, a `B904`
re-raise in `security_audit.py` now chains `from exc`, two `E402` imports
that genuinely follow a `sys.path` mutation carry a reason next to the
marker, and two over-length lines were wrapped.

`E501` is ignored for the two detection-spec data modules. Both open their
rule table with `# fmt: off`, so the formatter is already opted out of that
layout deliberately, and all 199 long lines are single dict or string
literals -- 72 positive fixtures, 66 negative, 50 `match_when` clauses, 11
descriptions. Two named files, not `scripts/`.

`packages/` and `plugins/` stay outside the lint gate, and the gap is a
number rather than a shrug: 91 findings and 2. Two of the five packages are
linted by their own workflows under their own configs, and bringing the
three published SDKs under this gate means behaviour-touching fixes that
belong in a change reviewed as such.

* Make packages/aisoc-detections clean under the ruff its own workflow now installs

`python-detections.yml` lints `aisoc_detections detections tests` under the
pin this PR moved, so the package has to be clean under 0.16 too. Two
findings, both fixed at the source rather than silenced: `Callable` moves to
`collections.abc`, and a `# noqa: BLE001` that 0.16 correctly reports as
unused becomes the sentence it was standing in for -- a detection module is
third-party content, so any exception at import is the author's and becomes a
DetectionError naming the file.

---------

Co-authored-by: Beenu Arora <beenu@MacBook-Pro-3.local>
2026-09-24 19:36:59 -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