Step 5: the policy and pending actions #6
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.55) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.55 · 621 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.385
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #6"
general
weight: 0.35
b3hr4d
<!-- claude-projects-attribution: {"github_login":"b3hr4d"} -->
_Requested by Behrad · project thread_
Before: a wallet had exactly the owner who claimed it. Nobody could add a device, change a role or set a policy.
After: members change members and the policy through actions. An owner proposes, owners and approvers approve and execute, owners reject, and viewers only read. An action waits for its rule's quorum (the proposer's approval counts), then for its timelock, and then it can be executed. A signed-in non-member can ask to join with
request_join, which becomes anAddMemberaction for a viewer. Seven new methods answer:propose,approve,reject,execute,pending,policyandrequest_join.The rules, all in
docs/design.mdunder "Approve an action":executechecks the action again against the current members and policy; one that no longer fits endsFailedwith the reason, and the call returnsOkwith that state.SetPolicyrule at least as strict as every other rule, so changing the policy is never the way around a rule.How: three pure modules hold the logic.
policy.rsvalidates policies and computes the terms of an action, including the daily-limit fast path that transfers will use in step 8.actions.rsis the life of one pending action.governance.rsapplies membership and policy changes to an in-memory copy of the members and the policy and refuses any change that breaks the rules above.storage.rsadds the policy (memory id 1), the actions (memory id 4, never deleted, so an id never names another action) and an index of the open ones (memory id 10, new indocs/design.md), so no call reads the whole history. Role checks are guards, like the member check from step 4.Upgrades: a wallet installed and claimed with step 4 has no policy, so
post_upgradenow gives it the default one before it checks the state (Codex's finding). CI now builds the pull request's base, installs and claims it in PocketIC and upgrades it to the change, on every pull request from here on.Tests: property tests (
proptest1.11.0, a dev-dependency only) check that an action runs only with its quorum, only after its timelock and never after its expiry, under any sequence of approvals, rejections, executions and waits; that only transfers within their daily limit skip their rule; thatSetPolicyis never weaker than another rule; and that any sequence of membership and policy changes leaves the wallet governable, with a refused change changing nothing. PocketIC tests advance time through a timelock (also across an upgrade), past the approval expiry and the join-request expiry, and cover rejection, a failed execution, dropped approvals, the join-request cap and the role refusals. The enumeration test from step 4 now finds seven guarded methods.Fault injection, each against the real Wasm: dropping the policy migration, skipping the timelock check, starting the timelock at the proposal, ignoring expiry, keeping a removed member's approvals, skipping the re-check at execution, allowing the last owner's removal, allowing a weaker
SetPolicyrule, lifting the join-request cap, letting approvers propose, joining as an owner, leaving expired ids in the index, and an off-by-one daily limit each make at least one test fail.Choices made without you, all easy to change:
SetPolicyandUpgrade, none for the rest. Both are still listed as open decisions.ChangeRolewith its 24-hour timelock.Transfer,InstallExtension,UninstallExtensionandUpgradeproposals are refused until their steps.Checks run locally:
cargo fmt --all --check, clippy native and wasm32 with-D warnings, unit, property and interface tests, the release Wasm build, and the PocketIC tests against server 16.1.0, including the upgrade from step 4's Wasm.🤖 Generated with Claude Code
https://claude.ai/code/session_013Vgh2De8Zarye1iDyGSRbe