fix(ay): CI-resilient P12 additivity/discipline diff tests#454
Conversation
The T-AY-014 additivity + T-AY-015 discipline-scan tests shelled out to `git diff next -- …`, which works in the dev worktree (local `next` branch) but ERRORS in CI's shallow PR checkout (no local `next` ref) — green locally, red in the PR CI (#453's unit job). Add a resolveBaseRef() that tries `next` then `origin/next` and returns null when neither is reachable; the diff-based legs `it.skipIf(BASE_REF===null)` / `describe.skipIf` so they run wherever a baseline exists (locally + base-fetched CI) and skip gracefully otherwise — never error. The mount-based render-additivity checks still run unconditionally. `BASE_REF!` (non-null) under the skip guard. 9/9 local; typecheck + lint 0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 641c0708b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| describe.skipIf(BASE_REF === null)('discipline scan — no added raw-HTML sink (TEST-AY-015 diff leg)', () => { | ||
| const added = addedSrcLines(); |
There was a problem hiding this comment.
Defer the diff read until the skipped tests run
In checkouts that lack both next and origin/next, BASE_REF is null, but Vitest still executes the describe.skipIf callback while collecting the suite. That means this eager addedSrcLines() call still runs and shells out to git diff null -- src, so the suite fails before any tests can be marked skipped—the same CI scenario this change is intended to tolerate. Move the diff computation inside guarded tests or make the helper return safely when the base ref is absent.
Useful? React with 👍 / 👎.
describe.skipIf only skips the it() runs — the describe factory body still executes at collection time, so addedSrcLines() ran `git diff <null> -- src` in CI's shallow checkout (no `next`/`origin/next` ref) and crashed the suite. Return [] when no baseline is reachable; the it bodies remain skipped. TEST-AY-015 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fix — P12 a11y diff tests fail in CI's shallow PR checkout
The P12
tests/ui/a11y/additivity.test.ts(T-AY-014) +disciplineScan.test.ts(T-AY-015) shelled out togit diff next -- ….nextis a local branch (present in the dev worktree → green locally) but absent in CI's shallow PR checkout → the git command errored → the unit job failed (PR #453'sTest (unit)step, exit 1). This passed local gates + slipped through (the merge landed on a red PR CI — see below).Fix
resolveBaseRef()triesnextthenorigin/next(git rev-parse --verify --quiet), returnsnullwhen neither is reachable.it.skipIf(BASE_REF === null)/describe.skipIf(...)— they run wherever a baseline ref exists (the dev worktree + any base-fetched CI) and skip gracefully otherwise, never erroring. The mount-based render-additivity checks (TabBar/FileChips/ImageThumb/ChatComposer default render) run unconditionally — those are the load-bearing CI assertions.Verify
vue-tsc0 ·eslint0 · the two suites 9/9 local. In CI (no localnext/origin/next) the 4 diff legs skip; the structural checks run.🤖 Generated with Claude Code