chore: single source of truth for the release version#477
Conversation
Gradle applies both to the root project and every subproject, so the five build scripts no longer repeat them.
maturin reads it off the crate at tool.maturin.manifest-path, so the wheel cannot drift from the core it wraps.
One source of truth plus a --check mode, so drift is detectable instead of discovered at publish time.
Replaces three bespoke per-SDK version asserts in the publish preflights with the shared check.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis change adds ChangesVersion synchronization
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CIOrPublish as CI or publish workflow
participant VersionScript as scripts/version.mjs
participant Repository as Repository version files
CIOrPublish->>VersionScript: Run --check
VersionScript->>Repository: Read canonical and mirrored versions
VersionScript-->>CIOrPublish: Return validation status
CIOrPublish->>VersionScript: Run --current
VersionScript-->>CIOrPublish: Return declared version
CIOrPublish->>CIOrPublish: Compare resolved release version
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/version.mjs (1)
55-60: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winFilter the
cratesdirectory entries to avoidENOENTerrors on files.
readdirSyncreturns all entries, including files like.DS_Storeor.gitkeep. Attempting to readcrates/.DS_Store/Cargo.tomlwill throw anENOENTerror and crash the script. Filter for directories only to make it resilient.♻️ Proposed fix
- const crates = readdirSync(abs("crates")).map((crate) => ({ - file: `crates/${crate}/Cargo.toml`, + const crates = readdirSync(abs("crates"), { withFileTypes: true }) + .filter((dirent) => dirent.isDirectory()) + .map((dirent) => ({ + file: `crates/${dirent.name}/Cargo.toml`, pattern: /^version = "/m, hint: "use `version.workspace = true`", }));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/version.mjs` around lines 55 - 60, Update the crates collection in guards() to include only directory entries from readdirSync(abs("crates")) before constructing Cargo.toml paths, preventing files such as .DS_Store or .gitkeep from being processed. Preserve the existing file, pattern, and hint mappings for valid crate directories.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/version.mjs`:
- Around line 55-60: Update the crates collection in guards() to include only
directory entries from readdirSync(abs("crates")) before constructing Cargo.toml
paths, preventing files such as .DS_Store or .gitkeep from being processed.
Preserve the existing file, pattern, and hint mappings for valid crate
directories.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ff398bf0-c23b-4274-8076-f211b3ae9203
📒 Files selected for processing (13)
.github/workflows/ci.yml.github/workflows/publish-java.yml.github/workflows/publish-node.yml.github/workflows/publish.ymlscripts/version.mjssdks/java/build.gradle.ktssdks/java/graalvm-smoke/build.gradle.ktssdks/java/gradle.propertiessdks/java/processor/build.gradle.ktssdks/java/spring/build.gradle.ktssdks/java/test-support/build.gradle.ktssdks/python/pyproject.tomlsdks/python/taskito/__init__.py
💤 Files with no reviewable changes (5)
- sdks/java/build.gradle.kts
- sdks/java/graalvm-smoke/build.gradle.kts
- sdks/java/test-support/build.gradle.kts
- sdks/java/spring/build.gradle.kts
- sdks/java/processor/build.gradle.kts
The version was hardcoded in nine places across four ecosystems, kept in step by hand and
spot-checked by three different ad-hoc greps in the publish preflights. This makes the root
Cargo.tomlthe only place it is written, and makes drift a CI failure instead of somethingdiscovered at publish time.
Fewer places to begin with
Two of the duplications had a native fix, so they are gone rather than scripted:
group/versionmove tosdks/java/gradle.properties, which Gradle applies tothe root project and every subproject. Five build scripts stop repeating them. Verified by
generating the Maven POMs: coordinates are byte-identical (
org.byteveda:taskito:0.20.0,taskito-spring,taskito-processor,taskito-test).pyproject.tomldeclaresdynamic = ["version"]; maturin already reads theversion off the crate at
tool.maturin.manifest-path, so the wheel cannot drift from thecore it wraps. Verified:
uv syncbuildstaskito==0.20.0andtaskito.__version__isunchanged at runtime.
scripts/version.mjsSource of truth:
[workspace.package].versionin the rootCargo.toml.Three mirrors remain (no native path exists):
sdks/node/package.json,sdks/java/gradle.properties, and the source-tree__version__fallback insdks/python/taskito/__init__.py.CHANGELOG.mdis checked but never written — its top## X.Y.Zsection must match, so aversion cannot ship without release notes. The docs changelog page and landing-page badge are
already generated from that file, so they follow for free.
--checkalso guards against re-hardcoding: it fails if anycrates/*/Cargo.toml,sdks/python/pyproject.toml, orsdks/java/**/build.gradle.ktsrestates a version instead ofderiving one.
CI
versionsjob inci.yml— runs on every PR and push, takes seconds.--checkand compare the resolved tag against--current, replacing their per-SDK greps. This also fixespublish-java.yml, whose greptargeted the
build.gradle.ktsline this PR removes.Verification
node scripts/version.mjs --checkgreen;--setround-tripped 0.20.0 → 0.99.1 → 0.20.0with a clean diff, and drift/guard failures confirmed by hand.
./gradlew generatePomFileForMavenPublicationacross all four published projects.uv sync+uv run ruff check+uv run mypy taskito/ tests/green.Summary by CodeRabbit
--helpoption.