Repository navigation
Show detected plan evidence from the CLI - #15
Merged
Merged
Conversation
Converting local_auth subscriptions into plan observations moved detected plans out of `subscription list` and cleared `plan_name` from `account list`, and nothing reads `account_plan_observations`. The plans an account is on became visible only after syncing to the hosted dashboard. `account plans` reports the newest stored observation per account, with every observation behind `--all`. It deliberately does not derive a timeline: that derivation lives in the API, and a second copy here could disagree with it. The field is `latest_observation`, not `current_plan`, for that reason. Providers are canonicalized before filtering and grouping. The legacy migration copies a subscription provider string through verbatim, so a stored `Codex` would otherwise be hidden from `--provider codex` and listed again under its own heading.
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.
Adds
statsai account plans, closing a gap opened by #14.Why
The account-plan evidence work converted Codex
local_authsubscriptions intoaccount_plan_observationsand clearedplan_namefrom the account rows. Bothchanges are correct — a plan detected from
auth.jsonis not a billing record,and the price those rows carried came from a hardcoded
"plus" => 2000tablerather than from the user.
But nothing in the CLI reads
account_plan_observations. Sosubscription listwent from four rows to one,
account listnow returnsplan_name: null, and theplans an account is on became visible only after syncing to the hosted dashboard.
For the open-source, local-first half of the product that is a regression in
reach even though no data was lost.
What it does
Reports the newest stored observation per account, plus the observation count,
and every observation behind
--all. Against a real store:That matches the dashboard's cards, including the Free that explains why the
manual $20 subscription on that account needed ending.
What it deliberately does not do
It does not derive a plan timeline.
deriveAccountPlanHistorylives in thehosted API, and a second implementation here could disagree with it about the
same rows. The field is
latest_observation, notcurrent_plan: it reports themost recent thing this machine recorded, not a verdict about what the account is
on now. Observations that never resolved to an account are still listed, under a
null account id, rather than dropped.
Review notes
A review pass on the first draft found two issues, both fixed here:
codexcase-insensitively and then copies the subscription's own providerstring through, so a stored
Codexwould have been hidden from--provider codexand listed again under its own heading. Providers are nowcanonicalized (case-folded before the alias lookup, since
adapter_for_providermatches exact lowercase literals) before both thefilter and the grouping key.
while no fixture set that flag. A fixture now sets
is_current_snapshot: trueon an older observation, and another stores its provider as
Codex, so bothbehaviours are actually exercised.
Verification
cargo test -p statsai -p statsai-store -p statsai-adapters(193 + 237 + 210),cargo clippy --all-targets -D warnings,cargo fmt --check, and a manual runagainst a 3.8 GB store.