Repository navigation
feat(id): loc.* capability core — catalog, sensor-cap ledger, consent/precision refusals (#2341 slice 1) - #5317
Conversation
…/precision refusals (#2341 slice 1) Pure core in id-core/world_caps.rs: loc.position (request) and loc.watch (subscription) catalog entries registered as sensor caps with DefaultCeiling::Excluded; grant-ledger refinement so a wildcard grant never reaches loc.* and grant-on-use never mints a durable sensor grant (explicit ceiling + explicit grant required); refusal vocabulary consent_required / os_permission_denied (cap_denied), precision_ceiling (outside_ceiling), no_fix (failed); typed LocationReading {lat, lon, accuracy_m, fix_age_ms, source} with validation and precision-ceiling refusal; LocationConsent seam mapping; loc.watch interval floor (5s) parsing and the consent_withdrawn revocation event. Docs: doc/2026-11-04T06-40-00Z_feature_loc-capability.md (interval floor, battery note, browser/phone/ESP32 platform notes). Host wiring in the world actor is slice 2, tracked as a follow-up queue task; until it lands no host serves a fix. Tests: id-core 296+5 pass (world_caps 29/29 incl. 8 new loc tests); two pre-existing catalog/ceiling tests updated for the intended 19-name catalog and sensor-excluded default ceiling. cargo check -p id OK.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
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. |
Codex Review SummaryThis 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: fba0013e5d
ℹ️ 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".
| argument_schema: ArgumentSchema::JsonObject(LOC_POSITION_ARGUMENTS), | ||
| bounds: LOC_POSITION_BOUNDS, | ||
| required_scope: RequiredScope::Join, | ||
| default_ceiling: DefaultCeiling::Excluded, |
There was a problem hiding this comment.
Update the world restore test for the narrower default ceiling
Adding catalog entries excluded from the default ceiling makes a_default_ceiling_is_not_written_and_old_journals_allow_the_whole_catalog in pkgs/id/src/world/tests.rs fail: its assertion at lines 2662–2665 still compares the restored ledger's allowed set against catalog_names(). Restore correctly uses default_ceiling_names(), so the actual set now lacks both location capabilities while the expected set includes them. Update that test's expectation and name to reflect the intentional default-ceiling behavior; the reported id-core tests and cargo check -p id do not exercise this assertion.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3660b45 — thank you. Renamed the test to a_default_ceiling_is_not_written_and_old_journals_allow_the_default_ceiling and updated the expectation to default_ceiling_names() (the catalog minus the DefaultCeiling::Excluded sensor caps), with a comment naming the #2341 semantics. Verified on the laptop worktree: cargo test -p id a_default_ceiling_is_not_written — 1 passed (2110 filtered). Also swept the other catalog_names() call sites in pkgs/id/src — both are dynamic (a server-ceiling set built by filtering the catalog, and a SetCapsCeiling payload) and are unaffected by the narrower default.
…catalog (#2341) Codex P2 on PR #5317: a_default_ceiling_is_not_written_and_old_journals_allow_the_whole_catalog asserted the restored ledger allowed set equals catalog_names(); with loc.* registered as DefaultCeiling::Excluded the restored default ceiling is catalog minus the sensor caps. Renamed the test and updated the expectation to default_ceiling_names(). Verified: cargo test -p id a_default_ceiling_is_not_written — 1 passed.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
…ce 2) Slice 1 (PR #5317) landed the pure core in id-caps; this wires it into the host. Subscription::LocWatch parses loc.watch specs through parse_loc_watch_interval_ms. The actor gains location consent/source seams beside device_manifest, defaulting to ConsentRequired and no fix, so a stock host refuses rather than fabricates. loc.position executes ledger -> consent seam -> source, with precision-ceiling refusals via refuse_beyond_ceiling. loc.watch arms on presence while consent stands, delivers reading events per interval, and closes with exactly the revocation event when consent is withdrawn. Tests: 4 new actor/world tests; world:: 308/308, id-caps 83/83.
…ce 2) Slice 1 (PR #5317) landed the pure core in id-caps; this wires it into the host. Subscription::LocWatch parses loc.watch specs through parse_loc_watch_interval_ms. The actor gains location consent/source seams beside device_manifest, defaulting to ConsentRequired and no fix, so a stock host refuses rather than fabricates. loc.position executes ledger -> consent seam -> source, with precision-ceiling refusals via refuse_beyond_ceiling. loc.watch arms on presence while consent stands, delivers reading events per interval, and closes with exactly the revocation event when consent is withdrawn. Tests: 4 new actor/world tests; world:: 308/308, id-caps 83/83.
…ce 2) (#8643) * feat(id): wire loc.position/loc.watch into the world actor (#2341 slice 2) Slice 1 (PR #5317) landed the pure core in id-caps; this wires it into the host. Subscription::LocWatch parses loc.watch specs through parse_loc_watch_interval_ms. The actor gains location consent/source seams beside device_manifest, defaulting to ConsentRequired and no fix, so a stock host refuses rather than fabricates. loc.position executes ledger -> consent seam -> source, with precision-ceiling refusals via refuse_beyond_ceiling. loc.watch arms on presence while consent stands, delivers reading events per interval, and closes with exactly the revocation event when consent is withdrawn. Tests: 4 new actor/world tests; world:: 308/308, id-caps 83/83. * fix(id): disposition PR #8643 Codex findings — disarm watches on authority removal, enforce MAX_LOC_WATCHES, reject malformed accuracy ceilings (#2341) P1: reconcile_subscriptions now disarms loc_watches alongside ticks when capability authority is removed (UpdateCaps/SetCapsCeiling), and fire_loc_watches rejects stale watches before delivering readings. P2: parse_wants enforces MAX_LOC_WATCHES at parse time, mirroring the tick-interval bound. P2: loc.position treats a supplied max_accuracy_m that is not an unsigned integer as bad_args instead of silently dropping the precision check. Tests: loc_watch_disarms_when_capability_authority_is_removed, parse_wants_refuses_more_than_max_loc_watches, loc_position_refuses_a_malformed_accuracy_ceiling. Targeted: cargo test -p id -p id-caps loc — pass; cargo test -p id-caps — 83/83. * fix(id): disposition PR #8643 Codex round-2 findings — prune stale loc timers on wants change, serve fix age at delivery time (#2341) P2 (timers): apply_subscriptions now prunes loc_watches against the active subscriptions when subscriptions leave the wants, the same prune reconcile_subscriptions applies on authority change — a replaced watch no longer leaves a timer behind until its distant deadline, so the timer map and every next_deadline scan stay bounded by the active set. P2 (fix age): the actor records when the cached location fix was received (location_fix_received_at, stamped by set_location_fix on the world clock), and both serving paths (loc.position and loc.watch delivery) add the elapsed time to fix_age_ms, which is defined as the age when delivered. A fix is never served claiming to be younger than it is. Tests: loc_watch_timers_are_pruned_when_subscriptions_leave_wants; the two watch delivery tests now expect the aged reading (fix_age_ms 250 received at t=0 delivers as 5250 at t=5000). cargo test -p id loc — pass. * style(id): rustfmt the VarLocProgram records() added for #8643 round-2 --------- Co-authored-by: repo-worker-tmp-code-b <fleet@developing.today>
Refs #2341 (task 9173, repo-health-code-pilot) — slice 1 of 2: the pure core. The issue stays open; host wiring is slice 2 (follow-up queue task enqueued from task 9173).
What lands here (
pkgs/id/crates/id-core/src/world_caps.rs)loc.position(request, optionalmax_accuracy_m) andloc.watch(subscription,loc.watch:<ms>) registered with manifests as sensor caps,DefaultCeiling::Excluded— registering them widens no existing world's authority (id(world): default ceiling is the whole catalog, so F12.4 registry additions would widen every world #838 pattern).*) grant never reachesloc.*(decide/is_granted/effective), and grant-on-use never mints a durable sensor grant — an ungranted sensor use is refusedcap_denied/consent_required. A world needs an explicit ceiling entry and an explicit grant.consent_required,os_permission_denied(cap_denied);precision_ceiling(outside_ceiling);no_fix(failed) — plus genericdenied_with/outside_ceiling_with/failed_withconstructors.LocationReading {lat, lon, accuracy_m, fix_age_ms, source},source ∈ gnss | network | ip | caller_supplied, range validation, exact wire JSON, andrefuse_beyond_ceilingso an imprecise fix is refusable rather than plausible-looking.LocationConsent::{Granted, ConsentRequired, OsPermissionDenied}→ refusal mapping, so every host refuses the same way.MIN_LOC_WATCH_INTERVAL_MS= 5s floor withparse_loc_watch_interval_ms,MAX_LOC_WATCHES= 4, the reading delivery event, and the exact revocation event{"cap":"loc.watch","event":"revoked","reason":"consent_withdrawn"}.doc/2026-11-04T06-40-00Z_feature_loc-capability.md— interval floor + battery note, per-platform notes (browser geolocation, phone tiers, ESP32 GNSS), out-of-scope list.Tests
cargo test -p id-core: 296 + 5 pass (world_caps 29/29, including 8 new loc tests: wildcard-never-reaches, explicit grant reaches, grant-on-use never mints, default-ceiling exclusion, reading shape/sources, precision-ceiling refusal, consent vocabulary, interval floor + revocation event).cargo check -p idOK. No behavior change for existing caps.Not in this slice
Executing the providers in
src/world/actor.rsagainst a host location/consent seam, and closing open watches in the actor on consent withdrawal. No host location source exists today; the default host must answerno_fix/consent_required, never a fabricated fix.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.