Harden strand construction and typed braid failures#548
Conversation
|
Warning Review limit reached
More reviews will be available in 22 minutes and 31 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughImplements GP1 of the braids-and-strands hardening roadmap: ChangesGP1: Lawful Construction and Typed Failures
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 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 |
Self-Code Review: Code Lawyer Pass@codex Please confirm or challenge these findings. I reviewed PR #548 against
Summary: the PR is directionally correct and all local/remote checks are green, but Goalpost 1 should not be considered complete until the strand constructor boundary closes the v1 writer-head cardinality gap and production strand creation uses the named constructor path. |
|
Follow-up on the self-review findings. @codex please sanity-check the closure.
Validation:
|
|
Additional CI follow-up on head
|
|
Codex Review: Didn't find any major issues. Hooray! 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: 3
🤖 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-core/src/strand.rs`:
- Around line 214-225: The self-support and duplicate-target checks are being
performed twice: once in the inline validation code (around lines 214-225) and
again in the validate_support_pins function (lines 1020-1042). Since
StrandRegistry::insert calls both validators in sequence, this creates
unnecessary duplication and maintenance burden. Remove the self-support and
duplicate-target validation checks from the validate_support_pins function,
keeping only the registry-relative checks that require live strand context (such
as target liveness and worldline matching validation). This leaves the simpler
checks to the inline validator that runs first in the insert flow.
In `@crates/warp-core/tests/strand_contract_tests.rs`:
- Around line 681-684: The assertions currently use a broad pattern match that
accepts any StrandError::InvariantViolation without validating which specific
invariant was violated. Replace the generic InvariantViolation pattern match
with explicit checks for the invariant error messages or codes (INV-S7 and
INV-S8 respectively) to ensure that only the expected invariant violations cause
the tests to pass, preventing regression failures from being masked by
violations of different invariants. This applies to both the assertion at lines
681-684 and the related assertion at lines 701-704 in the same test file.
In
`@docs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.md`:
- Line 6: The three documentation files prematurely claim GP1 is complete
despite two unresolved blocking issues (P1 incomplete strand constructor
boundary validation, P4 BraidError display regression). In
docs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.md
at line 6, change the status from "implemented" to "in progress" or "blocked on
P1/P4" to reflect the incomplete work. In
docs/design/braids-and-strands-roadmap.md at lines 64-71, uncheck GP1-S1 (since
the public forgery prevention acceptance criterion is not satisfied) and add a
note referencing the two outstanding issues from the self-code review. In
CHANGELOG.md at lines 10-19, either move the GP1 completion claims to a
follow-up section scheduled after the P1/P4 fixes land, or reword them to
accurately describe what is currently implemented and explicitly flag what
remains incomplete (e.g., note that cardinality enforcement is incomplete).
🪄 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: eac0377b-7ef2-44c8-af14-0a24690fc662
📒 Files selected for processing (11)
CHANGELOG.mdcrates/warp-core/src/braid.rscrates/warp-core/src/braid_shell.rscrates/warp-core/src/coordinator.rscrates/warp-core/src/lib.rscrates/warp-core/src/proof.rscrates/warp-core/src/strand.rscrates/warp-core/tests/braid_public_api_tests.rscrates/warp-core/tests/strand_contract_tests.rsdocs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.mddocs/design/braids-and-strands-roadmap.md
|
@codex self-audit found one new documentation precision issue while reviewing the current PR head.
|
Summary
Testing
Note: |
Activity Summary - Code Lawyer Pass@codex Current-head closure pass for PR #548.
Review-thread state after GraphQL resolution: 0 unresolved, non-outdated threads. Local verification passed:
Pre-push verification also passed on the pushed head |
Summary
Testing
|
Summary
Strand<P>public struct-literal construction behindStrand::new(...)plus read-only accessorsProofErrorBraidTransitionKindBraidShellError::ProofShapeValidationFailedWhy
PR #545 made strands and braids law-bearing surfaces, but
Strand<P>still looked forgeable through public fields and proof/braid failures still exposed behavioral facts through strings. This PR closes the first hardening goalpost: law-bearing strand values are admitted through named construction, and callers can branch on typed failure variants without parsing display text.Runtime and registry checks remain authoritative. Typestate is only the guardrail.
Red / Green witnesses
RED before implementation:
cargo test -p warp-core --test braid_public_api_testscargo test -p warp-core --test strand_contract_tests strand_constructor_rejects_static_runtime_posture_mismatchGREEN after implementation:
cargo test -p warp-core --lib— 560/560cargo test -p warp-core --test braid_public_api_tests— 3/3cargo test -p warp-core --test strand_contract_tests— 29/29cargo test -p warp-core --doc— includes the new publicStrandcompile-fail witnesscargo clippy -p warp-core --lib -- -D warningscargo fmt --all -- --checkgit diff --checkscripts/check_spdx.shpnpm exec markdownlint-cli2 CHANGELOG.md docs/design/braids-and-strands-roadmap.md docs/design/braids-and-strands-hardening/goalpost-01-lawful-construction-and-typed-failures.mdSummary by CodeRabbit
New Features
Improvements
Documentation