WS-XINT-002-03: activate internal artifact services - #212
Conversation
|
Warning Review limit reached
Next review available in: 31 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: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR activates three ART fixed-service actions through prepared authorization, adds transaction-bound claim and terminal consumption, persists digest-bound audit evidence, wires Celery runtime and pending-work scheduling, and adds PostgreSQL, orchestration, worker, documentation, and review validation. ChangesArtifact authorization and execution
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant CeleryBeat
participant ArtifactTask
participant InternalRuntime
participant PreparedAuthority
participant ArtifactOrchestrator
participant AuditStore
CeleryBeat->>ArtifactTask: schedule pending-work scan
ArtifactTask->>InternalRuntime: acquire leased artifact runtime
InternalRuntime->>PreparedAuthority: prepare fixed-service authority
PreparedAuthority->>ArtifactOrchestrator: authorize claim or scan
ArtifactOrchestrator->>PreparedAuthority: consume final facts
PreparedAuthority->>AuditStore: stage digest-bound evidence
ArtifactTask->>ArtifactTask: publish committed follow-up work
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (7)
backend/app/modules/authorization/kernel.py (1)
517-532: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConfirm the direct
require()path for fixed services still denies by design.
_service_denialnow takesresourcebut never reads it, so every directrequire()for an active artifact action returnsRESOURCE_GUARD_DENIEDregardless of a well-formed resource context. That matches the stated deny-unless-prepared intent, but the unused parameter makes the contract implicit — worth a short comment on_service_denial(or dropping the parameter) so a future change doesn't silently start honoring it.Also applies to: 609-609
🤖 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/kernel.py` around lines 517 - 532, The direct require() path for fixed services must continue denying artifact actions unless the prepared resource context passes the existing guard. In _service_denial, document that the resource parameter is intentionally unused and that direct authorization denies by design, or remove the parameter and update its callers consistently; do not change the current denial behavior.backend/app/modules/authorization/prepared.py (1)
247-263: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winPair each artifact action with its exact resource context type.
The current check accepts any of the three contexts for any of the three actions. The kernel independently enforces the action↔resource-type pairing (
_ARTIFACT_INTERNAL_RESOURCES), so this isn't exploitable today, but deriving the scope from an unmatched pair here makes this seam depend on a downstream guard.♻️ Tighten to the exact pairing
- if action_id in { - ActionId.ARTIFACT_PUT_ATTEMPT_RESOLVE, - ActionId.ARTIFACT_VERIFICATION_EXECUTE, - ActionId.ARTIFACT_PENDING_WORK_SCAN, - } and isinstance( - resource, - ( - ArtifactPutAttemptResourceContext, - ArtifactVerificationJobResourceContext, - ArtifactPendingWorkResourceContext, - ), - ): + artifact_resource = { + ActionId.ARTIFACT_PUT_ATTEMPT_RESOLVE: ArtifactPutAttemptResourceContext, + ActionId.ARTIFACT_VERIFICATION_EXECUTE: ArtifactVerificationJobResourceContext, + ActionId.ARTIFACT_PENDING_WORK_SCAN: ArtifactPendingWorkResourceContext, + }.get(action_id) + if artifact_resource is not None and isinstance(resource, artifact_resource): return PreparedAuthorityScope( kind=PreparedAuthorityScopeKind.ARTIFACT_INTERNAL, artifact_resource_type=resource.resource_type, artifact_resource_id=resource.resource_id, )🤖 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/prepared.py` around lines 247 - 263, Update the artifact branch in the prepared authority scope logic to require exact action-to-resource-context pairings: ARTIFACT_PUT_ATTEMPT_RESOLVE with ArtifactPutAttemptResourceContext, ARTIFACT_VERIFICATION_EXECUTE with ArtifactVerificationJobResourceContext, and ARTIFACT_PENDING_WORK_SCAN with ArtifactPendingWorkResourceContext. Preserve the existing PreparedAuthorityScope construction for matched pairs and reject unmatched combinations.backend/app/modules/artifacts/service.py (1)
552-568: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftExtract the repeated terminal-authorization preamble. Six terminal paths now duplicate the same sequence —
prepare(phase="terminal", idempotency_key=executor_id), fence check →discard()+"stale", recompute facts →discard()+"stale", thenconsume(). A future change to this authorization guard has to land identically in all six, and a miss silently weakens one terminal path.
backend/app/modules/artifacts/service.py#L552-L568: extract the put-side preamble into one helper (e.g. returning the locked attempt and terminal facts, or a"stale"sentinel) and call it here.backend/app/modules/artifacts/service.py#L706-L724: replace the inline preamble in_record_put_unavailablewith the shared put helper.backend/app/modules/artifacts/service.py#L750-L768: replace the inline preamble in_record_put_absencewith the shared put helper.backend/app/modules/artifacts/service.py#L858-L876: replace the inline preamble in_record_put_terminal_observationwith the shared put helper.backend/app/modules/artifacts/service.py#L967-L991: extract the verification-side variant (job/replica/attempt lock plus"conflict"branch) and call it here.backend/app/modules/artifacts/service.py#L1025-L1049: reuse that verification helper in_complete_verification.🤖 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/artifacts/service.py` around lines 552 - 568, Extract the duplicated terminal authorization guards into shared helpers in service.py: create a put-side helper covering terminal prepare, attempt locking, fence/facts validation, discard, and "stale" handling, then reuse it in the anchor 552-568 and sibling sites 706-724, 750-768, and 858-876. Create a verification-side helper covering job/replica/attempt locking and the existing "conflict" branch, then reuse it at 967-991 and 1025-1049; preserve each path’s existing consume behavior and outcomes..agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md (1)
23-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the exact worker path in the allowlist.
wor?ersis a single-character wildcard, not the literalworkersdirectory, so similarly named paths could also match. Use the exact path unless the gate intentionally requires this broader pattern.Suggested fix
-backend/app/wor?ers/{artifacts,celery_app}.py +backend/app/workers/{artifacts,celery_app}.py🤖 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 @.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md at line 23, Update the worker allowlist entry referencing backend/app/wor?ers/{artifacts,celery_app}.py to use the literal workers directory path, removing the single-character wildcard so only the intended worker files match.backend/app/workers/artifacts.py (1)
37-62: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winNo retry/backoff policy on the newly-activated fixed-service tasks.
resolve_put_attempt,verify_object, andscan_pending_worknow execute real authorization + I/O work but have noautoretry_for/retry_backoff/max_retriesconfigured, so any transient failure (DB blip, denial due to a suspended actor, etc.) surfaces as a bare Celery task failure. Forscan_pending_workspecifically, a persistently denied scheduler identity would fail on every beat tick, generating recurring alert noise.Consider adding an explicit retry policy (e.g.,
autoretry_for=(...), boundedmax_retries, exponentialretry_backoff) to these tasks, consistent with the rationale for choosing Celery.As per coding guidelines: "use Celery or an equivalent durable worker when retries, scheduling, isolation, or distributed execution are needed."
🤖 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/workers/artifacts.py` around lines 37 - 62, Add an explicit bounded Celery retry policy to resolve_put_attempt, verify_object, and scan_pending_work, including the appropriate transient exception scope, exponential retry_backoff, and max_retries. Ensure persistent authorization failures do not retry indefinitely or generate unbounded scheduler alert noise.Source: Coding guidelines
backend/tests/test_artifact_internal_authorization.py (1)
495-499: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTest depends on a private module helper.
artifact_authorization._resource_contextis private; if it is the canonical way to derive the digest for a decision, consider exposing a small public helper so the assertion doesn't break on internal refactors.🤖 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_artifact_internal_authorization.py` around lines 495 - 499, Replace the test’s direct use of the private artifact_authorization._resource_context helper with a small public helper that exposes the canonical resource-context digest derivation, then update the assertion to call that public API while preserving the existing expected digest behavior.backend/tests/test_artifact_verification.py (1)
56-69: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueBeat-schedule assertions depend on import order.
importlib.import_modulereturns the already-imported module when another test importedapp.workers.celery_appfirst, so settingWORKSTREAM_CELERY_TASK_ALWAYS_EAGERhere can be a no-op and the asserted schedule reflects whatever settings were active at first import. Considerimportlib.reloadafter the env change if the eager setting matters for these assertions.🤖 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_artifact_verification.py` around lines 56 - 69, Update test_internal_celery_tasks_and_pending_scan_are_registered_once to reload the already-imported app.workers.celery_app module after setting WORKSTREAM_CELERY_TASK_ALWAYS_EAGER and clearing get_settings, ensuring celery_app and its beat_schedule reflect the test’s environment rather than import order.
🤖 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-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md:
- Around line 135-143: Replace the literal ${EMPTY} placeholders in the backend
coverage command with the correct app.workers.artifacts and
app.workers.celery_app module paths, while leaving the surrounding pytest
coverage options unchanged.
In `@backend/app/adapters/artifacts/internal_workers.py`:
- Around line 36-56: Move ArtifactStoreBootstrap creation and provider-store
initialization out of each task execution into Celery worker process lifecycle
hooks, such as worker_process_init and worker_process_shutdown. Update
resolve_put_attempt and verify_object to reuse the process-scoped initialized
store and namespace claim instead of creating or closing them per task; ensure
shutdown occurs only in the process shutdown hook and cannot race with active
task usage.
In `@backend/app/modules/artifacts/authorization.py`:
- Around line 237-250: Update _scope to catch malformed resource IDs and any
validation failure from PreparedAuthorityScope construction, then convert them
to the seam’s established AuthorizationDenied error type. Preserve valid UUID
normalization and pending-work handling while ensuring invalid selectors fail
closed as authorization denials.
In `@backend/tests/test_artifact_recovery.py`:
- Around line 76-78: Update _DenyTerminalArtifactAuthority.consume to inspect
the recorded transaction phase and raise ArtifactAuthorityDeniedError only
during the terminal phase, while delegating claim-phase consumption to the
inherited implementation. Match the phase-gating behavior used by
_RevokeTerminalArtifactAuthority so recovery reaches the terminal transaction.
In `@docs/spec_authorization_service.md`:
- Around line 623-632: Align the PREP denial contract across both
specifications: in docs/spec_authorization_service.md (lines 623-632),
explicitly document the ART clean-transaction denial-restage exception; in
docs/operations_authorization_service.md (lines 783-790), remove the claim that
planned fixed-service denials have no evidence or final resource context, since
the adapter calls require(), retains the denial, and supports clean restaging.
Do not change the adapter unless choosing instead to short-circuit before
require().
---
Nitpick comments:
In
@.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md:
- Line 23: Update the worker allowlist entry referencing
backend/app/wor?ers/{artifacts,celery_app}.py to use the literal workers
directory path, removing the single-character wildcard so only the intended
worker files match.
In `@backend/app/modules/artifacts/service.py`:
- Around line 552-568: Extract the duplicated terminal authorization guards into
shared helpers in service.py: create a put-side helper covering terminal
prepare, attempt locking, fence/facts validation, discard, and "stale" handling,
then reuse it in the anchor 552-568 and sibling sites 706-724, 750-768, and
858-876. Create a verification-side helper covering job/replica/attempt locking
and the existing "conflict" branch, then reuse it at 967-991 and 1025-1049;
preserve each path’s existing consume behavior and outcomes.
In `@backend/app/modules/authorization/kernel.py`:
- Around line 517-532: The direct require() path for fixed services must
continue denying artifact actions unless the prepared resource context passes
the existing guard. In _service_denial, document that the resource parameter is
intentionally unused and that direct authorization denies by design, or remove
the parameter and update its callers consistently; do not change the current
denial behavior.
In `@backend/app/modules/authorization/prepared.py`:
- Around line 247-263: Update the artifact branch in the prepared authority
scope logic to require exact action-to-resource-context pairings:
ARTIFACT_PUT_ATTEMPT_RESOLVE with ArtifactPutAttemptResourceContext,
ARTIFACT_VERIFICATION_EXECUTE with ArtifactVerificationJobResourceContext, and
ARTIFACT_PENDING_WORK_SCAN with ArtifactPendingWorkResourceContext. Preserve the
existing PreparedAuthorityScope construction for matched pairs and reject
unmatched combinations.
In `@backend/app/workers/artifacts.py`:
- Around line 37-62: Add an explicit bounded Celery retry policy to
resolve_put_attempt, verify_object, and scan_pending_work, including the
appropriate transient exception scope, exponential retry_backoff, and
max_retries. Ensure persistent authorization failures do not retry indefinitely
or generate unbounded scheduler alert noise.
In `@backend/tests/test_artifact_internal_authorization.py`:
- Around line 495-499: Replace the test’s direct use of the private
artifact_authorization._resource_context helper with a small public helper that
exposes the canonical resource-context digest derivation, then update the
assertion to call that public API while preserving the existing expected digest
behavior.
In `@backend/tests/test_artifact_verification.py`:
- Around line 56-69: Update
test_internal_celery_tasks_and_pending_scan_are_registered_once to reload the
already-imported app.workers.celery_app module after setting
WORKSTREAM_CELERY_TASK_ALWAYS_EAGER and clearing get_settings, ensuring
celery_app and its beat_schedule reflect the test’s environment rather than
import order.
🪄 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: 6b1f429b-40ec-406c-9723-a68a8a053bf1
📒 Files selected for processing (31)
.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/DISCOVERY.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/REVIEW_LOG.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-internal-review.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.md.agent-loop/merge-intents/WS-XINT-002-03.jsonbackend/alembic/versions/0037_artifact_authorization_context_evidence.pybackend/app/adapters/artifacts/internal_workers.pybackend/app/modules/artifacts/authorization.pybackend/app/modules/artifacts/schemas.pybackend/app/modules/artifacts/service.pybackend/app/modules/audit/schemas.pybackend/app/modules/authorization/catalogue.pybackend/app/modules/authorization/kernel.pybackend/app/modules/authorization/prepared.pybackend/app/modules/authorization/runtime.pybackend/app/workers/artifacts.pybackend/app/workers/celery_app.pybackend/scripts/run_test_lanes.pybackend/tests/conftest.pybackend/tests/test_artifact_admission.pybackend/tests/test_artifact_authorization.pybackend/tests/test_artifact_internal_authorization.pybackend/tests/test_artifact_recovery.pybackend/tests/test_artifact_verification.pybackend/tests/test_audit.pybackend/tests/test_authorization.pydocs/operations_artifact_storage.mddocs/operations_authorization_service.mddocs/spec_artifact_storage_service.mddocs/spec_authorization_service.md
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 `@backend/app/workers/celery_app.py`:
- Around line 25-34: Update the artifact runtime lifecycle around
initialize_artifact_runtime_for_process, shutdown_artifact_runtime_for_process,
and the artifact Celery task entry points so eager and non-prefork execution
initializes the runtime before _artifact_internal_runtime() is accessed. Use an
initialization path that cannot be skipped outside prefork signals, while
preserving per-process setup and shutdown behavior; add coverage that runs the
actual tasks with task_always_eager enabled without monkeypatching their bodies.
🪄 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: 274d8718-dbe2-4556-9569-eda0ff4cca6f
📒 Files selected for processing (13)
.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/REVIEW_LOG.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.mdbackend/app/adapters/artifacts/internal_workers.pybackend/app/modules/artifacts/authorization.pybackend/app/workers/celery_app.pybackend/tests/test_artifact_admission.pybackend/tests/test_artifact_internal_authorization.pybackend/tests/test_artifact_recovery.pybackend/tests/test_artifact_verification.pybackend/tests/test_authorization.pydocs/operations_authorization_service.mddocs/spec_authorization_service.md
🚧 Files skipped from review as they are similar to previous changes (8)
- backend/tests/test_artifact_recovery.py
- docs/spec_authorization_service.md
- .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
- backend/tests/test_artifact_admission.py
- docs/operations_authorization_service.md
- backend/tests/test_authorization.py
- backend/app/modules/artifacts/authorization.py
- backend/tests/test_artifact_internal_authorization.py
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/tests/test_artifact_verification.py (1)
70-162: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winAlways clear the settings cache during teardown.
If this test fails before Line 162,
monkeypatchrestores the environment butget_settings()can remain cached with eager-mode settings, contaminating later tests. Wrap the body after the initial cache clear intry/finallyand clear the cache infinally.🤖 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_artifact_verification.py` around lines 70 - 162, Ensure the test body after the initial get_settings.cache_clear() is enclosed in a try/finally block, and call get_settings.cache_clear() in the finally clause so the cache is cleared even when assertions or setup fail. Remove reliance on the final cleanup call at the end of the test.
🤖 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-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.md:
- Around line 65-80: Update the artifact-foundation coverage work and its
validation evidence so the materially changed artifact subsystem reaches at
least the required 90% floor, rather than documenting the current 89.42% result
as acceptable. Add targeted tests for the uncovered paths near the existing
coverage additions, rerun the artifact coverage gate, and record the passing
result before sign-off.
---
Outside diff comments:
In `@backend/tests/test_artifact_verification.py`:
- Around line 70-162: Ensure the test body after the initial
get_settings.cache_clear() is enclosed in a try/finally block, and call
get_settings.cache_clear() in the finally clause so the cache is cleared even
when assertions or setup fail. Remove reliance on the final cleanup call at the
end of the test.
🪄 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: c1b92141-3726-471a-81f9-0edb690aa2a3
📒 Files selected for processing (10)
.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-external-review-response.md.agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.mdbackend/app/adapters/artifacts/internal_workers.pybackend/app/modules/authorization/kernel.pybackend/app/modules/authorization/prepared.pybackend/app/workers/celery_app.pybackend/tests/test_alembic.pybackend/tests/test_artifact_internal_authorization.pybackend/tests/test_artifact_verification.py
🚧 Files skipped from review as they are similar to previous changes (7)
- .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/reviews/WS-XINT-002-03-pr-trust-bundle.md
- backend/app/workers/celery_app.py
- backend/app/modules/authorization/prepared.py
- backend/app/modules/authorization/kernel.py
- backend/tests/test_artifact_internal_authorization.py
- .agent-loop/initiatives/WS-XINT-002-art-auth-end-to-end/chunks/WS-XINT-002-03-internal-worker-activation.md
- backend/app/adapters/artifacts/internal_workers.py
WS-XINT-002-03 PR Trust Bundle
Chunk
WS-XINT-002-03— Internal Service Activation (L1).Goal and intent
Activate the minimum fixed ART service authority needed for verification,
pending-work scanning, and put-attempt resolution while preserving PREP's
transaction binding, single-use consumption, and deny-by-default behavior.
What changed
artifact.verification.execute,artifact.pending_work.scan, andartifact.put_attempt.resolve.action, service profile/link, exact resource, fence facts, request digest,
transaction, and idempotency scope.
fresh terminal authorization consumed atomically with evidence and state.
page, publishing only after commit.
requirecalls deny; only valid preparedconsumption can allow these actions.
extended existing audit-fact constraints to admit only its strict form.
schedule.
Security and failure properties
Copied, replayed, cross-action, cross-resource, stale-fence, replaced-
transaction, revoked, suspended, or post-I/O stale handles deny. Failed claim,
terminal, scanner, evidence, or state mutations roll back and can be retried
without reusing consumed authority. Human and Operator authority is not
expanded; all other ART service actions remain planned and issue no handle.
Evidence
evidence passed, including relationship conflict and scanner rollback.
diff checks passed.
risk.
head; no local four-hour full run is required.
Human review focus
Confirm the three-action activation boundary, claim/provider/terminal ordering,
exact scanner page binding, public clean-denial restaging, and strict audit
digest persistence. The user retains merge approval for this specific PR.
Next gate
WS-XINT-002-04is only the declared same-initiative successor. It does notstart automatically and requires a fresh explicit trusted-main event.
Summary by CodeRabbit
resource_context_digestvalidation in authorization audit evidence.