Skip to content

fix(cli): ship .gitattributes entries from fern replay init to Fiddle#15504

Merged
fern-support merged 2 commits intomainfrom
fix/replay-init-ship-gitattributes
Apr 28, 2026
Merged

fix(cli): ship .gitattributes entries from fern replay init to Fiddle#15504
fern-support merged 2 commits intomainfrom
fix/replay-init-ship-gitattributes

Conversation

@tstanmay13
Copy link
Copy Markdown
Contributor

@tstanmay13 tstanmay13 commented Apr 28, 2026

Summary

  • fern replay init writes .gitattributes into a temp clone that gets discarded — the actual PR is built server-side by Fiddle, and the wire body never carried any gitattributesEntries. Result: generated PRs (e.g. auth0/auth0-python#833) only modify .fernignore and .fern/replay.lock; .fern/replay.lock is never marked linguist-generated=true on GitHub.
  • This PR adds gitattributesEntries: string[] to ReplayInitResult and to the JSON body posted to /api/remote-gen/replay/init from both the v1 inline submit (packages/cli/cli/src/cli.ts) and submitReplayInit (used by cli-v2).
  • Cleans up adjacent dead code: ReplayInitResult.replayYmlContent was computed but never sent anywhere, and the two ensure*EntriesSync(repoPath) calls in replay-init.ts wrote to a temp dir that was immediately cleaned up. Both removed. The ensure* functions stay exported — they're still used by replay-run.ts (local generation path, where they write to a real, committed output dir).

Background

PR #14722 (Apr 7) attempted this same fix but only added the temp-clone writes; the wire format was never extended, so the bug persisted. The auth0 PR linked above is empirical proof.

⚠️ Server-side change required

Fiddle (separate repo) must be updated to read the new gitattributesEntries field from the request body and apply each entry to .gitattributes in the PR it builds — analogous to how fernignoreEntries is already applied to .fernignore. Until that lands the new field is silently ignored, so this PR is safe to merge first (no regression vs. today).

Test plan

  • pnpm turbo run compile --filter @fern-api/generator-cli --filter @fern-api/cli --filter @fern-api/cli-v2 — passes
  • pnpm turbo run test --filter @fern-api/generator-cli --filter @fern-api/cli-v2generator-cli 368 tests pass, cli-v2 561 tests pass
  • New test: GITATTRIBUTES_ENTRIES is exported and contains .fern/replay.lock linguist-generated=true
  • New assertion in cli-v2 init command test: the body posted to /api/remote-gen/replay/init contains gitattributesEntries: [".fern/replay.lock linguist-generated=true"]
  • After Fiddle change lands: run fern replay init --github <repo> against a test SDK repo and confirm the resulting PR includes a .gitattributes change adding the linguist-generated marker.

Versioning


Open in Devin Review

`replayInit()` writes `.gitattributes` into a temp clone that is then
discarded — the actual PR is built server-side by Fiddle, but the wire
body never carried the entries, so generated PRs were missing the
`linguist-generated=true` marker (e.g. auth0/auth0-python#833).

Adds a `gitattributesEntries` field to `ReplayInitResult` and the
Fiddle submit body (both v1 inline and v2 `submitReplayInit`). Drops
the unused `replayYmlContent` field and the temp-clone writes that
went nowhere. Requires a matching Fiddle change to consume the new
field; until that lands the field is silently ignored (no regression).
@tstanmay13 tstanmay13 requested a review from amckinney as a code owner April 28, 2026 20:13
@tstanmay13 tstanmay13 self-assigned this Apr 28, 2026
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

…gitattributes

# Conflicts:
#	packages/generator-cli/versions.yml
@fern-support fern-support merged commit 46ca61a into main Apr 28, 2026
60 checks passed
@fern-support fern-support deleted the fix/replay-init-ship-gitattributes branch April 28, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants