feat: add purpose-specific consent and research contribution lifecycle - #5
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthrough목적별 불변 동의 이벤트와 스냅샷을 추가했습니다. 연구 동의 범위가 있는 경우에만 연구 기여를 생성합니다. 연구 기여는 가명 식별자를 사용하며, 철회는 불변 상태 전환과 멱등성 규칙을 따릅니다. Changes동의 및 연구 기여
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ResearchParticipant
participant ConsentLedger
participant ResearchContribution
ResearchParticipant->>ConsentLedger: 목적별 동의 이벤트 기록
ConsentLedger->>ConsentLedger: 최신 동의 스냅샷 생성
ResearchParticipant->>ResearchContribution: 연구 기여 생성 요청
ResearchContribution->>ConsentLedger: 활성 연구 동의 확인
ConsentLedger-->>ResearchContribution: 연구 범위와 스냅샷 반환
ResearchParticipant->>ResearchContribution: 철회 증거 제출
ResearchContribution-->>ResearchParticipant: 철회 상태 반환
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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 `@src/consent.rs`:
- Around line 351-364: Update ConsentSnapshot::from_snapshot to compare the
normalized contribution_ref and research_participant_ref values after
research_reference validation, returning a new
ResearchContributionError::OperationalIdentityReuse when they match. Add the
variant and its corresponding error message, while preserving the existing
validation flow for distinct references.
- Around line 499-505: Update normalized_reference, used by required_reference
and research_reference, to reject references consisting only of decimal digits
while preserving trimming and acceptance of other non-empty values. Add focused
tests covering numeric-only rejection and valid non-numeric references.
In `@tests/consent_research_contract.rs`:
- Around line 306-329: Extend
events_must_be_recorded_in_server_authoritative_time_order to record and assert
acceptance of a second event with timestamp 7,000, alongside the existing
rejection for 6,999. Keep the assertion focused on the equal-timestamp boundary
so an accidental <= comparison would fail the test.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4e7e268d-14dd-4f5a-86a8-11eb6af0833c
📒 Files selected for processing (4)
CHANGELOG.mdsrc/consent.rssrc/lib.rstests/consent_research_contract.rs
Summary
Adds the next Hosted Assessment Runtime domain slice after scoring/result provenance: purpose-specific append-only consent evidence, immutable consent snapshots, and explicit research-contribution/withdrawal semantics.
Product boundary
Contract behavior
ResearchContribution.TDD evidence
The branch begins with
test: define consent and research contribution contractbefore theconsentmodule existed. Production implementation follows in subsequent commits.Validation required on final exact head
Summary by CodeRabbit
새로운 기능
버그 수정