Skip to content

fix: reject deploy of dead services and gate release on CI#47

Merged
GeiserX merged 2 commits into
mainfrom
fix/dead-service-and-ci-gates
May 13, 2026
Merged

fix: reject deploy of dead services and gate release on CI#47
GeiserX merged 2 commits into
mainfrom
fix/dead-service-and-ci-gates

Conversation

@GeiserX
Copy link
Copy Markdown
Owner

@GeiserX GeiserX commented May 13, 2026

Summary

  • Block deployment of services with status: dead in the deploy endpoint (/api/deploy/{slug}) with a 400 error, preventing users from deploying discontinued services like peer2profit
  • Add deprecation notice to docs/guides/peer2profit.md
  • Gate the release workflow on CI (ruff lint + pytest) by adding a ci job that release depends on, preventing publishing before tests pass

Test plan

  • Verify POST /api/deploy/peer2profit returns 400 with appropriate message
  • Verify deploy of active services still works normally
  • Verify release workflow YAML is valid and release job has needs: ci

Summary by CodeRabbit

  • Bug Fixes

    • Deploy requests now reject services marked as dead/discontinued, returning HTTP 410 with a clear message.
  • Documentation

    • Peer2Profit guide marked deprecated and noted as no longer deployable; retained for reference.
  • Chores

    • Release workflow updated to require CI (lint + tests) before publishing.
  • Tests

    • Added test verifying deployments against dead services return the expected error.
  • Chores

    • Added development linting tool to dev requirements.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds a CI job running Python 3.12, ruff lint/format checks, and pytest before release. Deploy endpoint now rejects services whose catalog status is "dead" with HTTP 410; Peer2Profit docs include a caution and tests verify the rejection.

Changes

Release 47: CI Integration and Service Deprecation

Layer / File(s) Summary
CI workflow job and release dependency
.github/workflows/release.yml, requirements-dev.txt
Adds ci job that checks out the repo, sets up Python 3.12, installs dev deps (adds ruff>=0.11.0), runs ruff and pytest. release job now needs: ci.
Deploy guard, docs, and tests
app/main.py, docs/guides/peer2profit.md, tests/test_main_deploy_routes.py
Deploy endpoint returns HTTP 410 when target service catalog status is "dead". Adds top-of-page CAUTION to Peer2Profit guide and a test asserting the 410 response and message.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately summarizes both main changes: rejecting dead service deployments and gating release on CI completion.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dead-service-and-ci-gates

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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)
app/main.py (1)

775-782: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Run dead-service validation before worker resolution.

Line 777 resolves worker_id before the dead-service guard (Lines 781-782). If workers are offline or multiple workers exist without worker_id, this endpoint can return unrelated 400/503 errors instead of the dead/discontinued rejection. Validate svc and status first, then resolve worker.

Suggested fix
 `@app.post`("/api/deploy/{slug}")
 async def api_deploy(request: Request, slug: str, body: DeployRequest, worker_id: int | None = None) -> dict[str, str]:
     _require_writer(request)
-    worker_id = await _resolve_worker_id(worker_id)
     svc = catalog.get_service(slug)
     if not svc:
         raise HTTPException(status_code=404, detail=f"Service '{slug}' not found")
     if svc.get("status") == "dead":
         raise HTTPException(status_code=400, detail=f"Service '{slug}' is no longer available (dead/discontinued)")
+    worker_id = await _resolve_worker_id(worker_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 `@app/main.py` around lines 775 - 782, In api_deploy, the worker resolution
(_resolve_worker_id) is being called before validating the service status,
causing worker-related errors to surface instead of the intended dead-service
rejection; reorder logic so that after calling catalog.get_service(slug) and
checking svc is not None and verifying svc.get("status") != "dead" (the
dead/discontinued guard), only then call worker_id = await
_resolve_worker_id(worker_id); keep the existing _require_writer(request) at the
top and preserve existing HTTPException responses and messages.
🤖 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 `@app/main.py`:
- Around line 775-782: In api_deploy, the worker resolution (_resolve_worker_id)
is being called before validating the service status, causing worker-related
errors to surface instead of the intended dead-service rejection; reorder logic
so that after calling catalog.get_service(slug) and checking svc is not None and
verifying svc.get("status") != "dead" (the dead/discontinued guard), only then
call worker_id = await _resolve_worker_id(worker_id); keep the existing
_require_writer(request) at the top and preserve existing HTTPException
responses and messages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d81eaefa-577e-4533-9caf-0bda6af5ee02

📥 Commits

Reviewing files that changed from the base of the PR and between 29c5c30 and 3157fe9.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • app/main.py
  • docs/guides/peer2profit.md

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.58%. Comparing base (29c5c30) to head (4ae66e4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #47   +/-   ##
=======================================
  Coverage   96.58%   96.58%           
=======================================
  Files          24       24           
  Lines        2373     2375    +2     
=======================================
+ Hits         2292     2294    +2     
  Misses         81       81           
Files with missing lines Coverage Δ
app/main.py 95.96% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

GeiserX added 2 commits May 13, 2026 12:09
Block deployment of services with status "dead" (e.g. peer2profit) with
a 400 error. Add deprecation notice to peer2profit guide. Ensure the
release workflow only publishes after lint and tests pass by adding a
ci job dependency.

Closes cp-gjea, cp-2wbv
…ip cache)

- Change dead service response from 400 to 410 (Gone) for correct REST semantics
- Add ruff to requirements-dev.txt instead of unpinned install in CI
- Add pip cache to CI setup-python step
- Add test for deploy of dead service returning 410
@GeiserX GeiserX force-pushed the fix/dead-service-and-ci-gates branch from 3157fe9 to 4ae66e4 Compare May 13, 2026 10:14
@GeiserX GeiserX merged commit 2321eac into main May 13, 2026
4 of 5 checks passed
@GeiserX GeiserX deleted the fix/dead-service-and-ci-gates branch May 13, 2026 10:16
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.

1 participant