Skip to content

feat(core): bind enterprise approvals to immutable intent - #220

Draft
seonghobae wants to merge 70 commits into
mainfrom
feat/enterprise-approval-intent-lifecycle
Draft

seonghobae wants to merge 70 commits into
mainfrom
feat/enterprise-approval-intent-lifecycle

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Partial implementation of #202. This PR owns the bounded in-memory enterprise maker-checker approval lifecycle and one-shot policy-use boundary.

Authority boundary

EnterpriseApprovalRequest binds an exact immutable ApprovalScope, opaque already-authenticated principal references, a trusted validity window, monotonic transition time, and bounded use count. The policy crate enforces exact (issuer, subject) requester/checker tuple separation, lifecycle/time invariants, expiry, use accounting, one-shot evaluation, and process-local outstanding-use terminal invalidation. A successful consume returns a non-cloneable EnterpriseApprovalUse; evaluate_at consumes it, rechecks live action/origin/intent scope and trusted time, observes process-local revocation/expiry invalidation, and only then introduces approval evidence into ordinary policy evaluation. R5 legal consent remains non-delegable.

This boundary does not authenticate principals, prove real-person separation, establish checker role, resolve tenant membership, persist consumption/revocation, provide distributed cancellation/consensus, or grant business authorization. Those remain identity/workflow/durable-control-plane responsibilities under #202.

Current protected-main adoption

Protected main is exact 87c4daa1830bac5a5228b6036752ad5633232085 through #286. Current exact head is e545b94e1de499b96b867694f80ac04ad247becd, a normal non-force merge adoption of that protected generation. Fresh compare is 70 ahead / 0 behind, merge base exactly protected main, and the effective current-main delta is 16 policy/product/docs/test paths with no .github/** delta. GitHub reports the PR open, Ready and mergeable.

The protected workflow changes visible inside the topology merge are inherited from protected main; they are not effective PR workflow changes and were not authored as this product delta.

Exact-current evidence

The previous body was stale: it named predecessor 22b484cc..., described the PR as Draft, and retained old queued workflow states. Exact current e545b94e1de499b96b867694f80ac04ad247becd has terminal evidence:

  • Security Scan 33929051692: success;
  • SAST Semgrep 33929051660: success;
  • CodeQL PR 33929051651: failure; and
  • native CI 33929051661: skipped on the Ready transition.

The skipped native CI is not GREEN and cannot validate repository contracts, Rust gates, rustdoc or exact production coverage for this head. This reproduces the #279 protected Ready-transition control-plane gap; the failed central CodeQL verdict remains independently fail-closed. Do not rerun blindly, weaken Draft/closed guards, or substitute predecessor evidence.

Keep Ready but unmerged until an exact-head native execution actually runs and succeeds and the required central review/security/ruleset verdicts are satisfied.

Durability boundary

The terminal signal coordinates only one live in-process request and issued uses. Once evaluation has passed the validity check it is in flight. Crash-safe/distributed replay prevention, canonical actor correlation, tenant identity, signed/auditable evidence, operator workflow, and durable enterprise control-plane semantics remain open #202 work.

Protected-main AGENTS.md and live GitHub governance remain authoritative. This scheduled writer does not merge, self-approve, bypass, force-push, destructively rebase, alter workflows/rulesets/secrets, weaken checks, tag, release, or publish.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 178a688f-97d6-4ea2-84c3-62de0744b729

📥 Commits

Reviewing files that changed from the base of the PR and between bc6c99f and ae36811.

📒 Files selected for processing (5)
  • crates/originweave-policy/src/enterprise_approval.rs
  • crates/originweave-policy/tests/enterprise_approval_lifecycle.rs
  • crates/originweave-policy/tests/enterprise_approval_scope_privacy.rs
  • crates/originweave-policy/tests/enterprise_approval_single_use.rs
  • docs/adr/0017-enterprise-maker-checker-approval.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

opaque principal 검증, 불변 승인 범위, maker-checker 승인 수명주기를 추가했다. 승인 전환에 단조 시간과 만료 처리를 적용했다. 소비 결과를 비복제 일회성 정책 평가 사용으로 변경하고 공개 API, 테스트 및 ADR을 추가했다.

Changes

엔터프라이즈 승인

Layer / File(s) Summary
승인 계약과 공개 API
crates/originweave-policy/src/enterprise_approval.rs, crates/originweave-policy/src/lib.rs, crates/originweave-policy/tests/enterprise_approval_lifecycle.rs, crates/originweave-policy/tests/enterprise_approval_clone_contract.rs
승인 주체, 상태, 요청 및 오류를 정의하고 공개 재export했다. 요청 제약과 비복제 계약을 검증한다.
승인 전환과 소비
crates/originweave-policy/src/enterprise_approval.rs, crates/originweave-policy/tests/enterprise_approval_lifecycle.rs, crates/originweave-policy/tests/enterprise_approval_transition_guards.rs, crates/originweave-policy/tests/enterprise_approval_scope_privacy.rs
승인, 거부, 철회, 취소 및 소비에 역할, scope, 만료, 상태와 사용 한도 검증을 적용한다. 잘못된 주체와 범위의 요청을 상태 변경 없이 거부한다.
단조 시간과 만료 가드
crates/originweave-policy/src/enterprise_approval.rs, crates/originweave-policy/tests/enterprise_approval_time_integrity.rs, crates/originweave-policy/tests/enterprise_approval_transition_guards.rs
이전 전환보다 이른 신뢰 시간을 NonMonotonicTime으로 거부한다. 만료 시 요청을 Expired로 전환하고 후속 전환을 차단한다.
비복제 승인 사용과 정책 평가
crates/originweave-policy/src/enterprise_approval.rs, crates/originweave-policy/src/lib.rs, crates/originweave-policy/tests/enterprise_approval_single_use.rs, CHANGELOG.md
consume이 비복제 EnterpriseApprovalUse를 반환한다. evaluate_at은 시간과 철회 신호를 확인한 뒤 private policy context에서 승인 범위를 평가한다. 평가 결과와 관계없이 사용을 소모한다.
설계 기록과 저장소 문서
docs/README.md, docs/adr/0017-enterprise-maker-checker-approval.md, docs/adr/README.md
Proposed ADR 0017과 문서 색인에 maker-checker, 단조 시간, terminal state, 철회 및 일회성 사용 계약을 기록했다.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: 🔵 Low · up to ae368

The approval lifecycle and privacy-ordering changes are supported by passing repository checks and complete production coverage. Merge is reasonable with owner follow-up for the ADR authority-boundary wording and for tightening clock-rollback coverage to assert the required error type.

Sequence Diagram(s)

sequenceDiagram
  participant Requester
  participant EnterpriseApprovalRequest
  participant EnterpriseApprovalUse
  participant PolicyEvaluator
  Requester->>EnterpriseApprovalRequest: 정확한 ApprovalScope로 consume
  EnterpriseApprovalRequest-->>Requester: 비복제 EnterpriseApprovalUse 반환
  Requester->>EnterpriseApprovalRequest: checker가 revoke 수행
  EnterpriseApprovalRequest->>EnterpriseApprovalUse: 공유 revocation signal 설정
  Requester->>EnterpriseApprovalUse: evaluate_at 호출
  EnterpriseApprovalUse->>EnterpriseApprovalUse: 시간과 철회 신호 검증
  EnterpriseApprovalUse->>PolicyEvaluator: private PolicyContext로 승인 평가
  PolicyEvaluator-->>Requester: Decision 반환
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 5 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive PR 번호 PR #220은 제공되지만 연결된 이슈의 존재와 요구사항 충족 여부를 확인할 정보가 없습니다. 연결된 이슈 번호와 해당 이슈의 요구사항 또는 이슈가 없는 이유를 제공하십시오.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed 구현, 테스트, 문서, ADR 변경이 모두 enterprise maker-checker 승인 수명주기와 immutable intent binding 목표에 직접 관련됩니다.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 엔터프라이즈 승인을 변경 불가능한 의도에 연결하는 이번 변경의 핵심을 정확하고 간결하게 설명합니다.
Full details: Docstring Coverage

