fix(l1): resolve PR #193 backend review findings (1,4,5,6,7,8,9,10)
Server-assigns a uuid4 id to every AI-generated node (Finding 1 showstopper:
nodes had no id but the advance protocol keys on node_id, so ai_build walks
never advanced past question 1). Replaces the hidden {"node_type":"meta"}
walked_path convention with real category/problem_text/pending_node columns on
l1_walk_sessions (migration 61dda4f615c6) — fixes junk proposals + off-by-one
depth cap (Findings 8,9), and pending_node replays the served node on re-mount
(no duplicate paid LLM call). Intake honors explicit flow_id and adhoc=True
(Findings 4,5); flow_proposals.l1_session_id FK -> CASCADE (Finding 6 time
bomb); L1 category GET is owner+admin like PATCH and require_account_owner_or_admin
delegates to User.can_manage_account (Finding 7); escalate falls back to default
recipients + filters deleted_at + warns when empty (Finding 10). Cleanups: dead
ticket_ref removed, IntakeResponse per-outcome validator, unused acknowledged
dropped, escalations partial index, restored a deleted audit assertion.
Full Phase 2A backend set: 110 passed / 0 failed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,6 @@ from app.api.deps import (
|
||||
require_account_owner,
|
||||
require_account_owner_or_admin,
|
||||
require_engineer_or_admin,
|
||||
require_l1_or_above,
|
||||
)
|
||||
from app.services import l1_category_service
|
||||
from app.services.seat_enforcement import check_seat_available, get_seat_usage
|
||||
@@ -175,12 +174,13 @@ async def get_my_account_seat_usage(
|
||||
@router.get("/me/l1-categories", response_model=L1CategoriesResponse)
|
||||
async def get_l1_categories(
|
||||
db: Annotated[AsyncSession, Depends(get_db)],
|
||||
current_user: Annotated[User, Depends(require_l1_or_above)],
|
||||
current_user: Annotated[User, Depends(require_account_owner_or_admin)],
|
||||
):
|
||||
"""The account's enabled L1 AI-build categories + the available + hard-floor lists.
|
||||
|
||||
Readable by any L1-or-above user (the walker needs to know what's buildable);
|
||||
only owners/admins may change it (PATCH below).
|
||||
Owner/admin only — this is a settings surface, and read and write must agree
|
||||
(the walker gates server-side via match_or_build, it never fetches this). Same
|
||||
dep as PATCH so account admins can both read and save (Finding 7).
|
||||
"""
|
||||
enabled = await l1_category_service.get_enabled_categories(current_user.account_id, db)
|
||||
return L1CategoriesResponse(
|
||||
|
||||
Reference in New Issue
Block a user