Skip to content

Conversation

@gewenyu99
Copy link
Contributor

@gewenyu99 gewenyu99 commented Sep 23, 2025

We want automatically updated, versioned, and persisted references for all SDKs.

See related RFC

This PR does these things:

  • Updates script to produce a latest and versioned copy of the references
  • The workflow will run on push to master
  • The references and only changes in the references folder will be committed to master
  • We will pull these in on build on the website later.

See this run on my fork for the workflow

Feel free to bring up suggestions/objections to this approach, but let's keep the discussion in the related RFC for anything that's not repo specific <3

Looking forward to y'all's wisdom and help!

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 5 comments

Edit Code Review Bot Settings | Greptile

@gewenyu99 gewenyu99 requested review from a team and removed request for a team September 23, 2025 18:26
@gewenyu99 gewenyu99 marked this pull request as draft September 23, 2025 18:26
gewenyu99 and others added 3 commits September 23, 2025 14:27
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@gewenyu99 gewenyu99 marked this pull request as ready for review September 23, 2025 18:38
@gewenyu99 gewenyu99 requested a review from a team September 23, 2025 18:38
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

if: steps.changes.outputs.changed == 'true'
with:
commit_message: "Update generated references"
file_pattern: references/ No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Missing newline at end of file.

Suggested change
file_pattern: references/
file_pattern: references/

Comment on lines 464 to +468
output_file = os.path.join(
str(OUTPUT_CONFIG["output_dir"]), str(OUTPUT_CONFIG["filename"])
)
output_file_latest = os.path.join(
str(OUTPUT_CONFIG["output_dir"]), str(OUTPUT_CONFIG["filename_latest"])
)
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The script writes to ./references/ directory but doesn't ensure it exists first. This could cause a FileNotFoundError if the directory doesn't exist.

Suggested change
output_file = os.path.join(
str(OUTPUT_CONFIG["output_dir"]), str(OUTPUT_CONFIG["filename"])
)
output_file_latest = os.path.join(
str(OUTPUT_CONFIG["output_dir"]), str(OUTPUT_CONFIG["filename_latest"])
)
output_file = os.path.join(
str(OUTPUT_CONFIG["output_dir"]), str(OUTPUT_CONFIG["filename"])
)
output_file_latest = os.path.join(
str(OUTPUT_CONFIG["output_dir"]), str(OUTPUT_CONFIG["filename_latest"])
)
# Ensure output directory exists
os.makedirs(str(OUTPUT_CONFIG["output_dir"]), exist_ok=True)

Copy link
Member

@rafaeelaudibert rafaeelaudibert left a comment

Choose a reason for hiding this comment

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

There's a tiny bug here since the workflow is running more often than needed

Copy link
Member

Choose a reason for hiding this comment

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

We don't have this as a requirement in our SDKs, but it'd be better if you set the actions to a specific commit hash rather than to a version like you're doing here. GitHub's ones are fine, but the astral and stefanzweifel ones could be easily compromised/abused. You can look at our main repo to see how that works.

Just a nice to have

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wonderful, I go back to a hash lol. I also agree

I used a hash but greptile was like nono :finger wag:

Comment on lines 3 to 7
on:
push:
branches:
- master
workflow_dispatch:
Copy link
Member

Choose a reason for hiding this comment

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

Not all pushes to master release a new version. Can we add something here to restrict this from running at all times?

Or, maybe something to detect we've already generated docs for that version?

My fear is the following:

  • Release V1.0.0
  • This workflow generates spec for v1.0.0 and adds in the commit
  • Merges a new feature on master but does NOT release it as a new feature
  • This workflow generates spec for v1.0.0 and adds in the commit ⚠️⚠️⚠️⚠️⚠️ WRONG

We'd have overwritten the docs for v1.0.0 incorrectly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should still bump latest right (meant to be head of the branch) or do we not bother?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don't think so. We could update something called edge or master, but latest should probably always be the "latest that was actually released".

@gewenyu99
Copy link
Contributor Author

  • I went back to pinning hashes for workflows.
  • Only generate on release. No one cares about unreleased stuff anyway :)

Comment on lines +4 to +5
release:
types: [published]
Copy link
Member

Choose a reason for hiding this comment

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

I've double checked and we do publish releases here in Github, so lgtm!

@gewenyu99 gewenyu99 merged commit 461c457 into master Sep 30, 2025
11 checks passed
@gewenyu99 gewenyu99 deleted the persist-references branch September 30, 2025 21:02
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.

3 participants