Repository navigation
refactor(core): name device login statuses in one enum - #628
Draft
PiquelChips wants to merge 2 commits into
Draft
PiquelChips wants to merge 2 commits into
PiquelChips wants to merge 2 commits into
Conversation
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
PiquelChips
force-pushed
the
refactor/core-stream-messages
branch
from
November 22, 2026 15:25
c7e609d to
c2990ba
Compare
PiquelChips
force-pushed
the
refactor/core-device-login-status
branch
from
November 22, 2026 15:25
f2642c6 to
310aef1
Compare
This was referenced Nov 22, 2026
PiquelChips
force-pushed
the
refactor/core-stream-messages
branch
from
November 22, 2026 22:12
c2990ba to
be5bde9
Compare
A device login poll's status (`authorization_pending`, `slow_down`, `complete`) was a string the daemon wrote and `piquelctl login` matched on as literals. `DeviceLoginStatus` in piqueld-core names each one; the daemon builds `DeviceToken.status` from it and the CLI parses it. `DeviceToken.status` stays a `String`, so the CLI still reads statuses a newer daemon adds, and the OpenAPI document stays the same. Fixes PQD-161
`DeviceLoginStatus` drops the serde derives nothing uses, with the test of them: the macro already makes each status parse back and rejects a duplicate string. The note on `DeviceToken.status` says what an unknown status does: it still decodes, and `piquelctl` stops with an unexpected response. Fixes PQD-161
PiquelChips
force-pushed
the
refactor/core-device-login-status
branch
from
November 22, 2026 22:13
310aef1 to
03dc7a2
Compare
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.
What and why
A device login poll's status (
authorization_pending,slow_down,complete) was a string that the daemon (apps/piqueld/src/auth/sessions.rs)wrote and
piquelctl login(apps/piquelctl/src/auth.rs) matched on asliterals. This adds
DeviceLoginStatustopiqueld_core::auth, astring_enum!with a doc comment on each status. The daemon buildsDeviceToken.statusfrom it, and the CLI parses the status into it.Fixes PQD-161. Stacked on #627, which is stacked on #624.
Nothing changes on the wire. Each status keeps its string.
Fields kept as strings:
DeviceToken.statusstays aString, so aresponse with a status this build doesn't know still decodes, and
piquelctlstops with "unexpected device login response", as it did before.Keeping it a string also keeps the OpenAPI document and generated client
identical. The note on it is a
//comment, so the schema descriptiondoesn't change.
Proof: the existing tests unchanged, and a codes-only diff showing that
all 7 replaced literals map to a variant with the same string. No per-enum
test:
string_enum!buildsas_strandparsefrom one table, and aduplicate string fails
-D warnings(unreachable_patterns).Commands and results
cargo nextest run -p piqueld-core -p piqueld-store -p piqueld -p piqueld-client -p piquelctl --all-featuresat this head: 1006/1006 passed. These include
api_contract::authenticationand the daemon's device login tests, which still assert the literal
strings. The earlier run's one failure,
concurrent_credential_updates_preserve_every_login(the known load flakein the credentials-file lock), passed this time.
-D warningsforpiqueld-core,piqueld-store,piqueld,piqueld-client,piquelctl(--all-targets --all-features) and the wasm32 line forpiqueld-uiandpiqueld-client: clean.generate_openapi --check: every generated file is up to date.just docs: 0 errors.7 literals replaced, 0 without a matching variant.No status literal is left outside the enum and tests.
Checklist
AGENTS.mdit applies to,documentation included, with its reverse states. (Internal refactor:
no surface changes.
docs/dev/rust-conventions.mdnames the type.)Note
Written by Claude Opus 5.5 in Claude Code (via T3 Code)