Skip to content

feat: download fallback to latest release + cross-platform CI#112

Merged
aeneasr merged 9 commits intomainfrom
address-dl-issues
Apr 8, 2026
Merged

feat: download fallback to latest release + cross-platform CI#112
aeneasr merged 9 commits intomainfrom
address-dl-issues

Conversation

@aeneasr
Copy link
Copy Markdown
Member

@aeneasr aeneasr commented Apr 8, 2026

Summary

  • When .release-please-manifest.json declares a version that hasn't been released yet, the download scripts now fall back to the latest published GitHub release instead of failing with a 404
  • Adds lumen version subcommand (ldflags-injected via goreleaser)
  • Adds cross-platform CI job (Linux, macOS, Windows) testing both happy-path and fallback downloads with semver output assertions

Closes #110

Changes

File Change
cmd/version.go New version subcommand
.goreleaser.yml Ldflags for version injection across all 4 build targets
scripts/run.sh Fallback: query GitHub API for latest release on 404, validate tag, retry
scripts/run.bat Same fallback logic for Windows
scripts/test_run.sh 13 new offline tests (tag parsing, fallback URLs, tag validation)
.github/workflows/ci.yml New download job: 3-OS matrix, happy + fallback paths, version assertions

How it works

  1. Script tries to download the manifest-pinned version (existing behavior)
  2. If that fails, it queries https://api.github.com/repos/ory/lumen/releases/latest
  3. Parses tag_name with sed (no jq dependency), validates it matches ^v[0-9]
  4. Retries the download with the resolved version
  5. Uses GITHUB_TOKEN for auth when available (CI), falls back to unauthenticated (end users)

Test plan

  • scripts/test_run.sh — 34/34 tests pass (13 new)
  • lumen version prints dev without ldflags, injected version with ldflags
  • Go build compiles cleanly
  • CI download job passes on all 3 platforms (verify after merge)

🤖 Generated with Claude Code

aeneasr and others added 5 commits April 8, 2026 11:17
Addresses #110 where the plugin fails to start when the manifest
version hasn't been released yet. Design covers fallback to latest GitHub
release, a version subcommand, and cross-platform CI download tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add GITHUB_TOKEN auth handling to run.sh and run.bat fallback logic
- Add detailed pseudocode for run.bat fallback (was underspecified)
- Add version output assertions to CI download job
- Add timeout-minutes to CI download job
- Add tag validation (must match v[0-9]*) before retry
- Add retry/max-time flags to fallback curl calls
- Expand risks table with API non-JSON response mitigation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix run.sh AUTH_HEADER quoting: use bash array AUTH_ARGS instead of
  string with embedded quotes
- Fix run.bat missing /repos/ path in GitHub API URL
- Add --max-time and --retry flags to run.bat curl calls
- Add tag format validation (findstr ^v[0-9]) to run.bat fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the version in .release-please-manifest.json has not been released
yet (e.g. release-please bumped the manifest but goreleaser hasn't run),
the download scripts now fall back to the latest published GitHub release
instead of failing with a 404.

Also adds:
- `lumen version` subcommand with ldflags-injected build version
- Cross-platform CI job (Linux, macOS, Windows) testing both happy path
  and fallback downloads with semver output assertions
- 13 new offline tests for tag parsing, fallback URL construction, and
  tag validation

Closes #110

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Table-driven tests verifying the version command outputs the correct
buildVersion value for default, release, and pre-release versions.
Also fixes the command to use cmd.OutOrStdout() for testability.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aeneasr aeneasr force-pushed the address-dl-issues branch from f634922 to 9955fcc Compare April 8, 2026 09:17
aeneasr and others added 3 commits April 8, 2026 11:18
Two printf commands with ".": (colon + space) in plain YAML scalars
caused the YAML parser to treat them as mapping separators, making the
entire workflow file unparseable. Convert both run: values to block
scalars to fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace download CI job with cross-platform build-from-source job;
  lumen has no published releases yet so downloading from GitHub Releases
  is not possible — build with CGO_ENABLED=1 and verify version output
- Fix errcheck lint violation in cmd/version.go (discard fmt.Fprintln return)
- Realign .release-please-manifest.json to 0.0.32 to match distribution
  manifests and fix TestDistributionManifestVersionsStayAligned

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When built without ldflags, cmd.buildVersion defaults to "dev" which
fails the semver pattern check. Read the version from
.release-please-manifest.json and pass it via -ldflags at build time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aeneasr aeneasr enabled auto-merge (squash) April 8, 2026 09:47
Windows CGO builds need MinGW headers not present on the runner.
Cross-compilation to Windows is handled by goreleaser at release time.
Also simplify build/verify into a single step per platform.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@aeneasr aeneasr merged commit a2e3701 into main Apr 8, 2026
6 checks passed
This was referenced Apr 8, 2026
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.

Version mismatch: v0.0.32 in manifest but release doesn't exist (404 error)

1 participant