Skip to content
Strata v1.2.6

2026-05-10: Versioning Env Badge Fix

Three surfaces, wrong labels:

SurfaceCurrently showsShould show
docker:devhttp://localhost:8001/docs/v1.0.0 PRODv1.0.0 DEV
docker:prodv1.0.0 PRODv1.0.0 PROD
https://strata.ducatillon.net/docsv0.0.0-dev+062ec83 DEVv1.0.0 (no badge)

Display rules (finalized):

  • DEV: full git describe + badge → v1.0.0-3-gabc1234 — DEV
  • PROD: clean tag only, no badgev1.0.0

docker:reset / docker:nuke call gen-version.mjs all. On a clean tag (v1.0.0), git describe → 1.0.0isClean=trueenv=production. That version.ts is COPY-ed into the docs Docker image. docker:dev = docker-compose up (no rebuild) → reuses image → shows PROD.

Cloudflare Pages does a shallow clone (depth=1). git describe finds no tags → falls back to 0.0.0-dev+sha. Not a clean semver → isClean=falseenv=development. Both version number and env label are wrong.

Root fix — package.json fallback (zero dashboard config)

Section titled “Root fix — package.json fallback (zero dashboard config)”

When git returns 0.0.0-dev (no tags / shallow clone), read version from root package.json. Since release.mjs always bumps package.json in sync with git tags, it always holds the correct version string (e.g. 1.0.0). A clean semver → isClean=trueenv=production is derived automatically. No STRATA_ENV env var needed for Cloudflare Pages.

#ConventionCheck
1Documentation✅ Update versioning.md with STRATA_ENV + fallback
2All 4 test gates✅ Script/config changes only — run all gates for regression check
3Self-review✅ See below
4Endpoint coveragen/a
5Bug-to-Testn/a — build-time display
6Seed isolationn/a
7Transaction invariantsn/a
8Plan history✅ This file
9Infra test gate✅ Verify node scripts/version.mjs --json in all scenarios
10Environment compat✅ Plain env var; synchronous fs.readFileSync
11Do-no-harm✅ Verify docker:prod still shows v1.0.0 (no badge)
12Execution summary✅ Append after done
13Doc Grep Rule✅ No paths renamed
  • VERSION_OVERRIDE path in version.mjs untouched — docker:prod still works ✅
  • STRATA_ENV only overrides env field; version string always comes from git/package.json ✅
  • package.json fallback triggers only when version starts with 0.0.0-dev
  • Cloudflare Pages: 0.0.0-dev → fallback → 1.0.0isClean=trueenv=production → no badge shown ✅
  • No circular deps; no runtime code changes

1. scripts/version.mjs — STRATA_ENV override + package.json fallback

Section titled “1. scripts/version.mjs — STRATA_ENV override + package.json fallback”

Add readFileSync import and readPkgVersion() helper. Two additive changes:

  • STRATA_ENV override: when set to development/production, force env field
  • package.json fallback: when version starts with 0.0.0-dev, replace with package.json version

2. root package.json — docker:reset + docker:nuke

Section titled “2. root package.json — docker:reset + docker:nuke”

Prepend STRATA_ENV=development to gen-version.mjs all call in both scripts. docker:prod unchanged.

3. docs/src/components/DocsSiteTitle.astro

Section titled “3. docs/src/components/DocsSiteTitle.astro”
  • DEV: full VERSION.version + — DEV badge
  • PROD: VERSION.version.split('-')[0] only, no badge
  • Remove unused .env-badge.prod CSS rule

Document STRATA_ENV and package.json fallback behavior.

Commit: b7ea452

FileChange
scripts/version.mjsAdded readPkgVersion() helper + STRATA_ENV override + package.json fallback
package.jsondocker:reset + docker:nuke prefixed with STRATA_ENV=development
docs/src/components/DocsSiteTitle.astroDEV: full version + — DEV badge; PROD: clean tag only, no badge; removed .env-badge.prod CSS
docs/src/content/docs/versioning.mdAdded STRATA_ENV override + package.json fallback docs; updated surface table
docs/src/content/docs/plans/2026-05-versioning-env-badge-fix.mdPlan doc (this file)

None. Implementation matched the plan exactly.

GateResult
Backend unit✅ 315 passed (30 suites)
Backend e2e✅ 70 passed (8 suites)
Frontend unit✅ 394 passed (63 files)
Frontend e2e⏭ skipped (no UI code changed)
Docs build✅ 56 pages built successfully
  • The package.json fallback alone fixes Cloudflare Pages — a clean semver from package.jsonisClean=trueenv=production is derived automatically. No STRATA_ENV dashboard variable needed.

  • docker:dev (no rebuild) will show version frozen from last docker:reset/docker:nuke — this is acceptable behaviour, documented in plan.

  • The old PROD badge in DocsSiteTitle.astro was redundant by design — removed per user request.

  • npm run docker:resethttp://localhost:8001/docs/v1.0.0 — DEV (or full sha if past tag)

  • npm run docker:prodv1.0.0 (no badge)

  • node scripts/version.mjs --json (no tags, shallow simulation) → version=1.0.0, env=production

  • STRATA_ENV=development node scripts/version.mjs --jsonenv=development

  • strata.ducatillon.net (after next CF Pages deploy) → v1.0.0 (no badge)

  • All backend unit + e2e tests pass

  • All frontend unit + e2e tests pass