feat: flexible intake — deferred variables + prepared sessions

Remove blocking intake form modal. Variables are now filled inline during
flow execution or pre-filled via prepared sessions. Adds PATCH /sessions/{id}/variables
endpoint, POST /sessions/prepare for session pre-staging, inline variable prompts
in StepDetail, editable Session Variables panel, and "Prepared for You" dashboard section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-10 01:42:52 -04:00
parent 4727106141
commit 299dff8bfc
22 changed files with 1117 additions and 95 deletions

View File

@@ -607,8 +607,8 @@ class TestProceduralFlowsAPI:
assert session_data["session_variables"]["server_name"] == "DC01"
assert session_data["tree_snapshot"]["tree_type"] == "procedural"
async def test_start_session_procedural_missing_required_field(self, client, auth_headers):
"""Starting a procedural session without required intake fields should fail."""
async def test_start_session_procedural_deferred_variables(self, client, auth_headers):
"""Starting a procedural session without required intake fields should succeed (deferred variables)."""
# Create published procedural tree with required intake form
create_resp = await client.post(
"/api/v1/trees",
@@ -623,17 +623,27 @@ class TestProceduralFlowsAPI:
)
tree_id = create_resp.json()["id"]
# Try to start without required fields
# Start without required fields — should succeed (deferred variables)
session_resp = await client.post(
"/api/v1/sessions",
json={
"tree_id": tree_id,
# Missing server_name and ip_address (both required)
# Missing server_name and ip_address — will be filled inline later
},
headers=auth_headers,
)
assert session_resp.status_code == 422
assert "Missing required" in session_resp.json()["detail"]
assert session_resp.status_code == 201
session_id = session_resp.json()["id"]
# Fill variables via PATCH endpoint
patch_resp = await client.patch(
f"/api/v1/sessions/{session_id}/variables",
json={"variables": {"server_name": "DC-01", "ip_address": "10.0.0.1"}},
headers=auth_headers,
)
assert patch_resp.status_code == 200
assert patch_resp.json()["session_variables"]["server_name"] == "DC-01"
assert patch_resp.json()["session_variables"]["ip_address"] == "10.0.0.1"
async def test_start_session_procedural_optional_fields_ok(self, client, auth_headers):
"""Starting a session with only required fields (optional missing) should work."""