Explanation

Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 55 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/enterprise-approval-intent-lifecycle

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as ready for review August 23, 2026 05:37
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head governance audit:

  • Base main = f658f329c83a106b68385e17cb714c4147c12f49; head feat/enterprise-approval-intent-lifecycle = a2b0c5372dd6df803011933836c56136244dc8af.
  • CodeGraph trace covered the immutable ApprovalScope, maker/checker lifecycle, consumed-use evaluation, scope binding, expiry, revocation, and trusted-time paths.
  • Live review-thread query found no unresolved, non-outdated threads. Historical automated findings are therefore not reimplemented from stale text.
  • Normal repository checks are green; Strix run 33040690669 is completed failure for this exact head. Its workflow lookup returned 404 and job-log lookup is currently rate-limited, so no authoritative vulnerability artifact is available; this remains fail-closed.
  • reviewDecision=CHANGES_REQUESTED remains and no counted non-author approval is present. PR feat(core): bind enterprise approvals to immutable intent #220 is not merged; no bypass or self-approval was used.
  • No source mutation was made in this audit.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head blocker audit for a2b0c5372dd6df803011933836c56136244dc8af against base f658f329c83a106b68385e17cb714c4147c12f49:

  • Current review-thread query reports 0 unresolved non-outdated threads.
  • Current exact-head checks are green except strix; its annotation is STRIX_PROVIDER_UNAVAILABLE and states that authoritative vulnerability analysis could not complete because the provider/backend was unavailable.
  • reviewDecision=CHANGES_REQUESTED comes from an opencode-agent review on predecessor head e0740a6f3a41067a4460249378e0266815018a74, not the current head. No current-head approval or rejection was synthesized, dismissed, or bypassed.
  • The repository has no current standalone opencode-review/Strix workflow route to repair from this worktree, so this remains an external provider/review-refresh blocker. No merge or protected-gate bypass was made.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode reviewed the current-head product diff. Coverage is a separate gate.

Changed files

  • CHANGELOG.md — repository behavior
  • crates/originweave-policy/src/enterprise_approval.rs — Rust workspace crate API and tests
  • crates/originweave-policy/src/lib.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_clone_contract.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_lifecycle.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_principal_invisible_format.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_scope_privacy.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_single_use.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_time_integrity.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_transition_guards.rs — Rust workspace crate API and tests
  • crates/originweave-policy/tests/enterprise_approval_use_scope_binding.rs — Rust workspace crate API and tests
  • docs/README.md — operator or user guidance
  • docs/adr/0017-enterprise-maker-checker-approval.md — operator or user guidance
  • docs/adr/README.md — operator or user guidance
  • docs/doctoring.md — operator or user guidance

Changed behavior

classDiagram
  class ApprovalPrincipalRef
  class new
  class issuer
  class subject
  class ApprovalPrincipalRefError
  class ApprovalLifecycleState
  class EnterpriseApprovalUse
  class evaluate_at
Loading

Changed API

  • ApprovalPrincipalRef
  • new
  • issuer
  • subject
  • ApprovalPrincipalRefError
  • ApprovalLifecycleState
  • EnterpriseApprovalUse
  • evaluate_at
  • EnterpriseApprovalRequest
  • approve
  • deny
  • withdraw
  • consume
  • revoke
  • ApprovalLifecycleError
  • Decision
  • DenialReason
  • evaluate_mcp
  • evaluate

Findings

No source-backed product finding is synthesized from the coverage gate. A coverage miss belongs in the status comment.

  • Head SHA: b11db2be68f9b6d71aa4c4290b97a8b22097b353
  • Workflow run: 33190553132
  • Workflow attempt: 1
  • Coverage gate: failure

Review outcome

Coverage is a gate, not the review. This body reviews the changed product files.

Changed-File Evidence Map

classDiagram
  class ApprovalPrincipalRef
  class new
  class issuer
  class subject
  class ApprovalPrincipalRefError
  class ApprovalLifecycleState
  class EnterpriseApprovalUse
  class evaluate_at
Loading

@seonghobae
seonghobae marked this pull request as draft September 3, 2026 16:17
Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae

Copy link
Copy Markdown
Contributor Author

Integrated protected main at 4f6b05d368d98ca7bca2dd48544afd95701fc7cb without changing the enterprise approval production contract. The current implementation directly covers the prior clock-regression, non-cloneable accounting, expiry, revocation, scope, and privacy findings. Exact local verification passed: originweave-policy tests; Python 152 tests; workspace fmt, strict Clippy, all-target/all-feature tests, rustdoc; LLVM functions, lines, regions, and branches each 100%. Hosted exact-head checks and eligible review remain authoritative.

…0-v2

Signed-off-by: Seongho Bae <me@seonghobae.me>
@seonghobae
seonghobae marked this pull request as ready for review September 4, 2026 23:19
@seonghobae

Copy link
Copy Markdown
Contributor Author

Adopted current protected main@87c4daa1830bac5a5228b6036752ad5633232085 by signed-off non-force merge commit e545b94e1de499b96b867694f80ac04ad247becd, preserving the existing 16-path enterprise-approval semantic delta. The prior downstream CodeQL/Semgrep/Noema/OpenCode/Strix/Security jobs were cancelled together before execution; direct rerun is no longer supported because GitHub returns 404 for those retired workflow identities. With no unresolved current review thread, the branch now passes cargo fmt, workspace clippy/tests, 152 Python contracts, and nightly LLVM coverage at 100% functions/lines/regions/branches, so it has been moved to Ready to generate fresh exact-head workflows under current #286 lifecycle rules. Predecessor reviews/checks do not transfer; no merge is authorized without terminal current-head checks and an eligible approval.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Fresh exact-head review for e545b94e1de499b96b867694f80ac04ad247becd: the in-process maker/checker lifecycle preserves exact (issuer, subject) separation, immutable action/origin/intent scope, monotonic trusted time, exclusive expiry, bounded use accounting, one-shot evaluation, and shared revocation/expiry invalidation without exposing principal or scope identity in Debug output. Current unresolved/non-outdated review threads: 0. Focused enterprise approval verification passed all 37 dedicated tests. Full local verification passed: 152 Python contract tests with warnings treated as errors; formatting; all workspace tests; Clippy with -D warnings; rustdoc with -D warnings; and 100% production function, line, region, and branch coverage. The active CHANGES_REQUESTED review belongs to predecessor e0740a6f... and its failed coverage job; it is not dismissed or treated as current-head evidence. Hosted exact-head checks and eligible independent approval remain required; no merge claim is made.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head focused security review for e545b94e1de499b96b867694f80ac04ad247becd: no actionable authority-widening defect found. The authorizing path is bound to the exact action/origin/intent digest, distinct exact issuer+subject principals, monotonic trusted time, bounded consumption, a non-cloneable one-shot use, and shared expiry/revocation invalidation before ordinary fail-closed policy evaluation. Local exact-head evidence: rustfmt passed; all 72 originweave-policy tests passed; strict Clippy and warnings-denied rustdoc passed; and all 12 focused repository-contract tests passed. Hosted exact-head state remains non-terminal (9 queued checks), and no counted independent approval exists, so this review does not authorize merge.

Copy link
Copy Markdown
Contributor Author

Admission-state correction for exact head e545b94e1de499b96b867694f80ac04ad247becd.

protected main 대비 70 ahead / 0 behind이나 CodeQL PR is terminal failure, CI is skipped, and CHANGES_REQUESTED remains.

This PR is being moved from Ready to Draft/Proposed. It remains open and its commits, reviews, threads, and valid delta are preserved. Return it to Ready only after the causal blocker is repaired and the unchanged/reconciled exact head has fresh terminal Checks, zero substantive unresolved findings, and any required current-head/latest-push independent approval. No bypass, synthetic status, manual rerun, force push, review dismissal, or Close is used.

@seonghobae
seonghobae marked this pull request as draft September 19, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant