Skip to content

Emit versioned asset bundles for immutable caching#35

Merged
blackopsrepl merged 1 commit intomainfrom
issue-16-versioned-assets
Mar 21, 2026
Merged

Emit versioned asset bundles for immutable caching#35
blackopsrepl merged 1 commit intomainfrom
issue-16-versioned-assets

Conversation

@blackopsrepl
Copy link
Copy Markdown
Contributor

Closes #16.

Summary

  • emit versioned bundle filenames alongside sf.css and sf.js
  • treat versioned CSS and JS bundles as immutable in the Rust asset server
  • add unit tests covering versioned bundle detection and cache policy
  • document the versioned bundle migration path and verify generated files in CI

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca89530663

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +47 to +50
static/sf/sf.css $(VERSIONED_CSS): $(CSS_SRC)
@printf "$(PROGRESS) CSS sf.css ($(words $(CSS_SRC)) files)\n"
@cat $(CSS_SRC) > $@
@cat $(CSS_SRC) > static/sf/sf.css
@cp static/sf/sf.css $(VERSIONED_CSS)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate sf.$(VERSION) bundles in the release path

These rules make the emitted filenames depend on $(VERSION), but the existing release flow does not rebuild them: .versionrc.json only bumps Cargo.toml, and publish still runs cargo publish without depending on assets. In a 0.1.0 -> 0.1.1 release, that means the crate can be published with only sf.0.1.0.{css,js} present, so the newly documented /sf/sf.0.1.1.css and /sf/sf.0.1.1.js URLs will 404 unless the maintainer remembers to run make assets manually.

Useful? React with 👍 / 👎.

Comment on lines +67 to +69
&& version.chars().all(|ch| {
ch.is_ascii_digit() || ch == '.' || ch == '-' || ch.is_ascii_alphabetic()
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept + in versioned bundle names for valid Cargo versions

Cargo accepts package versions with build metadata such as 0.1.0+foo, so the new Makefile can emit sf.0.1.0+foo.css/js. This predicate rejects +, which means those valid versioned bundles fall back to the non-immutable max-age=3600 cache policy and the new caching behavior silently stops working for that class of releases.

Useful? React with 👍 / 👎.

@blackopsrepl blackopsrepl force-pushed the issue-16-versioned-assets branch from ca89530 to b9ce5f3 Compare March 21, 2026 13:38
@blackopsrepl blackopsrepl merged commit 7a04865 into main Mar 21, 2026
1 check passed
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.

Add versioned or content-hashed asset outputs for sf.css and sf.js

1 participant