Skip to content

chore(workflow): harden deck-contribute verify + commit hygiene - #5829

Open
ntindle wants to merge 4 commits into
phase-rs:mainfrom
ntindle:chore/workflow-verify-commit-hygiene
Open

chore(workflow): harden deck-contribute verify + commit hygiene#5829
ntindle wants to merge 4 commits into
phase-rs:mainfrom
ntindle:chore/workflow-verify-commit-hygiene

Conversation

@ntindle

@ntindle ntindle commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Why

Three set-agnostic rough edges in the deck-contribute workflow's verify + commit steps, surfaced while running the pipeline at volume. None are card- or set-specific.

What

1. Gate A now uses the explicit upstream/main merge-base.
./scripts/check-parser-combinators.sh defaults to the stale fork origin/main as its base, so it diffs the whole tree and false-flags pre-existing nom-combinator debt in files the change never touched. Passing "$(git merge-base upstream/main HEAD)" scopes it to the change's own lines.

2. Enum-variant verification note.
When a change adds/removes a variant on an engine enum (Effect, TriggerMode, StaticCondition, GameEvent, EffectKind), phase-ai and engine-wasm match those enums exhaustively. A -p engine-only check can't observe a non-exhaustive-match break in those crates that fails CI's Rust-lint / WASM-compile jobs. The note keeps clippy workspace-wide (never narrowed to -p engine) and adds cargo test -p phase-ai.

3. Discard build-regenerated data artifacts before git add -A.
crates/engine/data/known-tokens.toml, data/engine-inventory.json, and crates/engine/data/oracle-subtypes.json are regenerated destructively by a local/partial mtgjson env. git add -A swept them into commits, producing large drift diffs that conflict with main and aren't CI-checked. The step now discards them (and verifies none are staged) before committing.

How

Prompt-text only in .claude/workflows/deck-contribute.js — no behavioral code, no card data. node --check passes.

- Gate A (check-parser-combinators.sh) now takes the explicit upstream/main
  merge-base; the script's default base is the stale fork origin/main, which
  false-flags pre-existing nom-combinator debt in untouched files.
- Enum-variant note: keep clippy workspace-wide (never -p engine) and also
  test -p phase-ai, since phase-ai/engine-wasm match engine enums exhaustively
  and a -p engine check misses non-exhaustive-match breaks that fail CI.
- Discard build-regenerated data artifacts (known-tokens.toml,
  engine-inventory.json, oracle-subtypes.json) before 'git add -A' — a local
  mtgjson env regenerates them destructively, producing large drift diffs that
  conflict with main and are not CI-checked.

Set-agnostic workflow hardening surfaced while running the pipeline at volume.
@ntindle
ntindle requested a review from matthewevans as a code owner July 14, 2026 18:15

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the deck-contribute workflow to refine verification and PR creation steps, including scoping the parser combinator check to the correct merge-base and adding instructions for workspace-wide clippy checks. However, a critical issue was found in the added git checkout command where a trailing dot would destructively discard all unstaged changes in the current directory, wiping out the card implementation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread .claude/workflows/deck-contribute.js Outdated
The discard step read 'git checkout -- <files> 2>/dev/null .' — the trailing
dot (intended as sentence punctuation) is a pathspec argument that would
discard the ENTIRE working tree, including the card implementation. Terminate
the command at 2>/dev/null and add an explicit warning never to append a bare
'.'. Caught by Gemini review.
@ntindle

ntindle commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Good catch — that's a genuine working-tree-wiping bug, exactly the kind this PR is meant to prevent. The trailing . in git checkout -- <files> 2>/dev/null . was sentence punctuation that reads as a pathspec, so it would have discarded every unstaged change including the card fix. Fixed in 5bb085b: the command now terminates at 2>/dev/null, plus an explicit warning never to append a bare ..

@matthewevans matthewevans self-assigned this Jul 14, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Requested changes

The original Gemini finding (the trailing . pathspec) is fixed at the current head. I found three remaining issues that need correction before merge.

  1. [HIGH] The generated-artifact cleanup command fails in the normal worktree.

    data/engine-inventory.json is ignored (data/*) and not tracked, so the command at .claude/workflows/deck-contribute.js:483 exits with pathspec 'data/engine-inventory.json' did not match any file(s) known to git. Its 2>/dev/null hides the failure, after which git add -A still runs. Do not include an ignored path in the git checkout/git restore pathspec; handle it separately (or omit it, since git add -A respects .gitignore) and let restoration of the two tracked files fail loudly.

  2. [MED] Do not permit a non-zero Gate A result based on changed-file membership.

    The explicit upstream/main merge-base correctly scopes the diff-based checks, but scripts/check-parser-combinators.sh also runs the whole-file Gate G before the diff scan. The new text at deck-contribute.js:442 permits treating that failure as non-blocking if its line is outside the current change. Remove that exception: any non-zero gate result must fail verification.

  3. [MED] Keep AI/WASM verification Tilt-first when Tilt is active.

    The note at deck-contribute.js:446-450 unconditionally asks for cargo test -p phase-ai, including after the preceding branch has detected a running Tilt. Use the test-ai and wasm Tilt resources in that branch; reserve direct cargo test -p phase-ai for the no-Tilt fallback to avoid cargo target-lock contention.

Please update these instructions and rerun the relevant syntax/verification checks.

@matthewevans matthewevans added the bug Bug fix label Jul 17, 2026
@matthewevans matthewevans removed their assignment Jul 17, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocked — this external PR changes protected CI and agent-instruction surfaces, so it cannot proceed through contributor handling.

🔴 Blocker

  • .github/workflows/ci.yml:27-30 changes the protected Rust-lint job timeout, and .claude/workflows/deck-contribute.js:430-468 changes agent workflow instructions, including verification and generated-artifact handling. The review policy treats both paths as hard-stop surfaces because they affect CI execution and future agent behavior across the repository. This routing decision deliberately does not assess the implementation content.

Recommendation: request changes — split any product/code contribution into a PR with no .github/workflows/** or .claude/** edits; route workflow or agent-policy changes through explicit maintainer review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants