protocol: split the refusal into an attach half and a spawn half #345
No reviewers
Labels
No labels
priority/P0
priority/P1
priority/P2
release/v0.1.0
status/blocked
status/planned
type/bug
type/design
type/test-gap
type/tracker
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
natsukium/felis!345
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-326-b"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #326 (item 6, plus item 4's
ConnectErrorgolden). Rebase onto #326's PR A before merge; the two touchdocs/reference/cli.md,CHANGELOG.mdandcrates/felis-cli/src/cli_output.rsin different places.The wire
AttachFailurecarried nine values across two unrelated situations. It keeps the five the attach half can answerwith —
UnknownSession,SessionEnding,SessionExited,NoMatch,Ambiguous— renumbered densely; the four thespawn half answers with become
CreateFailure(SpawnFailed,GeometryOutOfRange,SessionLimitReached,DaemonDraining).SessionAttachFailed.reasonis a oneof of the two withdetailat tag 3, and an unset one isMissingOneof("SessionAttachFailed.reason");SpawnRefused.reasonis aCreateFailure, since anOpsSpawnsubscribes to nothing. Dense numbering, no
reserved, per the #339 policy. The break is acknowledged incrates/felis-protocol/proto/BREAKING.mdagainst6da5620dwith its skew outcome, andjust proto-compatpasses.Domain:
AttachRefusal { Attach(AttachFailure), Create(CreateFailure) }onSessionMsg::AttachFailed,CreateFailureonSpawnOutcome::Refused. The daemon'screate_sessionreturns aCreateFailure;SubscribeFailure::refusalstays attach-side, and aCreatewhose post-spawn subscribe loses the reap race isanswered on the
attacharm. Everydetailstring is unchanged.The admissibility rule
Which values each request admits is now checked at value level, in one place
(
felis_client_core::admits(ctx, reason)overSessionRefusalContext): an attach by exact id admits{UnknownSession, SessionEnding}plusSessionExitedunderlive_only; an attach by prefix admits{NoMatch, Ambiguous, SessionEnding}plusSessionExitedunderlive_only; a create admits anycreatevalue orattach = SessionEndingalone. Anything else is a protocol failure (exit2,protocol), never a typed refusal, soa non-conforming daemon cannot make
felisreport a merits decision it never took. Running it needs the requestbeside the reply, so
ControlRequest::interprettakes&self; a refusal that fails the check retires the connection,and the next verb on a reusable
Opslink is answeredAbandonedwithout touching the socket. A table test coversevery (context, arm, value) triple, and one asserts the second verb is refused with a valid reply already on the wire.
The client-core error split
ConnectError::AttachFailed { reason: AttachFailure, .. }and a newConnectError::CreateFailed { reason: CreateFailure, .. }.connect_and_attachproduces onlyAttachFailed,createeither,
spawn_sessiononlyCreateFailed.is_transientis unchanged in effect.cli_output.rsgainsfrom_create_failurebesidefrom_attach_failure; thekindtokens and exit codes do not move.The felis-json v1 adapter
The published v1 shape is not retyped (
ipc.md"Compatibility within a version"; #336 recorded the rule forconsumers outside this repository).
AttachFailureJsonkeeps its nine flat tokens andSessionJson::AttachFailed { reason, detail }keeps its shape; aFrom<AttachRefusal>flattens both arms onto themand the reverse picks the arm from the token, which is unambiguous because the two halves are disjoint.
just schemaproduces no diff and every existing golden is byte-identical. Two golden cases are added (one refusal per half), and
the missing
pub use ThemeActionJsonfrom #342 is restored.Gates
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run --workspace --all-features --no-fail-fastjust schemajust proto-compatjust prose-checkjust docs-links/just skill-check/just deny/just check-portable/just proto-compat-testnix develop .#windows -c cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnu -- -D warningsSatellites (
felis.eland the four crate-linking repos) are the tag checklist on #326 and are untouched here.49e219437a189314c8be189314c8bef25b98557b