Skip to content

fix(ay): CI-resilient P12 additivity/discipline diff tests#454

Merged
Luis85 merged 2 commits into
nextfrom
fix/a11y-ci-baseline-ref
May 27, 2026
Merged

fix(ay): CI-resilient P12 additivity/discipline diff tests#454
Luis85 merged 2 commits into
nextfrom
fix/a11y-ci-baseline-ref

Conversation

@Luis85
Copy link
Copy Markdown
Owner

@Luis85 Luis85 commented May 27, 2026

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 to git diff next -- …. next is 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's Test (unit) step, exit 1). This passed local gates + slipped through (the merge landed on a red PR CI — see below).

Fix

  • resolveBaseRef() tries next then origin/next (git rev-parse --verify --quiet), returns null when neither is reachable.
  • The diff-based legs use 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-tsc 0 · eslint 0 · the two suites 9/9 local. In CI (no local next/origin/next) the 4 diff legs skip; the structural checks run.

Follow-up to P12 (#453), which merged on a spuriously-green watch. This greens next.

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +54 to 55
describe.skipIf(BASE_REF === null)('discipline scan — no added raw-HTML sink (TEST-AY-015 diff leg)', () => {
const added = addedSrcLines();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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>
@Luis85 Luis85 merged commit d2e9b6b into next May 27, 2026
6 checks passed
@Luis85 Luis85 deleted the fix/a11y-ci-baseline-ref branch May 27, 2026 02:28
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.

2 participants