Skip to content

test(cockpit-e2e-wiring): scope:* tag drift-guard (PR 3/3)#509

Merged
blove merged 1 commit into
mainfrom
claude/ci-scope-drift-guard
May 21, 2026
Merged

test(cockpit-e2e-wiring): scope:* tag drift-guard (PR 3/3)#509
blove merged 1 commit into
mainfrom
claude/ci-scope-drift-guard

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 21, 2026

Summary

PR 3 of 3 for the ci-scope thin-shim migration. Adds a third `it()` block to `apps/cockpit/cockpit-e2e-wiring.spec.ts` asserting that every cockpit cap project declares the `scope:*` tags the shim relies on.

What it guards against

  • Every `cockpit///{angular,python}/project.json` must include `scope:cockpit-e2e` + `scope:cockpit-examples`.
  • Python caps with a `smoke` target must also include `scope:cockpit-smoke`.
  • `cockpit/ag-ui/*` excluded (no python sibling; different rules).

Without this, a future contributor adding a new cap could silently forget the tags — their CI would underfire and we'd only catch it when something breaks downstream.

Closes the migration arc

Test plan

  • CI `Cockpit — build / test` passes (the wiring spec runs there).
  • Spec catches it locally if you delete a `scope:cockpit-e2e` tag from any cap.

🤖 Generated with Claude Code

PR 3 of 3 for the ci-scope thin-shim migration. PR 1 (#503) added
scope:* tags to every CI-participating project; PR 2 (#507) rewrote
ci-scope.mjs to read them via `nx show projects --affected --json`.
This drift-guard asserts every cockpit cap project (angular + python
under cockpit/<product>/<topic>/) declares the expected tags:

- scope:cockpit-e2e + scope:cockpit-examples on every cap project.
- scope:cockpit-smoke on python caps that have a smoke target.

Closes the silent-failure mode: future contributors adding a new cap
can't forget the tags — the test names which project + which tag is
missing.

Excludes cockpit/ag-ui/* (no python sibling; different tag rules).

See spec: docs/superpowers/specs/2026-05-21-ci-scope-thin-shim-design.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment May 21, 2026 5:36pm

Request Review

@blove blove merged commit b8c0607 into main May 21, 2026
39 checks passed
blove added a commit that referenced this pull request May 25, 2026
The cockpit-e2e-wiring drift-guard test (PR #509) walked each cap and
asserted ci.yml contained literal references to the cap's project
name AND a `working-directory:` or `python:` entry for its python
sibling. The hardcoded 24-cap matrix satisfied both checks.

With the dispatcher pattern (this PR), neither literal appears in
ci.yml — the matrix is templated as
`cap: ${{ fromJson(needs.cockpit-e2e-dispatcher.outputs.caps) }}`
and the dispatcher's emitted JSON covers every cap by definition.

The test now short-circuits to "satisfied" when it detects the
`fromJson(needs.cockpit-e2e-dispatcher.outputs.caps)` token in the
workflow. Non-dispatcher workflows (e.g. future per-cap jobs) still
get the original literal-reference checks.

79/79 cockpit unit tests passing locally.
blove added a commit that referenced this pull request May 25, 2026
* docs(spec): dynamic cockpit-e2e matrix design

* docs(plan): dynamic cockpit-e2e matrix implementation plan

* feat(ci): pure selectCockpitCaps classifier for dynamic matrix

Returns affected cockpit caps when fullFleet=false, or all caps when
fullFleet=true. Preserves the order of the allCockpitCaps argument.

CLI wrapper that runs nx queries + writes $GITHUB_OUTPUT lands in
the next commit. Spec at
docs/superpowers/specs/2026-05-23-dynamic-cockpit-e2e-matrix-design.md.

7/7 unit tests passing via node --test.

* feat(ci): CLI wrapper for cockpit-matrix script

Derives cockpit caps by walking cockpit/ directly and reading
project.json files from disk — ~100x faster than per-project nx CLI
calls (avoids the 32-cap sequential 'nx show project --json' tax
that would have made the dispatcher job take 3-5 min instead of
seconds).

Each cap is paired with its python sibling path via the directory
convention (cockpit/<topic>/<cap>/{angular,python}).

CLI args: --base, --head, --full-fleet. Writes 'caps=<json>' to
\$GITHUB_OUTPUT (or stdout for local debugging).

Empty-affected fallback: when --full-fleet is false but nx affected
didn't attribute any cockpit cap (lib fanout case), emits all caps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ci(perf): dynamic cockpit-e2e matrix via dispatcher job

Replaces the hardcoded 24-cap matrix with one emitted by a new
cockpit-e2e-dispatcher job. The dispatcher runs scripts/cockpit-matrix.mjs
which derives caps from nx affected + project-graph metadata.

- PR touching 1 cap angular dir → 1 matrix entry (~46 CI-min saved vs
  today's 24-runner fan-out).
- PR touching libs/chat (fanout) → all 24 caps run via the
  empty-affected fallback in cockpit-matrix.mjs.
- Push to main → all 24 caps run (--full-fleet=true).

Also wires scripts/cockpit-matrix.spec.mjs into the ci-scope test job so
the 7 new unit tests gate PRs.

The cockpit-e2e-summary job is unchanged — needs.cockpit-e2e.result
correctly aggregates matrix outcomes.

Spec: docs/superpowers/specs/2026-05-23-dynamic-cockpit-e2e-matrix-design.md
Plan: docs/superpowers/plans/2026-05-23-dynamic-cockpit-e2e-matrix.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(cockpit): drift-guard recognizes dispatcher matrix pattern

The cockpit-e2e-wiring drift-guard test (PR #509) walked each cap and
asserted ci.yml contained literal references to the cap's project
name AND a `working-directory:` or `python:` entry for its python
sibling. The hardcoded 24-cap matrix satisfied both checks.

With the dispatcher pattern (this PR), neither literal appears in
ci.yml — the matrix is templated as
`cap: ${{ fromJson(needs.cockpit-e2e-dispatcher.outputs.caps) }}`
and the dispatcher's emitted JSON covers every cap by definition.

The test now short-circuits to "satisfied" when it detects the
`fromJson(needs.cockpit-e2e-dispatcher.outputs.caps)` token in the
workflow. Non-dispatcher workflows (e.g. future per-cap jobs) still
get the original literal-reference checks.

79/79 cockpit unit tests passing locally.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant