Skip to content

fix: preserve prerelease metadata#144

Merged
jdx merged 1 commit into
mainfrom
codex/preserve-prerelease-metadata
May 1, 2026
Merged

fix: preserve prerelease metadata#144
jdx merged 1 commit into
mainfrom
codex/preserve-prerelease-metadata

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented May 1, 2026

Summary

  • collect prerelease-aware JSON when generating TOML files
  • emit prerelease metadata from D1 TOML endpoints
  • filter plain-text endpoints using stored prerelease metadata
  • prefer stored prerelease metadata in the web UI and latest-stable sync while retaining the version-shape regex as a fallback for tools that do not expose the flag

Follow-up

  • fix(backend): flag regex prerelease versions mise#9500 moves the regex fallback into mise by stamping VersionInfo.prerelease when backend versions match mise prerelease patterns. Once that lands and mise-versions data is regenerated with it, this repo can remove its local regex fallback.

Validation

  • npm test
  • bash -n scripts/update.sh
  • git diff --check
  • npx prettier --check scripts/sync-to-d1.js web/src/components/VersionsTable.tsx "web/src/pages/[...tool].toml.ts" "web/src/pages/[...tool].ts" "web/src/pages/tools/[...tool].ts" "web/src/pages/tools/[tool].toml.ts" web/src/lib/versions.ts
  • MISE_USE_VERSIONS_HOST=0 mise ls-remote --prerelease --json gradle | jq -c '.[]' | node scripts/generate-toml.js gradle docs/gradle.toml | rg '"9\.(5\.0|6\.0-M1)"'
  • MISE_USE_VERSIONS_HOST=0 mise ls-remote --prerelease --json java | jq 'map(select(has("prerelease"))) | length' # returned 0, confirming Java still needs fallback handling until the mise follow-up lands

Note: npm --workspace web run build is currently blocked before app compilation by an Astro/Cloudflare package export mismatch: Package subpath ./app/manifest is not defined by exports.

This PR description was generated by an AI coding assistant.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 1, 2026

Greptile Summary

This PR promotes the prerelease flag from a regex-inferred property to first-class stored metadata. The update pipeline now fetches mise ls-remote --prerelease --json so TOML files carry explicit prerelease = true entries, the D1 version sync already stores the flag as 0/1, the TOML endpoints now re-emit it, and the plain-text endpoints filter at the SQL layer while the web UI switches from regex to the stored boolean. The logic in generate-toml.js handles all three states cleanly: explicit true/false from the JSON path takes precedence, null (absent field) falls back to whatever was already in the existing TOML.

Confidence Score: 5/5

Safe to merge — the prerelease metadata flow is consistent end-to-end and no new blocking issues were found beyond the NULL-filter concern already raised in the previous review thread.

All changed files handle the three-state prerelease signal (true/false/null) correctly. The D1 version upsert always writes 0 or 1 (never NULL for new rows). The TOML generation preserves existing flags through the plain-text fallback path. The web UI and TOML endpoints are consistent. The only known concern (AND prerelease = 0 excluding NULL rows) was already flagged in a prior review thread and is not a new finding.

web/src/pages/[...tool].ts and web/src/pages/tools/[...tool].ts — the AND prerelease = 0 filter (NULL-row exclusion) was already discussed in the previous thread but warrants attention if the prerelease column was added without DEFAULT 0 on existing rows.

Important Files Changed

Filename Overview
scripts/generate-toml.js Correctly propagates prerelease flag from JSON: explicit boolean takes precedence, null falls back to existing TOML, preserving previously-recorded flags through the plain-text fallback path
scripts/sync-to-d1.js Updated isPrerelease to check stored metadata first with regex as fallback; correctly destructures version data tuples in latest_stable_version search
scripts/update.sh Adds --prerelease flag to mise ls-remote --json call so the JSON output includes prerelease versions and their flags for downstream processing
web/src/lib/versions.ts Refactored to separate isPrereleaseVersion (string-only regex) from isPrerelease (object with stored flag + regex fallback); removed now-unused filterStableVersions and getLatestStableVersion helpers
web/src/components/VersionsTable.tsx Updates hide-prerelease filter and count to call isPrerelease(v) with the full version object instead of just the string, enabling stored-flag awareness
web/src/pages/[...tool].toml.ts Adds prerelease column to SELECT and emits prerelease = true in TOML output when the stored integer is 1
web/src/pages/[...tool].ts Adds AND prerelease = 0 to the plain-text endpoint SQL; rows with NULL prerelease (pre-migration) will be silently excluded — already flagged in previous review thread
web/src/pages/tools/[...tool].ts Same AND prerelease = 0 filter as [...tool].ts; same NULL-exclusion concern applies
web/src/pages/tools/[tool].astro Adds prerelease to SELECT and maps row.prerelease === 1 to boolean; NULL rows safely map to false, allowing the regex fallback in isPrerelease to still catch version-name patterns
web/src/pages/tools/[tool].toml.ts Mirrors [...tool].toml.ts — adds prerelease to SELECT and emits prerelease = true in TOML when stored value is 1

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["update.sh\nmise ls-remote --prerelease --json"] -->|NDJSON with prerelease flag| B["generate-toml.js\nprerelease = true when set"]
    B -->|TOML files in docs/| C["versions/sync API\nprerelease stored as 0/1 in D1"]
    C --> D[D1 versions table\nprerelease INTEGER]
    D --> E["[...tool].toml.ts\nemit prerelease = true"]
    D --> F["[...tool].ts\nAND prerelease = 0\nplain-text stable-only"]
    D --> G["[tool].astro\nprerelease: row.prerelease === 1\nweb UI"]
    G --> H["VersionsTable.tsx\nisPrerelease(v)\nstored flag OR regex fallback"]
    B -->|prerelease data| I["sync-to-d1.js\nisPrerelease(ver, data)\nlatest_stable_version"]
Loading

Reviews (2): Last reviewed commit: "fix: preserve prerelease metadata" | Re-trigger Greptile

Comment thread web/src/pages/[...tool].ts
@jdx jdx force-pushed the codex/preserve-prerelease-metadata branch from 0865db9 to 97bc9c6 Compare May 1, 2026 00:11
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request transitions the project from regex-based prerelease detection to a metadata-driven approach. Key changes include updating scripts/update.sh to fetch prerelease flags using mise ls-remote --prerelease, modifying the database queries in Astro pages and TOML endpoints to include the prerelease column, and updating the VersionsTable component to filter based on this new property. The legacy isPrerelease utility and associated regex have been removed from web/src/lib/versions.ts and scripts/sync-to-d1.js. I have no feedback to provide.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 97bc9c6. Configure here.

Comment thread web/src/lib/versions.ts
* Versions matching this pattern should be excluded when showing stable versions.
*
* Matches:
* - -src, -dev, -latest, -stm (build markers)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Exported function isPrereleaseVersion is never imported externally

Low Severity

The newly introduced isPrereleaseVersion is exported but never imported anywhere outside web/src/lib/versions.ts. It's only called internally by isPrerelease in the same file. The export keyword can be removed to keep the module's public surface minimal.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 97bc9c6. Configure here.

@jdx jdx merged commit 93ec2e0 into main May 1, 2026
7 of 8 checks passed
@jdx jdx deleted the codex/preserve-prerelease-metadata branch May 1, 2026 00:17
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