Require posture on strand creation#544
Conversation
📝 WalkthroughWalkthrough
ChangesRetentionPosture enforcement across strand lifecycle
Sequence Diagram(s)sequenceDiagram
participant Client
participant ForkStrandRequest
participant WorldlineRuntime
participant StrandRegistry
participant SettlementService
Client->>ForkStrandRequest: from_session_default(session_ctx) / debugger_default(session_ctx)
ForkStrandRequest->>ForkStrandRequest: derive retention_posture from SessionContext
Client->>WorldlineRuntime: fork_strand(request)
WorldlineRuntime->>StrandRegistry: insert(Strand { retention_posture })
StrandRegistry->>StrandRegistry: retention_posture.validate()
StrandRegistry-->>WorldlineRuntime: Ok / StrandError::Posture
WorldlineRuntime-->>Client: ForkStrandReceipt { retention_posture }
Client->>SettlementService: plan_with_policy(strand)
SettlementService->>SettlementService: check causal_posture == Shared
alt posture is not Shared
SettlementService-->>Client: SettlementError::NonSharedStrand
else posture is Shared
SettlementService->>SettlementService: build_braid_shell(strand_posture)
SettlementService->>SettlementService: plural_draft(strand_posture)
SettlementService-->>Client: SettlementPlan
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1eacd3876d
ℹ️ 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".
@codex please confirm these are the complete actionable issues for this pass. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1eacd3876d
ℹ️ 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".
|
@codex Self-discovered issue during P1 warp-wasm RED verification.
|
|
Summary
Testing
|
Activity Summary@codex Review repair pass completed for the posture-on-strand-creation PR.
Resolved review threads: Local witnesses:
Pre-push witnesses passed on final head |
Summary
Testing / Checks
|
|
@codex please confirm this self-review finding. Self-Code Review Findings
No P0/P1 findings were found in this self-review. Remote CI is green at the time of review, and the worktree was clean before fetch/review. |
|
Resolved the self-review P2 in What changed:
Local witnesses:
@codex self-review finding is addressed; please confirm. |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/warp-wasm/src/warp_kernel.rs`:
- Around line 426-431: The SettlementError::NonSharedStrand case in the
warp_kernel.rs file is incorrectly using the error_codes::INVALID_STRAND code,
which is documented as "requested strand is not registered" in the ABI contract.
However, this case represents a different error condition where the strand
exists but settlement is forbidden by its posture policy. Either create a new
dedicated error code constant for settlement-policy rejection and use it in the
NonSharedStrand match arm, or coordinate with the team to intentionally broaden
the ABI contract definition for code 14 and update all downstream callers and
documentation accordingly. Do not leave the meaning of the error code ambiguous
on the wire.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 61466ee0-086f-4459-b6c1-611aa718e135
📒 Files selected for processing (10)
CHANGELOG.mdcrates/warp-core/src/coordinator.rscrates/warp-core/src/neighborhood.rscrates/warp-core/src/observation.rscrates/warp-core/src/revelation.rscrates/warp-core/src/settlement.rscrates/warp-core/src/strand.rscrates/warp-core/tests/strand_contract_tests.rscrates/warp-wasm/src/lib.rscrates/warp-wasm/src/warp_kernel.rs
| SettlementError::NonSharedStrand { strand_id, posture } => AbiError { | ||
| code: error_codes::INVALID_STRAND, | ||
| message: format!( | ||
| "strand {strand_id:?} with posture {posture:?} is not shared-admitted for settlement" | ||
| ), | ||
| }, |
There was a problem hiding this comment.
Don’t overload INVALID_STRAND for admission-policy rejection.
INVALID_STRAND is still documented as “requested strand is not registered” in the ABI contract. Reusing code 14 for NonSharedStrand changes the machine-readable meaning on the wire and makes “strand missing” indistinguishable from “strand exists but settlement is forbidden by posture policy”. Either add a dedicated ABI code for settlement-policy rejection, or update the ABI/spec contract and downstream callers in the same change if code 14 is being broadened intentionally.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/warp-wasm/src/warp_kernel.rs` around lines 426 - 431, The
SettlementError::NonSharedStrand case in the warp_kernel.rs file is incorrectly
using the error_codes::INVALID_STRAND code, which is documented as "requested
strand is not registered" in the ABI contract. However, this case represents a
different error condition where the strand exists but settlement is forbidden by
its posture policy. Either create a new dedicated error code constant for
settlement-policy rejection and use it in the NonSharedStrand match arm, or
coordinate with the team to intentionally broaden the ABI contract definition
for code 14 and update all downstream callers and documentation accordingly. Do
not leave the meaning of the error code ambiguous on the wire.
Summary
RetentionPosturethroughForkStrandRequest,ForkStrandReceipt, andStrandso strand creation is posture-explicit.AuthorOnlyand never silently enterSharedhistory.StrandRegistry::insertand hash posture obstructions deterministically for scheduler fault evidence.Refs #538.
Validation
cargo check -p warp-corecargo test -p warp-core --libcargo test -p warp-core --test strand_contract_testscargo clippy -p warp-core --lib -- -D warnings -D missing_docscargo fmt --all -- --checkgit diff --checkscripts/check-causal-posture-constructors.shscripts/ban-nondeterminism.shpnpm exec markdownlint-cli2 CHANGELOG.mdSummary by CodeRabbit
Release Notes
New Features
Changed
Bug Fixes