fix(defaults): portable Liquibase preconditions; seeds never change an existing host #50

Merged
KofTwentyTwo merged 1 commits from fix/assistant-defaults-guards into develop 2026-10-14 21:58:38 +00:00
KofTwentyTwo commented 2026-10-14 21:54:46 +00:00 (Migrated from github.com)

Follow-up to #48. It was merged before review finished and has not been released yet; the release captain is holding RC.13 until this lands.

Fixes

  1. The changelog failed to parse in Liquibase. -- precondition-table-exists tableName: is rejected by Liquibase 5 and unsupported in 4.19, so a host's whole migration would fail. Every precondition is now a sql-check (... WHERE 1 = 0 means "the table exists"), with onFail/onError: MARK_RAN.
  2. Seeds could change an existing host on deploy.
    • The policy, the $50 budget and the Anthropic prices are now seeded only into empty tables. Price rows take precedence over withPricing, so a host's configured prices are never overridden.
    • The default profile is seeded only when no default profile exists, so there is never a second default.
  3. The Setup card showed false "needs setup" for prices. It now prices the default model through ProviderService.pricing(...): registry row, then price row, then config. Local models count as free.
  4. "Add rows for every table" could read a stale cache. It now invalidates the data-access cache first, so a row deleted on another pod does not come back from this pod's cache as a "default".

Tests

  • AssistantDefaultsChangelogTest now runs the changelog through real Liquibase 4.33.0 (kof22's version) on H2 in PostgreSQL mode:
    • fresh schema: all 10 changesets EXECUTED;
    • re-run: nothing runs again and edits survive;
    • already configured host (own policy, own default profile, own budget, own price): untouched, and the policy, profile, budget and price changesets are MARK_RAN;
    • missing table: MARK_RAN, the rest apply;
    • seeded rows drive the runtime (persona, a skill in the model request, a budget warning, the policy).
  • AssistantSetupTest: a config-priced model shows OK, an unpriced cloud model needs setup, a local model shows OK, and adding a price row shows OK.
  • ./mvnw verify: 270 tests, 0 failures, JaCoCo gate green.

🤖 Generated with Claude Code

Follow-up to #48. It was merged before review finished and has not been released yet; the release captain is holding RC.13 until this lands. ## Fixes 1. **The changelog failed to parse in Liquibase.** `-- precondition-table-exists tableName:` is rejected by Liquibase 5 and unsupported in 4.19, so a host's whole migration would fail. Every precondition is now a `sql-check` (`... WHERE 1 = 0` means "the table exists"), with `onFail/onError: MARK_RAN`. 2. **Seeds could change an existing host on deploy.** - The policy, the $50 budget and the Anthropic prices are now seeded **only into empty tables**. Price rows take precedence over `withPricing`, so a host's configured prices are never overridden. - The `default` profile is seeded only when **no default profile exists**, so there is never a second default. 3. **The Setup card showed false "needs setup" for prices.** It now prices the default model through `ProviderService.pricing(...)`: registry row, then price row, then config. Local models count as free. 4. **"Add rows for every table" could read a stale cache.** It now invalidates the data-access cache first, so a row deleted on another pod does not come back from this pod's cache as a "default". ## Tests - `AssistantDefaultsChangelogTest` now runs the changelog through **real Liquibase 4.33.0** (kof22's version) on H2 in PostgreSQL mode: - fresh schema: all 10 changesets EXECUTED; - re-run: nothing runs again and edits survive; - **already configured host** (own policy, own default profile, own budget, own price): untouched, and the policy, profile, budget and price changesets are MARK_RAN; - **missing table**: MARK_RAN, the rest apply; - seeded rows drive the runtime (persona, a skill in the model request, a budget warning, the policy). - `AssistantSetupTest`: a config-priced model shows OK, an unpriced cloud model needs setup, a local model shows OK, and adding a price row shows OK. - `./mvnw verify`: 270 tests, 0 failures, JaCoCo gate green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.