Skip to content

Commit afc3428

Browse files
NagyViktNagyViktclaude
authored
test(metadata): unblock 4 stale assertions after the budget-friendly trims (#576)
The four metadata.test.js failures predated this PR — three are stale assertions that drifted out of sync with intentional repo changes, one is a legitimately missing release-notes entry for v7.0.43. - Add `### v7.0.43` release-notes section covering the budget-friendly CI templates, gx ci-init, gx budget, label-based opt-in, and the pre-flight gate in gx branch finish. - Loosen the cosign-installer assertion from `# v4.1.1` to `# v4.1.\d+` so a patch bump (already present at v4.1.2) doesn't break the gate; major/minor bumps still do. - Split the "About copy + problem-solution visuals" test into two: - keep enforcing the problem/solution image links in README - retire the README->about_description.txt link assertion that PR #564 obsoleted; package.json description must still match about_description.txt - Split the "CI and CodeQL workflows run on PRs" test into two: - keep the CI-on-PR check (still required) - replace the CodeQL-on-PR check with a schedule + workflow_dispatch + "no pull_request trigger" check matching the post-PR-#571 reality Verification: `node --test test/metadata.test.js` now reports 27/27 passing (was 21/25 before this PR). Co-authored-by: NagyVikt <nagy.viktordp@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 795af11 commit afc3428

4 files changed

Lines changed: 76 additions & 9 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,32 @@ Being honest about where this still has issues:
308308
<details open>
309309
<summary><strong>v7.x</strong></summary>
310310

311+
### v7.0.43
312+
- Budget-friendly CI defaults for gitguardex-managed projects: live
313+
workflows drop `push: main`, gate per-PR jobs on `pull_request.draft
314+
== false`, add `concurrency: cancel-in-progress`, and split per-runtime
315+
matrix coverage into a weekly `ci-full.yml`. CodeQL and Scorecard run
316+
on the weekly schedule + `workflow_dispatch` only. Templates under
317+
`templates/github/workflows/` carry the same posture so downstream
318+
projects inherit it via `gx setup`.
319+
- New `gx ci-init` subcommand scaffolds `ci.yml`, `ci-full.yml`, `cr.yml`,
320+
and a `README.md` budget-posture guide into a target repo's
321+
`.github/workflows/` directory. Supports `--target`, `--dry-run`,
322+
`--force`, `--no-stage`, and `--json`.
323+
- New `gx budget` subcommand wraps the new GitHub
324+
`/settings/billing/usage` endpoint (the legacy
325+
`/settings/billing/actions` endpoint was retired in early 2026) and
326+
reports monthly Actions minute spend with warn/critical USD thresholds
327+
per `--org` or `--user`.
328+
- Per-PR label opt-in for `agent/*` lanes: `needs-review` runs AI code
329+
review on an otherwise-skipped agent PR; `needs-ci-full` triggers the
330+
full cross-runtime matrix without waiting for the weekly schedule.
331+
- `gx branch finish` runs `scripts/agent-preflight.sh` in the worktree
332+
before pushing. Default script auto-detects pnpm/npm, Rust, and Python
333+
stacks and refuses the push on verification failure. After pre-flight
334+
passes, draft PRs are promoted to ready-for-review so the
335+
budget-friendly CI defaults fire once on a known-passing commit.
336+
311337
### v7.0.42
312338
- Bumped `@imdeadpool/guardex` from `7.0.41` to `7.0.42` so the current
313339
`main` payload can publish under a fresh npm version after `7.0.41` reached
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-05-14
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# agent-claude-fix-metadata-test-stale-assertions-2026-05-14-02-09 (minimal / T1)
2+
3+
Branch: `agent/<your-name>/<branch-slug>`
4+
5+
Describe the change in a sentence or two. Commit message is the spec of record.
6+
7+
## Handoff
8+
9+
- Handoff: change=`agent-claude-fix-metadata-test-stale-assertions-2026-05-14-02-09`; branch=`agent/<your-name>/<branch-slug>`; scope=`TODO`; action=`continue this sandbox or finish cleanup after a usage-limit/manual takeover`.
10+
- Copy prompt: Continue `agent-claude-fix-metadata-test-stale-assertions-2026-05-14-02-09` on branch `agent/<your-name>/<branch-slug>`. Work inside the existing sandbox, review `openspec/changes/agent-claude-fix-metadata-test-stale-assertions-2026-05-14-02-09/notes.md`, continue from the current state instead of creating a new sandbox, and when the work is done run `gx branch finish --branch agent/<your-name>/<branch-slug> --base dev --via-pr --wait-for-merge --cleanup`.
11+
12+
## Cleanup
13+
14+
- [ ] Run: `gx branch finish --branch agent/<your-name>/<branch-slug> --base dev --via-pr --wait-for-merge --cleanup`
15+
- [ ] Record PR URL + `MERGED` state in the completion handoff.
16+
- [ ] Confirm sandbox worktree is gone (`git worktree list`, `git branch -a`).

test/metadata.test.js

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ test('release workflow publishes with provenance in CI', () => {
3232
const workflow = fs.readFileSync(workflowPath, 'utf8');
3333
assert.match(workflow, /name:\s+Checkout\s+uses:\s+actions\/checkout@[0-9a-f]{40}[^\n]*\n\s+with:\s*\n\s+fetch-depth:\s+0/s);
3434
assert.match(workflow, /npm publish --provenance --access public/);
35-
assert.match(workflow, /name:\s+Install Cosign\s+uses:\s+sigstore\/cosign-installer@[0-9a-f]{40}[^\n]*# v4\.1\.1/s);
35+
// Cosign installer must be pinned to a 40-char SHA on the v4.1.x line.
36+
// The patch version floats so a renovate/dependabot bump
37+
// (e.g. v4.1.1 -> v4.1.2) doesn't break this gate; a major or minor
38+
// bump still does.
39+
assert.match(workflow, /name:\s+Install Cosign\s+uses:\s+sigstore\/cosign-installer@[0-9a-f]{40}[^\n]*# v4\.1\.\d+/s);
3640
});
3741

3842
test('release workflow skips publish when the current version is already on npm', () => {
@@ -108,11 +112,19 @@ test('README advertises the repo skills installer path and root skills stay in s
108112
}
109113
});
110114

111-
test('README keeps canonical About copy and problem-solution visuals aligned', () => {
112-
const readme = fs.readFileSync(readmePath, 'utf8');
115+
test('package description stays aligned with about_description.txt', () => {
116+
// The README "Package summary" paragraph and link to about_description.txt
117+
// were intentionally removed in PR #564 to declutter the top of the file;
118+
// this test no longer enforces their presence. What still matters: the npm
119+
// package description and the standalone about_description.txt file are the
120+
// canonical About copy and must not drift apart.
113121
const aboutDescription = fs.readFileSync(aboutDescriptionPath, 'utf8').trim();
114122
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
123+
assert.equal(pkg.description, aboutDescription);
124+
});
115125

126+
test('README keeps the problem-solution visuals aligned', () => {
127+
const readme = fs.readFileSync(readmePath, 'utf8');
116128
assert.match(
117129
readme,
118130
/## The problem\s+!\[Parallel agents colliding in the same files\]\(https:\/\/raw\.githubusercontent\.com\/recodeee\/gitguardex\/main\/docs\/images\/problem-agent-collision\.svg\)/s,
@@ -121,9 +133,6 @@ test('README keeps canonical About copy and problem-solution visuals aligned', (
121133
readme,
122134
/### Solution\s+!\[Agent branch\/worktree start protocol\]\(https:\/\/raw\.githubusercontent\.com\/recodeee\/gitguardex\/main\/docs\/images\/workflow-branch-start\.svg\)/s,
123135
);
124-
assert.match(readme, /\[about_description\.txt\]\(\.\/about_description\.txt\)/);
125-
assert.match(readme, new RegExp(escapeRegexLiteral(aboutDescription)));
126-
assert.equal(pkg.description, aboutDescription);
127136
});
128137

129138
test('security workflows are present and use pinned GitHub Actions SHAs', () => {
@@ -143,11 +152,25 @@ test('security workflows are present and use pinned GitHub Actions SHAs', () =>
143152
}
144153
});
145154

146-
test('CI and CodeQL workflows run on pull requests targeting main', () => {
155+
test('CI workflow runs on pull requests targeting main', () => {
147156
const ciWorkflow = fs.readFileSync(path.join(repoRoot, '.github', 'workflows', 'ci.yml'), 'utf8');
148-
const codeqlWorkflow = fs.readFileSync(path.join(repoRoot, '.github', 'workflows', 'codeql.yml'), 'utf8');
149157
assert.match(ciWorkflow, /pull_request:\s*\n\s*branches:\s*\n\s*-\s*main/s);
150-
assert.match(codeqlWorkflow, /pull_request:\s*\n\s*branches:\s*\n\s*-\s*main/s);
158+
});
159+
160+
test('CodeQL workflow runs on a weekly schedule, not per-PR', () => {
161+
// PR #571 dropped per-PR / per-push triggers from codeql.yml as part of
162+
// the budget-friendly trim. CodeQL is the single most expensive workflow
163+
// per run on this repo, and the weekly schedule + `workflow_dispatch`
164+
// covers security coverage without compounding the monthly Actions bill
165+
// across every agent PR. Re-add a `pull_request:` trigger here only if
166+
// your project specifically needs per-PR CodeQL gating for compliance.
167+
const codeqlWorkflow = fs.readFileSync(
168+
path.join(repoRoot, '.github', 'workflows', 'codeql.yml'),
169+
'utf8',
170+
);
171+
assert.match(codeqlWorkflow, /schedule:\s*\n\s*-\s*cron:/s);
172+
assert.match(codeqlWorkflow, /workflow_dispatch:/);
173+
assert.doesNotMatch(codeqlWorkflow, /\n\s*pull_request:\s*\n/s);
151174
});
152175

153176
test('code review workflow does not gate startup on secrets context', () => {

0 commit comments

Comments
 (0)