Skip to content

feat: add schema version gating to wl sync#22

Open
fkautz wants to merge 1 commit intogastownhall:mainfrom
fkautz:feat/schema-version-gating
Open

feat: add schema version gating to wl sync#22
fkautz wants to merge 1 commit intogastownhall:mainfrom
fkautz:feat/schema-version-gating

Conversation

@fkautz
Copy link
Copy Markdown

@fkautz fkautz commented Mar 8, 2026

Summary

  • Compare local and upstream _meta.schema_version before pulling during wl sync
  • MINOR bumps (e.g. 1.1 → 1.2) auto-apply with a log message
  • MAJOR bumps (e.g. 1.x → 2.x) block unless --upgrade is passed
  • --dry-run warns about major bumps but still shows the diff (doesn't block)
  • Missing or corrupt schema versions degrade gracefully (sync proceeds)

Closes w-wl-004.

Changes

File Change
internal/commons/schema.go New — SchemaVersion parsing, comparison, ReadSchemaVersion
internal/commons/schema_test.go New — unit tests for parse, compare, String, IsZero
cmd/wl/cmd_sync.go Added --upgrade flag, checkSchemaVersion() with dry-run awareness
test/integration/offline/sync_test.go 8 new integration tests (24 cases across 3 backends)
test/integration/commons_test.go Fixed stale version expectation (1.1 → 1.2)
README.md Documented --upgrade flag and schema version gating

Test plan

  • All 686+ unit tests pass
  • go vet -tags integration clean
  • Integration tests: TestSyncSameVersion — no schema message when versions match
  • Integration tests: TestSyncLocalAhead — warns when local is ahead
  • Integration tests: TestSyncMinorVersionBump — auto-applies with message
  • Integration tests: TestSyncMajorVersionBlocked — errors without --upgrade
  • Integration tests: TestSyncMajorVersionWithUpgrade — succeeds with --upgrade
  • Integration tests: TestSyncDryRunMajorVersion — warns but doesn't block
  • Integration tests: TestSyncMissingSchemaVersion — graceful degradation
  • Integration tests: TestSyncCorruptSchemaVersion — doesn't crash on garbage

🤖 Generated with Claude Code

Compare local and upstream _meta.schema_version before pulling:
- MINOR bumps (e.g. 1.1 → 1.2) auto-apply with a log message
- MAJOR bumps (e.g. 1.x → 2.x) block unless --upgrade is passed
- --dry-run warns about major bumps but still shows the diff
- Missing or corrupt versions degrade gracefully (sync proceeds)

Closes w-wl-004.

Co-Authored-By: Claude Opus 4.6 <[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