Skip to content

Clean-cut contributor attribution to canonical human actors#153

Merged
abiorh-claw merged 10 commits into
mainfrom
codex/ws-auth-001-contributor-foundation
Jul 19, 2026
Merged

Clean-cut contributor attribution to canonical human actors#153
abiorh-claw merged 10 commits into
mainfrom
codex/ws-auth-001-contributor-foundation

Conversation

@Abiorh001

@Abiorh001 Abiorh001 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

WS-AUTH-001-CONTRIBUTOR-FOUNDATION PR Trust Bundle

Goal

Clean-cut task-assignment and submission human attribution to canonical
contributor_id, enforce human ActorProfile lineage at the database boundary,
and revalidate the exact active caller inside contributor-write transactions.

Changes

  • Renames and narrows both live owner columns and indexes with no alias, fallback,
    dual field, guessed identity mapping, or historical audit rewrite.
  • Adds exact foreign keys plus one reusable invoker-rights human-lineage trigger
    function and named triggers for both tables.
  • Adds actor-owned profile/link locking and task-owned task/assignment locking in
    canonical order for claim and submission, with stable 403 and retryable 503
    responses and rollback.
  • Updates public schemas, new audit evidence, the real API drill, current docs,
    persistent task coverage reporting, agent gates, and the schema-v2 merge intent.

Boundary

This PR changes no ActionId, PermissionId, evaluator, grant, role behavior,
authorization decision/evidence path, service admission, task lifecycle, review
or revision behavior. The temporary legacy role token and separately owned
attestation/profile route cleanup remain AUTH-13/14 work. AUTH-09E stays inactive.

Proof

  • Repaired migration matrix: 2 passed in 102.35 seconds.
  • Full observed contributor/lifecycle race matrix: 12 passed in 636.24 seconds.
  • Canonical API-error mapping: 1 passed in 63.79 seconds.
  • Real HTTP API contract drill: passed.
  • Focused actor/task unit and database behavior tests: passed.
  • Ruff, docstring gate (90.3 percent), stale scanners, Markdown links, diff
    integrity, one Alembic head, and 88 agent gates: passed.
  • No skips, xfails, weakened assertions, exclusions, or threshold reductions.

GitHub Backend remains the authoritative mandatory proof for global 78 percent
and persistent actor/authorization/task 90 percent coverage before merge.

Internal Review

Exact implementation SHA 4d1fc507c343d483677a332c2a91885e32571693 and
closeout head 4db178147bae457d9fccb3643fe6bd3919ba41c2 against trusted main
93dd392484b397cfdfaaa833631dc2c27f591ed7 passed senior engineering,
QA/test, security/auth, product/ops, architecture, CI integrity, docs,
reuse/dedup, and test-delta review after every valid finding was repaired.

Human Review Focus

Review migration refusal/redaction and reversible preservation, exact database
object names, profile-to-link-to-task-to-assignment lock order, lifecycle race
outcomes, 403/503 privacy and rollback, clean contributor_id API/evidence
shape, and absence of authorization availability or later AUTH-13/14 behavior.

Merge Ownership

The agent may publish and repair this branch but may not merge it. Only the
human may approve this PR for merge. After merge, trusted-main automation owns
schema-v2 memory generation; no manual post-merge memory PR should be opened
when that workflow succeeds.

Summary by CodeRabbit

  • New Features
    • Task assignments and submissions now attribute work to canonical contributors and revalidate eligible active contributor identity during claim and submission flows.
    • Added explicit, structured error handling for inactive/invalid/unavailable contributor identity states.
    • Added a migration/runtime guard to enforce human-only contributor attribution and stable enforcement behavior.
  • Breaking Changes
    • API payloads now use contributor_id instead of worker_id for assignments and submissions.
  • Documentation
    • Updated authorization, data model, operations, and submission guidance for contributor attribution and migration behavior.
  • Chores
    • Strengthened CI coverage reporting/gates for the tasks module.

@coderabbitai

coderabbitai Bot commented Jul 19, 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: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: 2ac5036b-9f69-4768-a398-a17872627937

📥 Commits

Reviewing files that changed from the base of the PR and between 55b8c10 and 6a70b33.

📒 Files selected for processing (3)
  • .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-CONTRIBUTOR-FOUNDATION-internal-review-evidence.md
  • .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-CONTRIBUTOR-FOUNDATION-pr-trust-bundle.md
  • backend/tests/test_tasks.py
📝 Walkthrough

Walkthrough

The PR establishes contributor-based task attribution through migration 0027_contributor_foundation, canonical human actor revalidation, locked task writes, structured errors, expanded tests and coverage gates, updated documentation, and revised authorization workstream state.

