Skip to content

fix(cli): derive baked version from package.json - #5196

Merged
saddlepaddle merged 1 commit into
mainfrom
fix/cli-version-from-package-json
Jun 8, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
fix/cli-version-from-package-json

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Jun 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

superset update reports success but superset --version never changes — e.g. it prints Updated 0.2.19 → 0.2.22 while --version keeps saying 0.2.19.

Root cause

packages/cli/cli.config.ts hardcoded const VERSION = "0.2.19", and that constant is baked into every binary as both --version and process.env.SUPERSET_VERSION. It was never bumped, while package.json and the cli-v* git tags moved on to 0.2.22.

The two sources of truth diverged:

  • version.txt in the cli-latest release is derived from the git tag → 0.2.22
  • the version baked into the binary → 0.2.19

So the update flow: reads version.txt (target 0.2.22), sees baked current 0.2.19, downloads & installs today's tarball (which is the real 0.2.22 build), prints Updated 0.2.19 → 0.2.22 — but the freshly installed binary still self-reports 0.2.19. Every update looks like a no-op and the CLI perpetually thinks an update is available.

Fix

Read the version from package.json so there's a single source of truth that can't drift from the release tag.

-const VERSION = "0.2.19";
+import pkg from "./package.json" with { type: "json" };
+const VERSION = pkg.version;

Notes

Takes effect once the next CLI release is cut — the 0.2.22 build already in cli-latest will keep reporting 0.2.19 until then.

Test plan

  • bun run lint
  • bun run typecheck --filter=@superset/cli
  • Verified cli.config.ts resolves version and the SUPERSET_VERSION define to 0.2.22

Open in Stage

Summary by cubic

Fixes CLI version reporting by deriving the baked version from package.json. superset --version and SUPERSET_VERSION now match the release tag, so updates no longer look like no-ops.

  • Bug Fixes
    • Read version from ./package.json in packages/cli/cli.config.ts instead of a hardcoded string.
    • Aligns --version and process.env.SUPERSET_VERSION with the published cli-v* tag.
    • Note: takes effect with the next CLI release; the current 0.2.22 build will still report 0.2.19.

Written for commit 83d5b80. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores
    • Updated CLI version management to dynamically source from package metadata instead of a hardcoded value, improving version consistency across builds.

cli.config.ts hardcoded VERSION = "0.2.19", which is baked into every binary as --version and SUPERSET_VERSION. package.json and the cli-v* tags moved on to 0.2.22, so released binaries kept self-reporting 0.2.19: superset update read the newer version.txt, reinstalled the (genuinely newer) tarball, printed "Updated 0.2.19 -> 0.2.22", but --version never moved.

Read the version from package.json so there is a single source of truth that can't drift from the release tag.
@ghost

ghost commented Jun 8, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 1 individual chapter for you:

Title
1 Derive CLI version from package.json
Open in Stage

Chapters generated by Stage for commit 83d5b80 on Jun 8, 2026 9:10pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 22aa8292-7b88-4ec0-9fa8-ee2f192a0dac

📥 Commits

Reviewing files that changed from the base of the PR and between b71afca and 83d5b80.

📒 Files selected for processing (1)
  • packages/cli/cli.config.ts

📝 Walkthrough

Walkthrough

The CLI configuration file is updated to read the version from package.json dynamically instead of maintaining a hardcoded constant, ensuring the CLI version always matches the declared package version without manual synchronization.

Changes

Version Import Update

Layer / File(s) Summary
Dynamic version sourcing in CLI config
packages/cli/cli.config.ts
Import statement switches from a hardcoded VERSION constant to reading version from ./package.json via JSON import; the exported config now uses this dynamic version for both the version field and process.env.SUPERSET_VERSION environment variable definition.

Possibly related PRs

  • superset-sh/superset#4830: Bumps the CLI package version in packages/cli/package.json to 0.2.20, which this PR now sources dynamically in the config.
  • superset-sh/superset#4580: Previously modified packages/cli/cli.config.ts to drive process.env.SUPERSET_VERSION from a version source; this PR changes that source from hardcoded to dynamically imported.
  • superset-sh/superset#4462: Modified the same file to set version and process.env.SUPERSET_VERSION from the CLI version, aligning with this PR's version wiring approach.

Poem

🐰 A version once fixed in stone,
Now breathes with JSON's gentle tone.
No hardcoding chains remain,
The package truth flows through the vein!
Dynamic, free, in sync it stays—
Config and source dance all their days. 📦✨


🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: deriving the CLI's baked version from package.json instead of a hardcoded string.
Description check ✅ Passed The description comprehensively covers the problem, root cause, fix, notes, and test plan; all required template sections are present with substantial detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cli-version-from-package-json

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a version drift bug where superset --version and superset update always used a hardcoded "0.2.19" constant in cli.config.ts, while package.json and the release tags had moved to 0.2.22. The fix imports the version directly from package.json at build time, creating a single source of truth.

  • cli.config.ts now uses import pkg from \"./package.json\" with { type: \"json\" } to read pkg.version, which is then baked into the binary as both the --version string and the process.env.SUPERSET_VERSION define — so update/command.ts will correctly compare env.VERSION against the remote version.txt.
  • TypeScript 5.9.3 and resolveJsonModule: true in the base tsconfig fully support this import style; the with { type: \"json\" } attribute is valid under moduleResolution: \"Bundler\".
  • As noted in the PR, the currently deployed 0.2.22 binary will keep reporting 0.2.19 until the next release rebuilds from this config.

Confidence Score: 5/5

Safe to merge — the change is a minimal two-line swap that eliminates a stale hardcoded constant in favour of a build-time JSON import that stays in sync with package.json.

The fix is self-contained and correct: resolveJsonModule is already enabled, TypeScript 5.9.3 supports the with { type: json } import attribute, and pkg.version resolves to a typed string so no runtime ambiguity is possible. The downstream consumer (update/command.ts via env.VERSION) is unchanged and will correctly receive the baked value.

No files require special attention.

Important Files Changed

Filename Overview
packages/cli/cli.config.ts Replaces hardcoded "0.2.19" version constant with a JSON import of package.json, ensuring the baked SUPERSET_VERSION and --version flag always match the authoritative package version.

Sequence Diagram

sequenceDiagram
    participant Build as cli-framework build
    participant Config as cli.config.ts
    participant PkgJSON as package.json
    participant Binary as dist/superset (binary)
    participant Update as update command
    participant Remote as cli-latest/version.txt

    Build->>Config: load config
    Config->>PkgJSON: import pkg from package.json
    PkgJSON-->>Config: version 0.2.22
    Config-->>Build: "VERSION = 0.2.22"
    Build->>Binary: "bake SUPERSET_VERSION = 0.2.22"

    Note over Binary: at runtime
    Binary->>Update: "env.VERSION = 0.2.22"
    Update->>Remote: fetch version.txt
    Remote-->>Update: 0.2.22
    Update-->>Update: "upToDate = true"
Loading

Reviews (1): Last reviewed commit: "fix(cli): derive baked version from pack..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@github-actions

github-actions Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle merged commit e19a868 into main Jun 8, 2026
17 checks passed

This branch was previously deployed

1 inactive deployment
preview — 83d5b801 Deployed Jun 8, 2026 by saddlepaddle via Deploy Web #5912
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.

1 participant