Commit 83e1911
authored
ci(format): really fix the gitignored-path auto-commit poison (CopilotKit#4904)
## Summary
Follow-up to CopilotKit#4901. That PR unblocked main with the 12-file format fix,
but the workflow change it shipped doesn't actually fix the underlying
bug — the auto-commit step is still poisoned the moment any
tracked-but-gitignored path lands in a PR's diff.
This PR does the real fix and proves it on real CI.
## Why CopilotKit#4901's workflow change wasn't enough
`xargs -a .pr-format-files.existing.txt git add --` stages files from
the same list oxfmt was scoped to. But the collection step picks up
tracked-but-gitignored paths (e.g.
`showcase/aimock/d5-recorded/recorded/openai-*.json` — they match
`*.json`, are tracked, but sit under a `recorded/` ignore rule). Those
paths end up in `.pr-format-files.existing.txt`, oxfmt rewrites them,
`git add` still refuses them with the "ignored by one of your .gitignore
files" warning and `exit 1`, and the step still aborts. Same failure
mode as CopilotKit#4879.
## The real fix
Filter `.pr-format-files.existing.txt` against `git ls-files -i -c
--exclude-standard` — the authoritative list of tracked-but-ignored
paths — in the collection step. Three effects:
1. oxfmt no longer rewrites scratch files (correct semantic: `recorded/`
is recording-session scratch per its own .gitignore comment).
2. `git diff --name-only` after the formatter run won't contain any
ignored paths attributable to oxfmt.
3. The auto-commit's `git add` only sees non-ignored paths, can't choke.
## Verification
**Local** (already done in the working branch):
| Setup | git add behavior |
|---|---|
| Pipe ignored fixture path → git add | `exit 1`, "ignored by
.gitignore" |
| Pipe mixed list (fixture + real source) → git add | `exit 1`, only
real source actually stages, but exit 1 still kills `set -e` step |
| Filter the list first via `ls-files -i -c`, then git add | `exit 0`,
only real source stages, no warning |
**Real CI** (this PR):
The second commit deliberately steps on both halves of the failure mode:
- A `recorded/openai-*.json` fixture is dirty in the PR diff
(tracked-but-ignored path).
- One source file (`prebuilt-popup.spec.ts`) is reverted to its
pre-CopilotKit#4901 unformatted state (forces oxfmt to do real work and the
auto-commit path to run).
Without the filter, the format job would die at `git add` exactly the
way CopilotKit#4879 did. With the filter, the source file gets auto-fixed and the
auto-commit lands cleanly.
## Merge plan
If CI is green, drop the `test:` commit (and the auto-fix commit it
triggers) with `git reset --hard <fix-sha>` and force-push so only the
workflow change lands on main.1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
| |||
0 commit comments