Changes

Contributor Foundation

Layer / File(s) Summary
Contributor contract and workstream definition
.agent-loop/initiatives/..., .agent-loop/merge-intents/*, docs/*
Defines contributor attribution, canonical human lineage, migration requirements, runtime eligibility, submission semantics, and verification rules.
Contributor schema migration and lineage guards
backend/alembic/versions/0027_contributor_foundation.py, backend/app/modules/tasks/models.py, backend/tests/test_alembic.py
Renames ownership fields to contributor_id, adds foreign keys and human-only triggers, validates legacy data, and tests upgrade, downgrade, dependency refusal, and atomic preflight failure.
Actor validation and contributor task flow
backend/app/modules/actors/service.py, backend/app/modules/tasks/*
Revalidates active human profiles and identity links, locks task records, persists contributor attribution, maps contributor failures to structured 403/503 responses, and updates audit redaction.
Behavioral tests and coverage gates
backend/tests/*, backend/scripts/api_contract_e2e.py, .github/workflows/backend.yml, scripts/test_agent_gates.py
Adds actor, migration, race, API, error-path, payload, and task coverage validation, including a 90% task-module threshold.
Review evidence and initiative state
.agent-loop/*
Updates review evidence, chunk status, work queue, loop state, signed-memory references, and contributor-foundation gating information.

Estimated code review effort: 5 (Critical) | ~90+ minutes

Sequence Diagram(s)

sequenceDiagram
  participant Contributor
  participant TaskService
  participant ActorService
  participant Database
  Contributor->>TaskService: claim task or submit work
  TaskService->>ActorService: validate active human writer
  ActorService->>Database: lock profile and identity link
  Database-->>ActorService: canonical actor state
  ActorService-->>TaskService: validation result
  TaskService->>Database: lock task and assignment
  Database-->>TaskService: persist contributor_id
  TaskService-->>Contributor: structured task response
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the main change, but it misses several required template sections like Chunk, Evidence commands, External Review, and CI/Gate Integrity. Rewrite it to follow the bundle template: add Chunk/merge intent, Human-Approved Intent, What Changed/Why/Design/Alternatives, Scope Control, Evidence, Test Delta, External Review, CI/Gate Integrity, Remaining Risks, and Follow-Up Work.
Docstring Coverage ⚠️ Warning Docstring coverage is 53.16% 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 summarizes the PR’s main change: canonical contributor attribution for human actors.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ws-auth-001-contributor-foundation

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.

@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.

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_alembic.py (1)

6628-6639: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Assert the complete index set, not an arbitrary matching index.

scalar() returns one matching index without ordering or checking cardinality. If both the legacy worker_id index and the new contributor_id index exist, this helper can select either one and still let the “exact schema shape” assertions pass. Return and assert the full ordered set (or at least assert count(*) = 1 plus the exact expected 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_alembic.py` around lines 6628 - 6639, Update the async
index helper around index to validate the complete matching index set instead of
using scalar(), which can return an arbitrary row. Return an ordered collection
of matching index names and update its callers to assert the exact expected set,
or enforce count(*) = 1 and assert the precise expected index name for each
table.
🤖 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.

Outside diff comments:
In `@backend/tests/test_alembic.py`:
- Around line 6628-6639: Update the async index helper around index to validate
the complete matching index set instead of using scalar(), which can return an
arbitrary row. Return an ordered collection of matching index names and update
its callers to assert the exact expected set, or enforce count(*) = 1 and assert
the precise expected index name for each table.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: be50a445-51ce-4c6d-83e6-aff995c59362

📥 Commits

Reviewing files that changed from the base of the PR and between f1a62bb and 55b8c10.

📒 Files selected for processing (3)
  • .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-CONTRIBUTOR-FOUNDATION-internal-review-evidence.md
  • .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-CONTRIBUTOR-FOUNDATION-pr-trust-bundle.md
  • backend/tests/test_alembic.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-CONTRIBUTOR-FOUNDATION-pr-trust-bundle.md
  • .agent-loop/initiatives/WS-AUTH-001-workstream-authorization-service/reviews/WS-AUTH-001-CONTRIBUTOR-FOUNDATION-internal-review-evidence.md

@abiorh-claw
abiorh-claw self-requested a review July 19, 2026 09:51
@abiorh-claw
abiorh-claw merged commit 8d5eb15 into main Jul 19, 2026
3 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 19, 2026
@abiorh-claw
abiorh-claw deleted the codex/ws-auth-001-contributor-foundation branch July 19, 2026 11:10
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