Skip to content

WS-XINT-003-02D: publish REV authorization integration contracts - #257

Merged
abiorh-claw merged 6 commits into
mainfrom
codex/ws-xint-003-02d-prep-contract
Aug 3, 2026
Merged

WS-XINT-003-02D: publish REV authorization integration contracts#257
abiorh-claw merged 6 commits into
mainfrom
codex/ws-xint-003-02d-prep-contract

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Intent

Publish the complete inert typed AUTH contract surface REV can implement against without per-chunk authorization discovery.

Scope

  • closed manifest for all 23 registered review.* actions
  • strict frozen scalar resource contracts for approved human, Operator, read, and fixed-service boundaries
  • explicit unsupported future evidence-ingest rows
  • reference-only XINT-002 and existing 02B handoffs
  • no evaluator, catalogue, availability, migration, route, worker, or REV lifecycle behavior

Evidence

  • Ruff and mypy pass
  • 15 focused contract tests pass
  • 3 existing PREP regression tests pass
  • changed module coverage: 100.00%
  • architecture, security, product/ops, QA, senior, CI, reuse, test-delta, and docs reviews pass after valid findings were resolved
  • Markdown links, stale review contracts, and diff checks pass

Human review focus

Confirm the manifest is complete enough for REV composers, concealed none results cannot leak lineage, revision decisions cannot bypass predecessor/response binding, and publishing these types creates no runtime authority.

Full hosted Backend and Agent Gates are required on the exact head before merge readiness.

Summary by CodeRabbit

  • New Features

    • Added a strict, typed authorization contract manifest covering review lifecycle actions, resources, statuses, transitions, and reconciliation modes.
    • Added validation for decision counts, review lineage, phase changes, and boundary conditions.
    • Added explicit handling for supported actions, unsupported future evidence actions, and external handoffs.
  • Documentation

    • Documented authorization contracts, lifecycle requirements, service bindings, validation boundaries, and activation constraints.
  • Tests

    • Added comprehensive contract, serialization, registration, validation, and safety-constraint coverage.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Abiorh001, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 56f3df4e-3b5a-4530-93bd-39a50ebccb85

📥 Commits

Reviewing files that changed from the base of the PR and between d61d8c3 and 0f9bcd5.

📒 Files selected for processing (6)
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/REVIEW_LOG.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/chunks/WS-XINT-003-02D-auth-prep-integration-readiness.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/reviews/WS-XINT-003-02D-external-review-response.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/reviews/WS-XINT-003-02D-pr-trust-bundle.md
  • backend/app/modules/authorization/review_contracts.py
  • backend/tests/test_review_authorization_contracts.py
📝 Walkthrough

Walkthrough

PR #257 adds strict, frozen REV authorization contracts and a closed action/resource manifest. It adds validation tests, test-lane wiring, service and lifecycle specifications, and initiative records. It does not add runtime lifecycle, persistence, routing, or evaluator behavior.

Changes

REV authorization contracts

Layer / File(s) Summary
Contract scope and manifest specification
.agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/chunks/...
The 02D contract defines approved resource families, unsupported future actions, execution constraints, validation requirements, and verification gates.
Strict REV contract models
backend/app/modules/authorization/review_contracts.py
The module adds frozen enums, lineage models, queue, lease, preference, packet, decision, reconciliation, revision, closure, and lifecycle contracts with validation rules.
Action registry and contract validation
backend/app/modules/authorization/review_contracts.py, backend/tests/test_review_authorization_contracts.py, backend/scripts/run_test_lanes.py
The action registry maps actions to execution metadata and resource models. Tests cover strict schemas, invariants, serialization, handoffs, and dependency boundaries.
Documentation and readiness records
docs/spec_authorization_service.md, docs/spec_review_lifecycle.md, .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/{ACTION_CUSTODY.md,STATUS.md,REVIEW_LOG.md,reviews/*}
The specifications and records document the inert manifest, custody boundaries, validation evidence, review status, and staged activation rules.

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

Possibly related PRs

Suggested reviewers: abiorh-claw

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the intent, scope, evidence, exclusions, and review focus, but it omits most required trust-bundle sections. Add the required template sections for chunk, goal, design, alternatives, file scope, product behavior, acceptance proof, test delta, reviewer results, CI integrity, risks, follow-up, and merge ownership.
Docstring Coverage ⚠️ Warning Docstring coverage is 26.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the publication of REV authorization integration contracts, which is the primary change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-xint-003-02d-prep-contract

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.

@Abiorh001

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Abiorh001

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
backend/app/modules/authorization/review_contracts.py (1)

221-229: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use one closed enum for every execution_mode.

Four models declare execution_mode as a bare string literal ("due_lease" here, "due_preference" at Line 265, "artifact_reference" at Line 437, "projection_rebuild" at Line 451). The reconcile pair uses the ReconciliationMode enum instead. Doc line 96 describes one closed server-derived execution_mode, so REV consumers benefit from a single importable enum.

♻️ Sketch of the consolidation
+class ServiceExecutionMode(StrEnum):
+    """Closed server-derived execution modes for fixed-service contracts."""
+
+    AUTHORITY_INVALIDATION = "authority_invalidation"
+    GENERAL = "general"
+    DUE_LEASE = "due_lease"
+    DUE_PREFERENCE = "due_preference"
+    ARTIFACT_REFERENCE = "artifact_reference"
+    PROJECTION_REBUILD = "projection_rebuild"
-    execution_mode: Literal["due_lease"]
+    execution_mode: Literal[ServiceExecutionMode.DUE_LEASE]
🤖 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 `@backend/app/modules/authorization/review_contracts.py` around lines 221 -
229, Define or reuse one closed enum for all server-derived execution modes,
then update ReviewLeaseExpiryContract.execution_mode and the corresponding
declarations in the due-preference, artifact-reference, and projection-rebuild
contract models to use that enum instead of bare string literals. Preserve the
existing mode values and keep the reconciliation contracts aligned with the same
importable enum.
backend/tests/test_review_authorization_contracts.py (1)

182-198: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert on field types, not field names.

Two inertness proofs are weaker than the acceptance criteria at doc lines 140-142.

  • forbidden_names compares exact field names. A field named evidence_bytes, raw_content, or callback_url passes. The test name also promises an unbounded-map check, but no annotation is inspected.
  • Line 514 asserts "PreparedAuthorizationHandle" not in contract.model_dump_json(). A class name never appears as a serialized value, so that assertion always passes.

Check the allowed annotation set across every manifest model instead.

♻️ Proposed type-based check
     for spec in REVIEW_AUTHORIZATION_CONTRACT_BY_ACTION.values():
         for model in spec.resource_models:
             assert forbidden_names.isdisjoint(model.model_fields)
-            assert all(
-                field.annotation is not PreparedAuthorizationHandle
-                for field in model.model_fields.values()
-            )
+            for name, field in model.model_fields.items():
+                members = {
+                    arg for arg in get_args(field.annotation) or (field.annotation,)
+                }
+                assert PreparedAuthorizationHandle not in members, name
+                assert not any(
+                    isinstance(member, type)
+                    and issubclass(member, (bytes, bytearray, dict, list, set))
+                    for member in members
+                ), name
+                assert not any(callable(member) and not isinstance(member, type) for member in members), name
🤖 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 `@backend/tests/test_review_authorization_contracts.py` around lines 182 - 198,
Update test_contract_models_exclude_handles_callbacks_bytes_and_unbounded_maps
to validate annotations rather than field names: inspect every field in every
resource model from REVIEW_AUTHORIZATION_CONTRACT_BY_ACTION and assert each uses
the allowed annotation set, excluding PreparedAuthorizationHandle, bytes,
callback-related types, and unbounded mappings. Replace the inert
contract.model_dump_json() class-name assertion near the authorization contract
checks with the same type-based validation.
🤖 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
@.agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/chunks/WS-XINT-003-02D-auth-prep-integration-readiness.md:
- Around line 71-86: Split review.queue.inspect into a separate operator-queue
row, documenting REQUEST_READ and only its published facts: project/shard,
filter digest, bounded cursor, and redaction state; keep
review.queue.routing.override, review.queue.routing.correct, and
review.queue.close grouped with their PREPARED_OPERATOR facts. In the
review.revision_context.repair row, change the guide requirement from an
identity triple to the published guide_id and guide_activation_sequence fields,
unless the contract is intentionally extended with a guide digest.

In `@backend/app/modules/authorization/review_contracts.py`:
- Around line 144-154: Update the contract model’s no_self_review field to use
Literal[True], matching the module’s other server-proven markers. In
require_distinct_reviewer, validate the no_self_review proof and
reviewer/contributor identity as separate conditions with distinct error
messages, while preserving successful validation for valid distinct-reviewer
contexts.

---

Nitpick comments:
In `@backend/app/modules/authorization/review_contracts.py`:
- Around line 221-229: Define or reuse one closed enum for all server-derived
execution modes, then update ReviewLeaseExpiryContract.execution_mode and the
corresponding declarations in the due-preference, artifact-reference, and
projection-rebuild contract models to use that enum instead of bare string
literals. Preserve the existing mode values and keep the reconciliation
contracts aligned with the same importable enum.

In `@backend/tests/test_review_authorization_contracts.py`:
- Around line 182-198: Update
test_contract_models_exclude_handles_callbacks_bytes_and_unbounded_maps to
validate annotations rather than field names: inspect every field in every
resource model from REVIEW_AUTHORIZATION_CONTRACT_BY_ACTION and assert each uses
the allowed annotation set, excluding PreparedAuthorizationHandle, bytes,
callback-related types, and unbounded mappings. Replace the inert
contract.model_dump_json() class-name assertion near the authorization contract
checks with the same type-based validation.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8abd0a13-18e8-4faa-96da-6a0b1b2a8c65

📥 Commits

Reviewing files that changed from the base of the PR and between 745d9c3 and d61d8c3.

📒 Files selected for processing (12)
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/ACTION_CUSTODY.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/REVIEW_LOG.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/STATUS.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/chunks/WS-XINT-003-02D-auth-prep-integration-readiness.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/reviews/WS-XINT-003-02D-external-review-response.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/reviews/WS-XINT-003-02D-internal-review.md
  • .agent-loop/initiatives/WS-XINT-003-rev-auth-end-to-end/reviews/WS-XINT-003-02D-pr-trust-bundle.md
  • backend/app/modules/authorization/review_contracts.py
  • backend/scripts/run_test_lanes.py
  • backend/tests/test_review_authorization_contracts.py
  • docs/spec_authorization_service.md
  • docs/spec_review_lifecycle.md

Comment thread backend/app/modules/authorization/review_contracts.py Outdated
@abiorh-claw
abiorh-claw self-requested a review August 3, 2026 15:24
@Abiorh001

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Abiorh001

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@abiorh-claw
abiorh-claw merged commit 3479ee7 into main Aug 3, 2026
9 checks passed
@abiorh-claw
abiorh-claw deleted the codex/ws-xint-003-02d-prep-contract branch August 3, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants