Files
ServerKit/backend/app/api/runs.py
T
Juan DenisandClaude Fable 5 3dbd234eb6 fix(ratchets): reconcile plan-77 additions with the standing gates
The full-suite run tripped four ratchets on plan-77's own additions —
exactly their job: /api/v1/runs moves onto auth_required (the JWT-only
ceiling holds at 605) and behind run_log_service.list_run_logs (no
model access in the controller); the core-blueprint snapshot records
runs_bp deliberately (108 -> 109 + sha); sso_service joins the crypto
allowlist (C2 dual-read lives there by design); the controller-boundary
baseline re-records the two pre-existing ManagedDatabase crossings under
their B5 query_active spelling (count unchanged).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 06:04:59 -04:00

22 lines
844 B
Python

"""Run envelope REST twin (plan 77 E1).
The polling counterpart of the `run_log` / `run_status` socket events: any
run kind's persisted lines, resumable via ?after_id, so a client that missed
socket frames (or has sockets disabled) can always catch up. The deploy kind
keeps its richer legacy endpoint (/api/v1/deployment-jobs/<id>/logs) — this
one serves every kind stored in run_log_entries.
"""
from flask import Blueprint, jsonify, request
from app.middleware.rbac import auth_required
from app.services.run_log_service import list_run_logs
runs_bp = Blueprint('runs', __name__)
@runs_bp.route('/<run_kind>/<run_id>/logs', methods=['GET'])
@auth_required()
def get_run_logs(run_kind, run_id):
after_id = request.args.get('after_id', type=int)
return jsonify({'logs': list_run_logs(run_kind, run_id, after_id=after_id)}), 200