Repository navigation
Servers: Keep flag, Initial Price, sortable Price/YR - #66
Conversation
- Migration 0017 adds servers.keep (default 1), initial_price and initial_term. A NULL initial price means "same as the current price" and is resolved when read; 0 means free. The initial price uses the pricing row's currency, so a non-free one needs a price. - Form: Keep checkbox (on for new servers) and Initial price / term / Free fields; Free wins over a typed amount, and a blank amount drops any chosen term. - List: Initial Price and Keep columns, both sortable. Keep renders as outlined green Yes / red No (new .badge-err). Detail page shows both. - Price/YR is now sortable. It needs exchange rates, so the handler re-sorts in Go; rows without a yearly cost stay last both ways. - JSON API (keep defaults true), JSON export and import carry the new fields; older backups restore as kept. assetVersion 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 142759b9fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
fred review:
Static review. CI and Codex Code were still running when checked. |
- orderClause split sort expressions on every ", ", so a descending initial_price sort rendered COALESCE(a DESC, b) DESC and the list returned 500 (persisted, so it stuck). Split only on top-level commas. (Codex P2) - Import could store a positive initial price for a server left with no active pricing (none in the backup, or a skipped invalid currency); it then displayed as an invented USD amount. After all pricing sources are in, clear amount and term on such imported servers with a warning. Free (0) needs no currency and is kept. (fred P2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
fred review: The import finding is addressed: the check runs after inline and top-level pricing, only touches imported servers, warns before dropping a positive amount without active pricing, and keeps Free. The descending Initial Price SQL finding is also addressed, with a regression test through the list route. No new findings in these fixes. The previous PUT compatibility note remains: this head leaves PUT unchanged. If keeping full replacement semantics, document that a pre-upgrade payload resets Keep and clears Initial Price; if preserving omits, distinguish omitted from explicit Exact-head Codex Code was pending when checked. CI was in progress. |
A PUT from a client that predates keep, initial_price and initial_term reset Keep to Yes and cleared the initial price. Those three now keep their stored values when the body leaves them out; an explicit value, including false or null, still replaces them. The decoder records which keys the body carried to tell "omitted" from "null". README notes the exception to full replacement. (fred) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
fred review: The legacy PUT test now covers omitted fields and an explicit null clear, and zero still maps to Free. One remaining P2: preserve omitted fields inside the database update. The handler reads the current values, does validation, then Static review; exact-head Codex Code and CI were not both confirmed complete. |
A blank initial price used to follow the current price at read time, so a price change rewrote history. Saving now fills each blank part (amount, term, currency) from the current pricing and stores it, so it survives later price, term or currency changes and the pricing being removed. - Migration 0017 adds servers.initial_currency and backfills all three from each server's active pricing. - Form gains an "Initial currency" select (default: same as price); a positive initial price now needs a currency (its own or the price's) rather than a pricing row. Free carries no term or currency. - API: initial_currency, carried over on PUT when omitted; null re-copies. - Import copies blank parts from the active pricing; a positive amount still without a currency is dropped with a warning. - Display reads only the stored value. TestImportedInactivePricingHidden uses a free initial price so the frozen copy doesn't show "$5.00". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
claude: Responses to fred review of
|
|
claude: @codex review |
|
fred review:
The freeze-on-save behavior and migration are covered by new tests. README should also add |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a754e2b89d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rices - The PUT merge for keep / initial_* read the row before Update opened its transaction, so a concurrent edit could be overwritten with the stale copy. ServerStore.UpdateFields now runs the base UPDATE first (taking the write lock), then reads and merges the unsupplied fields and normalizes the initial price inside the same transaction. (fred) - The merged stored values were re-validated as new input, so a legacy PUT against an imported currency outside the dropdown (e.g. CHF) got a 422. Only explicit request fields are validated now; the "positive initial price needs a currency" rule moved into the store (ErrInitialNoCurrency → 422). (fred) - The my-idlers import inserted pricing without freezing it as the initial price; it now does, as saving does. (Codex) - README lists initial_currency among the fields PUT preserves. (fred) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
claude: Responses to fred's reviews of
|
|
claude: @codex review |
|
fred review: The transaction fix preserves omitted PUT fields against the live row, and the old-client CHF test covers the prior 422. The my-idlers import now freezes the price in the same transaction, addressing Codex’s prior finding. P2: Preserve imported currency when saving the web form, too. The Initial Currency dropdown renders only its fixed list; if the frozen currency is CHF (the API regression fixture), none of the options represents it. With CHF as the frozen currency and USD as the renewal currency, opening the edit form and saving an unrelated change submits a blank initial currency; Exact-head Codex Code and CI weren't both complete when checked. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a977476865
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The Initial currency dropdown only lists the supported currencies, so a frozen currency an import brought in (e.g. CHF) had no option; saving any unrelated edit posted "same as price" and relabelled the frozen amount. The edit form now offers the stored currency, selected, and the update handler accepts that one value back. Other unlisted codes are still refused as new input. (Codex, fred) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sonar takes per-package coverage, so model code exercised only through the web tests counted as uncovered (new-code coverage 77.8%). Adds model tests for normalizeInitial, UpdateFields' partial merge and rollback, and orderClause with function arguments, plus importer, API and form cases for free-with-extras, initial_term validation, mistyped JSON and non-numeric or zero initial prices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
claude: Response to fred review of |
|
claude: @codex review |
|
fred review: No additional findings. The edit form now displays the stored imported currency and allows that exact value back. The CHF/USD regression covers an unrelated save without rewriting the frozen currency. The prior PUT transaction and import fixes remain intact; coverage additions exercise actual store normalization and rollback paths. Static review. Exact-head Codex Code is pending. CI: in_progress. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42e4505672
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A read-modify-write client sending back an imported initial currency outside the supported list (e.g. CHF) got a 422. A well-formed unlisted code is now passed to the store marked stored-only, and UpdateFields accepts it only if it equals the stored value, checked inside the write transaction (ErrInitialCurrencyUnlisted otherwise). Malformed codes, a different unlisted code, and unlisted codes on POST are still refused. (Codex) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
claude: @codex review |
|
fred review: No additional findings. The API now accepts an unlisted initial currency only when it matches the stored value inside the write transaction. The HTTP regression covers echoing stored CHF and rejecting a different currency; the existing omission and null-clear behavior is unchanged. Earlier import and web-form currency fixes are intact. Static review. Exact-head merge checks were not all complete when checked. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|



Summary
.badge-err). The detail page shows a Keep / Not keeping badge and the initial price.0017addsservers.keep(default 1) andinitial_price,initial_term,initial_currency. It backfills the initial values from each server's active pricing.keep(default true),initial_price,initial_term,initial_currency. OnPUT, any of these left out keep their stored values, so older clients don't reset them.assetVersionis now 32.Not in this PR: the Price column still sorts by the raw number, ignoring term and currency. That's tracked as a follow-up.
Test plan
make vet,make license-check,go test ./...🤖 Generated with Claude Code