Skip to content

Snippet overrides get reordered on every sync, creating huge PR diffs #66

Closed

Description

@generall

Every PR shows thousands of changed lines in fern/apis/*/openapi-overrides.yml, even when the content is the same.

Cause

tools/generate_snippet_overwrites.py builds the SDK list with glob.glob("snippets/*"), which returns directories in filesystem order. That order differs between machines and CI runners, so each sync writes the code samples in a different order. The preview.yml workflow runs the sync on every PR and auto-commits the result.

Proposed fix

Sort the list:

-    all_sdks = [sdk.split('/')[-1] for sdk in glob.glob("snippets/*")]
+    all_sdks = sorted(sdk.split('/')[-1] for sdk in glob.glob("snippets/*"))

Then regenerate the overrides once so the stable order is committed. That one change is a large reorder-only diff (content is identical when compared order-insensitively). Code samples would become alphabetical (csharp, curl, go, java, python, rust, typescript) instead of starting with java, which may change the language tab order in the docs.

A draft (#65) was closed so this can wait until after the 1.20 release, together with #64.

Related

preview.yml also pulls the latest upstream master OpenAPI spec into every PR, so unrelated spec changes land in PRs. Consider moving the sync out of the preview workflow and leaving it to the manual sync.yml.

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions