Skip to content

fix: decode a GetSessionPolicy error reply as Err, not an empty policy - #1055

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/session-policy-errorable-decode-8abda4ca0af71f41
Jul 29, 2026
Merged

fix: decode a GetSessionPolicy error reply as Err, not an empty policy#1055
norrietaylor merged 1 commit into
mainfrom
inbox-patch/session-policy-errorable-decode-8abda4ca0af71f41

Conversation

@gominimal-aw-bot

@gominimal-aw-bot gominimal-aw-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1025
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKmgZqg

min session policy returned an all-null policy with exit 0 for nonexistent, destroyed, or mistyped sessions — a silent false negative on a security-introspection command. The daemon replies {"error":"no session found"}, but the client wire type Errorable<SessionPolicy> is #[serde(untagged)] and every SessionPolicy field is Option, so the error object decoded as a valid Ok(SessionPolicy { egress: None, ingress: None }). The fix adds #[serde(deny_unknown_fields)] to SessionPolicy so the untagged decoder rejects the error key on the Ok arm and falls through to Err; wire serialization is unchanged. The GetSessionPolicy/Errorable contract this touches was introduced by minimal#521 (informed by #521). A regression test in minimald-rpc pins both directions.

Verification

cargo fmt --all --check — pass, no drift
cargo clippy --workspace --locked -- -D warnings — pass, 0 warnings (finished in 8m 19s)
cargo build --workspace --locked — pass (finished in 3m 47s)
cargo test --workspace --locked — pass; minimald-rpc 17 passed / 0 failed, incl. errorable_session_policy_decodes_daemon_error_as_err

Generated by inbox-patch ·

Note

Fix GetSessionPolicy error replies decoding as empty policy instead of Err

Adds #[serde(deny_unknown_fields)] to SessionPolicy in sessions/src/lib.rs so that Errorable<SessionPolicy> (untagged enum) no longer accepts {"error":"..."} as a valid empty policy — it now correctly matches the Err arm. A regression test in minimald-rpc/src/lib.rs verifies both the error and valid-policy decode paths.

Behavioral Change: any SessionPolicy JSON with fields other than egress and ingress now fails deserialization; previously unknown fields were silently ignored.

Macroscope summarized 0b344d7.

`min session policy` reported no restrictions with exit 0 for
nonexistent, destroyed, or mistyped sessions: a silent false negative
on a security-introspection command.

The daemon replies with an error object, but the client wire type
Errorable<SessionPolicy> is #[serde(untagged)] and every SessionPolicy
field is Option, so that error decoded as a valid empty Ok policy
instead of the Err arm.

Add #[serde(deny_unknown_fields)] to SessionPolicy so the untagged
decoder rejects the error key on the Ok arm and falls through to Err.
Serialization is unchanged; a regression test is added in minimald-rpc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 14 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1f27b53c-da33-46a5-b5eb-011a9b0f3e89

📥 Commits

Reviewing files that changed from the base of the PR and between c1d466c and 0b344d7.

📒 Files selected for processing (2)
  • crates/minimald-rpc/src/lib.rs
  • crates/sessions/src/lib.rs

Comment @coderabbitai help to get the list of available commands.

@norrietaylor
norrietaylor marked this pull request as ready for review July 29, 2026 17:21
@norrietaylor
norrietaylor enabled auto-merge (squash) July 29, 2026 17:22
@norrietaylor
norrietaylor merged commit d2d2e61 into main Jul 29, 2026
29 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/session-policy-errorable-decode-8abda4ca0af71f41 branch July 29, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

min session policy reports “no restrictions” for a session that does not exist: an untagged Errorable decodes the daemon's error as an empty policy

1 participant