Repository navigation
feat: load configurations written for a newer StableBar - #337
Merged
Merged
Conversation
Saving from Settings, setup or the command line now pins $schema to the tag of the version that saved the file. Every release accepts any $schema, so the pin never stops an older one from reading the file. When a file the configuration reads is pinned to a newer version, or an installed package's minimumVersion is newer, StableBar skips the properties it doesn't know and lists them in a warning: in the menus, Settings, --validate and --query. A profile condition it can't check never matches. Other load errors name the version the file was written for. Unknown properties stay errors otherwise, and package manifests stay strict. Part of #223.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Unknown properties are errors, so a file saved by a newer build fails to load in an older one, and the error says only
Unknown property.: beta users who go back to Stable, dotfiles shared across Macs, shared includes, and rollbacks. The real case:bar.motionandbar.popupTransitionbrokev0.5.0.Part of #223. This covers the issue's first part, the version marker. Running the migrations on every file the loader reads is the second part and gets its own pull request, so #223 stays open.
Changes
$schema. When Settings, setup or a command-line edit changes a configuration file, it pins$schemato the schema at the tag of the version that saved it, such as…/StableBar/v0.10.0/stablebar.schema.json, and adds$schemato a file without one, as its first key. The pin only moves forward: an older version leaves a newer pin alone, and a$schemapointing elsewhere (a local copy, a fork) stays as written. Every release since v0.2.0 accepts any$schemavalue (v0.1.0 accepted any key), so pinning never stops an older version from reading the file. A separate key such assavedBywould have broken every file saved by a fixed build in all older releases. Editors also validate against the saving version's schema. Development builds and tests never pin.minimumVersionis newer, unknown properties are skipped in the whole configuration instead of rejected.rejectUnknownKeysconsults a task-local collector, so nested decodes (widgets, templates, overrides, workspace defaults, profiles) are covered, and each skipped property keeps its full path. Skipped properties stay in the composed document and in the file, so edits made in the older version keep them.--validate(on standard error),--query(warning), and the factsStableBar triagegathers. No warning triangle on the bar: the bar works, and someone who chose an older build on purpose would see it permanently.compareReleasesorders versions as SemVer does: a beta comes before its release. Stable always ships the newest beta'd commit, so a file saved by0.9.0-beta.…reads strictly in0.9.0.--validate, theminimumVersionrow in packages.md and the$schemadescription in the schema point to it.Surfaces from AGENTS.md:
$schemawas already allowed and listed, soschemaListsTheSamePropertiesAsTheDecodersis unchanged.ConfigurationEdits.swift'sconfigurationData(_:editing:)pins the schema, which covers Settings (Appearance, Your bar, Profiles), command-line edits, setup, other screen setups' bars and the launch migrations.Not covered:
Testing
swift test: 471 Swift Testing tests and 294 XCTest tests pass.NewerConfigurationTests(9 tests): version ordering; skipping in the main file, templates, widget styles and profile conditions, with the warning text; strict loading for files pinned to the running version, a beta of it,main, a local schema, and in development builds; an include and a package that are newer; the error note; pinning on save (added first, raised, kept when newer or custom, untouched when nothing changed);BarStoreloading, warning,--queryand keeping skipped properties and the pin on save; Settings and command-line saves pinning to the bar's version.rejectUnknownKeys, the two skipping tests fail; with the profile-condition guard removed, the profile expectations fail.--validateagainst real app bundles and scratch files, with no bar started: one release-stamped build (0.8.0, from the tracked plist) and one development build.bar.edgeGlowandwidgets.clock.style.glow: the release build printsWarning: This configuration was written for StableBar 0.10.0, so 0.8.0 skips bar.edgeGlow, widgets.clock.style.glow. Update StableBar to use them.andValid configuration: 1 widgets in 3 files., and exits 0. The development build reads strictly:bar.edgeGlow: Unknown property., exit 1.mainschema with the typobar.heigth: both builds printbar.heigth: Unknown property.and exit 1.hologram: the release build printswidgets.w: type: Unknown widget type. This configuration was written for StableBar 0.10.0, and this is 0.8.0. Update StableBar to load it.The development build prints the error without the note.Screenshots: drawn offscreen by a temporary test (not committed) from the same file:
$schemapinned to v0.10.0, with made-up propertiesbar.edgeGlowandwidgets.clock.style.glow. Before ismain; after runs as 0.9.0.main)Merging
Squash or rebase: one commit.
Claude Opus 5.5 via Claude Code