Skip to content

fix(ci): unblock main formatter + harden auto-commit step#4901

Merged
onsclom merged 3 commits into
mainfrom
martha/oss-131-fix-red-formatter-ci-on-main-copilotkit
May 18, 2026
Merged

fix(ci): unblock main formatter + harden auto-commit step#4901
onsclom merged 3 commits into
mainfrom
martha/oss-131-fix-red-formatter-ci-on-main-copilotkit

Conversation

@marthakelly

Copy link
Copy Markdown
Contributor

Summary

Main has been red on static / quality → format since 2026-05-18 14:24Z. The first red push was the merge of PR #4879, and every push since has stayed red on the same 12 unformatted files under showcase/integrations/{langgraph-python,langgraph-typescript}.

This PR does two things:

  1. Unblocks main — runs oxfmt --write against the 12 files the push-scope check is failing on. Pure formatting (key reordering, line wrapping); no behavior changes.

  2. Hardens the format job's auto-commit stepCommit formatting fixes previously fed git diff --name-only into git add. If a tracked-but-gitignored path showed up in the diff, git add refused it and the whole step aborted (exit 123), so the auto-fix commit never reached the PR branch. That's how fix(showcase): align LangGraph TypeScript demos to LangGraph Python gold standard #4879 was merged with 12 unformatted files: the PR's oxfmt --write had fixed them, but the auto-commit blew up on showcase/aimock/d5-recorded/recorded and the fixes were never pushed back.

The step now stages only paths from .pr-format-files.existing.txt — the same scoped list the formatter operates on — so unrelated working-tree diffs can no longer poison the commit.

Verification

  • oxfmt --check . passes on this branch (9152 files).
  • After merge, the next static / quality push run on main should go green.

Follow-ups (out of scope)

  • Make format a required status check on main so a red format job blocks merge.
  • Decide whether showcase/aimock/d5-recorded/recorded should be untracked or its ignore rule adjusted.

The format job's "Commit formatting fixes" step previously fed the raw
`git diff --name-only` output into `git add`. If a tracked-but-gitignored
path (e.g. a build artifact) appeared in the diff, `git add` refused the
ignored path and aborted the step, so the auto-fix commit never landed
on the PR branch. PRs could then merge with formatting violations still
present, leaving main red on the post-merge push-scope check.

Stage only the paths listed in `.pr-format-files.existing.txt` — the
same scoped set the formatter operates on — so unrelated diffs in the
working tree can't poison the commit.
@linear

linear Bot commented May 18, 2026

Copy link
Copy Markdown

OSS-131

@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat-with-your-data Ready Ready Preview, Comment May 18, 2026 9:20pm
docs Ready Ready Preview, Comment May 18, 2026 9:20pm
form-filling Ready Ready Preview, Comment May 18, 2026 9:20pm
research-canvas Ready Ready Preview, Comment May 18, 2026 9:20pm
travel Ready Ready Preview, Comment May 18, 2026 9:20pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies

@onsclom
onsclom merged commit 5017b0f into main May 18, 2026
25 checks passed
@onsclom
onsclom deleted the martha/oss-131-fix-red-formatter-ci-on-main-copilotkit branch May 18, 2026 21:31
marthakelly added a commit that referenced this pull request May 18, 2026
## Summary

Follow-up to #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 #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 #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-#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 #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.
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