Add project setup visibility APIs#76
Conversation
|
Warning Review limit reached
Next review available in: 6 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 (8)
📝 WalkthroughWalkthroughIntroduces a ChangesProject Setup Visibility Feature
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ProjectService
participant ProjectRepository
participant SetupQueue
participant CeleryWorker
ProjectService->>ProjectRepository: add_project_setup_run(queued)
ProjectService->>SetupQueue: enqueue_pre_submit_setup_pipeline(setup_run_id)
SetupQueue->>CeleryWorker: apply_async(setup_run_id)
CeleryWorker->>ProjectService: update_project_setup_run_status(running_sufficiency_agent)
CeleryWorker->>ProjectService: update_project_setup_run_status(policy_draft_ready/failed)
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
|
Just let me know what you need! (◕‿◕) ✅ Action performedFull review finished. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
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_projects.py (1)
760-767: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winTautological assertion —
setup_run_idis compared against itself.
enqueued[0]["setup_run_id"]is used both as the actual and expected value in the same equality assertion, so this never validates that a realsetup_run_idwas captured (it would pass even if it wereNoneor""). The equivalent guide-autostart test at Line 560 correctly asserts truthiness separately — this test should do the same.🐛 Proposed fix
+ assert len(enqueued) == 1 + assert enqueued[0]["setup_run_id"] assert enqueued == [ { "project_id": project["id"], "guide_id": guide["id"], "source_snapshot_id": snapshot["id"], "setup_run_id": enqueued[0]["setup_run_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/tests/test_projects.py` around lines 760 - 767, The assertion in the test for the enqueued setup job is tautological because `setup_run_id` is compared against itself inside the `enqueued` payload, so it never verifies that a real value was captured. Update the test around the `enqueued` assertion to first assert truthiness of `enqueued[0]["setup_run_id"]`, then compare the remaining fields in the payload, following the same pattern used by the guide-autostart test. Use the `enqueued` list and its first item consistently to locate the check.
🤖 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 `@docs/roadmap_status.md`:
- Line 66: Update the roadmap status entry to match the completed state of
WS-POL-001-12 instead of leaving it marked as in implementation. In the markdown
status document, adjust the line describing the Chunk 12 project setup-run and
project policy visibility APIs so it reflects that the work is
completed/reviewed, and make sure to run the stale wording scan across the
markdown files to catch any similar outdated status phrasing. Use the existing
roadmap section and the Chunk 12 entry as the primary place to update.
- Line 87: The phrase in the roadmap status description is awkward and should be
rewritten for clarity. Update the sentence containing “exercises project setup
visibility plus:” to use clearer wording, such as replacing it with “exercises
project setup visibility and the following flow:” so the description reads
naturally and consistently with the rest of the document.
---
Outside diff comments:
In `@backend/tests/test_projects.py`:
- Around line 760-767: The assertion in the test for the enqueued setup job is
tautological because `setup_run_id` is compared against itself inside the
`enqueued` payload, so it never verifies that a real value was captured. Update
the test around the `enqueued` assertion to first assert truthiness of
`enqueued[0]["setup_run_id"]`, then compare the remaining fields in the payload,
following the same pattern used by the guide-autostart test. Use the `enqueued`
list and its first item consistently to locate the check.
🪄 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: c0309ac8-d371-4fe1-b33e-b77f7f6042af
📒 Files selected for processing (28)
.agent-loop/LOOP_STATE.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/CHUNK_MAP.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/DECISIONS.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/DISCOVERY.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/PLAN.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/RISKS.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/STATUS.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/chunks/WS-POL-001-12-project-setup-policy-visibility-apis.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/chunks/WS-POL-001-13-task-context-submission-requirements-apis.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/chunks/WS-POL-001-14-submission-finalize-no-db-drill.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-12-internal-review-evidence.md.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/WS-POL-001-12-pr-trust-bundle.mdbackend/alembic/versions/0013_project_setup_runs.pybackend/app/db/models.pybackend/app/modules/projects/models.pybackend/app/modules/projects/repository.pybackend/app/modules/projects/router.pybackend/app/modules/projects/schemas.pybackend/app/modules/projects/service.pybackend/app/modules/projects/setup_queue.pybackend/app/workers/project_setup.pybackend/scripts/api_contract_e2e.pybackend/tests/test_projects.pydocs/architecture_data_model.mddocs/architecture_system_architecture.mddocs/glossary.mddocs/operations_project_operating_manual.mddocs/roadmap_status.md
| ``` | ||
|
|
||
| The script runs migrations forward and exercises: | ||
| The script runs migrations forward and exercises project setup visibility plus: |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Awkward phrasing: "exercises project setup visibility plus:".
Consider rewording for clarity, e.g. "exercises project setup visibility and the following flow:".
✏️ Proposed fix
-The script runs migrations forward and exercises project setup visibility plus:
+The script runs migrations forward and exercises project setup visibility and the following flow:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| The script runs migrations forward and exercises project setup visibility plus: | |
| The script runs migrations forward and exercises project setup visibility and the following flow: |
🤖 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 `@docs/roadmap_status.md` at line 87, The phrase in the roadmap status
description is awkward and should be rewritten for clarity. Update the sentence
containing “exercises project setup visibility plus:” to use clearer wording,
such as replacing it with “exercises project setup visibility and the following
flow:” so the description reads naturally and consistently with the rest of the
document.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Implements
WS-POL-001-12: project setup-run and project policy visibility APIs.This adds APIs 1-7 for operator visibility:
GET /api/v1/projects/{project_id}/guides/{guide_id}/setup-runs/latestGET /api/v1/projects/{project_id}/guides/{guide_id}/sufficiency-reportsGET /api/v1/projects/{project_id}/guides/{guide_id}/sufficiency-reports/{report_id}GET /api/v1/projects/{project_id}/guides/{guide_id}/submission-artifact-policiesGET /api/v1/projects/{project_id}/guides/{guide_id}/submission-artifact-policies/{policy_id}GET /api/v1/projects/{project_id}/guides/{guide_id}/effective-submission-artifact-policyGET /api/v1/projects/{project_id}/guides/{guide_id}/pre-submit-checker-policyKey Changes
ProjectSetupRunas a non-authoritative project setup ledger.Validation
Passed locally:
cd backend && .venv/bin/python -m ruff check app tests scriptspython3 scripts/check_stale_workstream_wording.pypython3 scripts/check_markdown_links.py7 passed2 passedcd backend && WORKSTREAM_DATABASE_URL=postgresql+asyncpg://workstream:workstream@localhost:5433/workstream_test .venv/bin/python scripts/api_contract_e2e.pyINTERNAL_REVIEW_CHUNK_ID=WS-POL-001-12 INTERNAL_REVIEW_HEAD_SHA=c143b54b62d6325a1d4787116e692fedfc5716f2 python3 scripts/check_internal_review_evidence.pyFull project suite also passed before the final optional same-project/different-guide list-scope hardening:
206 passed.Internal Review
All required internal reviewer tracks ran and sessions were closed:
Evidence and trust bundle are included under
.agent-loop/initiatives/WS-POL-001-submission-artifact-policy-foundation/reviews/.Human Review Focus
ProjectSetupRunremains a ledger, not policy truth.adminandproject_manager.checker_configswhile active-guide keeps its existing context shape.Not Included
Chunks 13 and 14 are not implemented here. The full no-DB Terminal Benchmark drill remains assigned to
WS-POL-001-14.Summary by CodeRabbit
New Features
Bug Fixes