Repository navigation
Changelog entries for client generation - #121
Conversation
64a457d to
d9c52ff
Compare
| text = SYNC_CHANGELOG.read_text().strip() | ||
| if not text: | ||
| sys.exit(f"{SYNC_CHANGELOG} is empty; {reminder}") | ||
| return f"Codegen sync for {changes} {text}" |
There was a problem hiding this comment.
| return f"Codegen sync for {changes} {text}" | |
| return f"Codegen sync for {changes}: {text}" |
There was a problem hiding this comment.
It's a URL, right? I don't want to append anything to it without spaces
There was a problem hiding this comment.
It is but a markdown renderer will still hyperlink and show the colon after, upto you if you want to keep
Example
Codegen sync for https://github.com/smithy-lang/smithy-python/commits/6c2dfa2c689c2352985ffb05eef1bfc5e3a697e7..b8eceadb0573bd0c757def9a2b26fe7bf938b239: Fixed retry jitter.
| fragment = ( | ||
| dest / ".changes" / "next-release" / f"{name}-enhancement-codegen-sync.json" |
There was a problem hiding this comment.
Could we include the target commit in this filename? If two codegen syncs happen before a release, the second one will overwrite the first sync’s changelog entry
| if sync_entry is not None and _changed(dest): | ||
| _write_sync_fragment(dest, name, sync_entry) |
There was a problem hiding this comment.
Could this sync's fragment be removed when the client ends up unchanged? If an earlier run changed it but a rerun doesn’t, the old fragment will stick around since .changes is preserved.
There was a problem hiding this comment.
I separated make clients fragments. Testing and daily release automation just run make clients, whereas official manual updates will run make clients fragments.
| text = SYNC_CHANGELOG.read_text().strip() | ||
| if not text: | ||
| sys.exit(f"{SYNC_CHANGELOG} is empty; {reminder}") | ||
| return f"Codegen sync for {changes} {text}" |
There was a problem hiding this comment.
Rendering the raw link is messy if this is going into the client's changelog.
Can we make this a markdown link?
Something like:
return f"Codegen sync for [smithy-python {previous[:7]}..{commit[:7]}]({changes}): {text}"
Before:
- Codegen sync for https://github.com/smithy-lang/smithy-python/commits/b8eceadb0573bd0c757def9a2b26fe7bf938b239..6c2dfa2c689c2352985ffb05eef1bfc5e3a697e7 Adds adaptive retries, client-side event streams for RPC protocols, lazy model loading, and Python 3.15 support.
After:
- Codegen sync for smithy-python b8ecead..6c2dfa2: Adds adaptive retries, client-side event streams for RPC protocols, lazy model loading, and Python 3.15 support.
There was a problem hiding this comment.
Should only write these fragments when the pin actually moves? Feels like it would disrupt the normal flow of generating clients
There was a problem hiding this comment.
I separated make clients fragments. Only add fragments when the developer is actually bringing in a new smithy-python version with the hash pointer update.
For automation model updates or just testing, run only make clients. The determination is a little too sensitive to automate.
| commit = "b8eceadb0573bd0c757def9a2b26fe7bf938b239" | ||
| # The commit this pointer moved from; with `commit` it bounds the range linked | ||
| # in codegen sync changelog entries. | ||
| previous_commit = "6c2dfa2c689c2352985ffb05eef1bfc5e3a697e7" |
There was a problem hiding this comment.
I think this range is backwards. 6c2dfa2 is 29 commits ahead of b8ecead, so the generated link shows “No commits.” Since this PR isn’t moving the pin, could matching hashes mean “no sync pending” until the next update?
There was a problem hiding this comment.
I set it to 5053125, it's only illustrative for now and will change on the first real manual codegen update.
| fragments: | ||
| uv run --no-project --python $(PYTHON_VERSION) python codegen/gen_fragments.py |
There was a problem hiding this comment.
Could fragments depend on clients? That keeps normal make clients unchanged, but makes sure fragments only get written after generation succeeds
There was a problem hiding this comment.
No, this is a manual invocation so the developer could have run make clients and paused.
A small typo or error in fragments should not require rerunning client generation, which is time-consuming.
40fbf2c to
3181e11
Compare
This PR introduces an unversioned file called
CODEGEN_SYNC_CHANGELOG.mdin the root.Prior to running
make clients, which regenerates all clients from the target version incodegen/smithy-python.toml, the developer should fill in this file with the changelog prose.If the file is not present, empty, or older than 8 hours, this error message appears:
Use the link from this error message to fill in an appropriate changelog description before continuing to rerun
make clients.This time, each client will get a changelog fragment linking to the diff of smithy-python being generated, appended with what the developer wrote.