Skip to content

Fix schema versioning to preserve released versions#337

Merged
bokelley merged 3 commits intomainfrom
bokelley/schema-version-dist-issue
Dec 17, 2025
Merged

Fix schema versioning to preserve released versions#337
bokelley merged 3 commits intomainfrom
bokelley/schema-version-dist-issue

Conversation

@bokelley
Copy link
Contributor

Summary

  • Development builds now only rebuild dist/schemas/latest/
  • Released version directories (e.g., 2.5.0/) are preserved across builds
  • Release builds (--release flag) create new versioned directories
  • v1 symlink always points to latest/ for backward compatibility

Problem

Previously, npm run build:schemas would delete the entire dist/schemas/ directory and rebuild everything. This caused schema changes to appear in all version paths (v2, v2.5, etc.) instead of only in latest/.

Solution

The build script now has two modes:

Development build (default):

npm run build:schemas
  • Only rebuilds dist/schemas/latest/
  • Preserves released version directories
  • Symlinks (v2, v2.5) continue pointing to released versions

Release build (via changesets):

npm run build:schemas -- --release
  • Creates new versioned directory (e.g., 2.6.0/)
  • Updates major/minor symlinks to point to new release
  • Updates latest/ to match the release

Directory Structure

After a release + dev build:

dist/schemas/
├── 2.5.0/              ← Released version (immutable)
├── latest/             ← Development schemas (rebuilt on dev builds)
├── v1 -> latest        ← Always points to latest
├── v2 -> 2.5.0         ← Points to released version
└── v2.5 -> 2.5.0       ← Points to released version

Test Plan

  • Development build only updates latest/
  • Released version directories preserved
  • Release build creates versioned directory
  • Symlinks point to correct targets
  • All tests pass

🤖 Generated with Claude Code

bokelley and others added 3 commits December 17, 2025 14:26
Changes:
- Development builds only rebuild dist/schemas/latest/
- Released version directories (e.g., 2.5.0/) are preserved
- Release builds (--release flag) create new versioned directories
- v1 symlink always points to latest/ for backward compatibility
- Major/minor symlinks (v2, v2.5) point to released versions

This fixes the issue where schema changes appeared in all version
paths instead of only in latest/.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Ensures Docker builds create versioned schema directories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@bokelley bokelley merged commit aad1662 into main Dec 17, 2025
5 checks passed
bokelley added a commit that referenced this pull request Dec 24, 2025
Update .gitignore to:
- Ignore dist/* but allow dist/schemas/ directory
- Ignore dist/schemas/latest/ (rebuilt on every dev build)
- Ignore dist/schemas/v*/ (symlinks, not tracked in git)
- Preserve released version directories (2.5.0/, 2.5.1/, etc.)

This ensures released schema versions persist across CI runs while
development changes only affect the latest/ directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
bokelley added a commit that referenced this pull request Dec 24, 2025
* Fix release workflow to create GitHub releases

Add publish command to trigger GitHub release creation.
Without a publish step, createGithubReleases doesn't run.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Fix schema versioning to preserve released versions (#337)

Update .gitignore to:
- Ignore dist/* but allow dist/schemas/ directory
- Ignore dist/schemas/latest/ (rebuilt on every dev build)
- Ignore dist/schemas/v*/ (symlinks, not tracked in git)
- Preserve released version directories (2.5.0/, 2.5.1/, etc.)

This ensures released schema versions persist across CI runs while
development changes only affect the latest/ directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Fix released schema directories to use actual release content

The previous commit incorrectly built 2.5.0 and 2.5.1 from current
source schemas. This commit rebuilds them from their actual git tags
to preserve the exact schemas that were released.

Key differences:
- 2.5.0: No bundled/ directory (feature added later), different schema structure
- 2.5.1: Has bundled/ directory with schemas as they were at release time

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Add git staging to release build for CI automation

When running --release, the build script now stages the new versioned
schema directory (e.g., dist/schemas/2.6.0/) for git commit. This
ensures the changesets workflow includes the released schemas in the
"Version Packages" commit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Fix build script to use dev mode, not release mode

The regular `npm run build` (used by Docker) should use development
mode to:
1. Preserve existing committed released directories (2.5.0/, 2.5.1/)
2. Only rebuild latest/ from current source
3. Create symlinks pointing to the latest released version

Only `npm run version` (used during changeset releases) should use
--release mode to create new versioned directories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
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