mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-06 17:49:07 -05:00
[PR #1418] [MERGED] fix(publish): block silent version downgrades in tinytorch + book publish-live #6537
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1418
Author: @profvjreddi
Created: 4/20/2026
Status: ✅ Merged
Merged: 4/20/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/publish-no-downgrade📝 Commits (1)
38f29dafix(publish): block silent version downgrades in tinytorch + book publish-live📊 Changes
2 files changed (+180 additions, -0 deletions)
View changed files
📝
.github/workflows/book-publish-live.yml(+109 -0)📝
.github/workflows/tinytorch-publish-live.yml(+71 -0)📄 Description
Summary
Adds a no-downgrade guard to both `tinytorch-publish-live.yml` and `book-publish-live.yml`.
Catches a real footgun in the next release: triggering with the default `release_type=patch`
silently regresses TinyTorch from `0.10.0` → `0.1.10` and Vol II from `v0.5.1` → `v0.0.1`.
The footgun in concrete terms
Both downgrades complete with no error and silently overwrite the source.
How the guard works
After version computation, before any `sed` write:
input to use (`explicit_version=X.Y.Z` for tinytorch, `previous_version=vol{N}-vX.Y.Z`
for the book).
is already at the target.
Verification
Tested `semver_lt` locally against 9 cases:
```
PASS 0.1.10 vs 0.10.0 → LT ← the TinyTorch footgun
PASS 0.10.0 vs 0.1.10 → GE
PASS 0.10.0 vs 0.10.0 → GE ← equality allowed
PASS 0.0.1 vs 0.5.1 → LT ← vol2 patch regression
PASS 0.1.0 vs 0.5.1 → LT ← vol2 minor still regresses
PASS 0.6.0 vs 0.5.1 → GE ← vol1 normal forward bump
PASS 0.5.2 vs 0.5.1 → GE
PASS 1.0.0 vs 0.99.99 → GE
PASS 0.5.1 vs 0.5.10 → LT ← naive lex sort would get this wrong
```
YAML parses cleanly for both workflows. `CI: Check workflows are safe for fork PRs` hook passes.
What this unblocks
The actual staged rollout (TinyTorch v0.10.0, Book vol1 v0.6.0, Book vol2 v0.1.0) can now be
triggered without worrying about the default-button creating a silent regression. Each volume's
first release just needs the right `previous_version` / `explicit_version` override, and the
guard tells you exactly which one to set if you forget.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.