fix: wait for affiliated corps before lineage create (v0.87.1) - #164
Conversation
POST /api/analysis-runs already captured a live cutoff bag. Accepting a TEPP kind recorded Pending without calling tepp_client. Reject TEPP and period-report kinds with a next-action 422. Failed lineage copy names Request a lineage reconstruction. GET /api/me lists affiliated corps so a multi-affiliation operator can choose which entity to cover. Rebased onto the current #141 tip so #128 kind/status unions stay. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
POST /api/analysis-runs already captured a live cutoff bag. Accepting a TEPP kind recorded Pending without calling tepp_client. Reject TEPP and period-report kinds with a next-action 422. Failed lineage copy names Request a lineage reconstruction. GET /api/me lists affiliated corps so a multi-affiliation operator can choose which entity to cover. Rebased onto the current #141 tip so #128 kind/status unions stay. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Preserve the rebased 0.86.3 tree after #148 landed pending-kind copy. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Request stayed clickable while GET /api/me was in flight, so a multi-affiliation operator could POST without a corp. Disable the button until affiliated entities load, and reject TEPP/report kinds before any registry write in the ADR sequence. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Bring ADR 0017 onto v0.87.0 retention and Storybook. Request stays disabled until affiliated corps load. The corp picker is a tokenized Storybook module. Do not invent a theta. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
seonghobae
left a comment
There was a problem hiding this comment.
Review
Verdict: APPROVE (posted as COMMENT because GitHub rejects APPROVE on cursor[bot] PRs). No merge blockers. No inline comments.
CodeRabbit CLI is installed (0.7.3) but coderabbit auth login --agent timed out (Automatic login timed out. Use the printed fallback URL to finish authentication.). This review is from the HEAD files at abebd1c, not from CodeRabbit output.
Diff summary
24 files, +516 / −61, 69c035b (#145 / v0.87.0) → abebd1c (v0.87.1).
Intent: close the #125 hole that accepted analysis_run_tepp on create, and keep Request disabled until GET /api/me returns affiliated corps so a multi-affiliation token cannot POST before the picker exists.
Unique slice: _require_lineage_create_kind 422s TEPP / period-report / unknown before any snapshot write; /api/me now returns corporate_entities; home Request waits on that load; LineageEntityPicker is a tokenized Storybook module. Not start reconstruction (#142). Does not invent a theta.
Issues
Critical: none
Warning: none
Info: none
The lineage-only create landing passed review.
What was checked on the HEAD files
- 422-before-write.
create_pending_analysis_runcalls_require_lineage_create_kindbefore cutoff resolution, post fetch, or snapshot insert.test_create_pending_rejects_tepp_before_touching_the_registryuses a connection that asserts on any attribute access. HTTPtest_create_analysis_run_records_pending_without_inventing_a_score422s TEPP (invent a measurement, notheta) and report (Reports panel). Unknown kinds 422 with a next action. Lineage still writes snapshot + counts + run + scope + Pending in one transaction. /api/merace.corporateEntitiesstartsnull. Request is disabled withLoading affiliated entities...andaria-busyuntil me succeeds. Failed me sets an error and keeps Request disabled (Reload to choose a corporate entity). Multi-affiliation keeps Request disabled untilselectedEntityIdis set; the picker is visible on that same load. Tests cover delayed-me (no POST) and failed-me (disabled).- Product copy. Failed lineage names Request a lineage reconstruction and does not mention TEPP. Failed TEPP still points at the measurement service. Pending lineage says reconstruction has not started. Home caption stays
kind · status · entity;failure_codestays on detail history. Digest prefixes stay in the accessible group with the hover-full-digest hint. Live-post cutoff warning is unchanged (ADR 0016). - Storybook tokens.
LineageEntityPickeris a module underfrontend/src/components/. Preview importsindex.css→tokens.cssandApp.css. Inventory lists--space-control-gap,--size-control-min,--radius-control. Stories: two affiliations (choose, then Request) and single affiliation hidden. - ADR / docs / version. ADR 0017 sequence puts the kind check first. ADR 0014, ARCHITECTURE, CLAUDE, CHANGELOG, and the doctoring tables agree: Pending lineage only; TEPP/report are 422. Package version is 0.87.1 (
pyproject.toml,lineageweave/__init__.py,frontend/package.json). Synthetic Demo Corp / Northridge Grid only. - Idempotency. In-flight Request reuses one client key until success or 409, then mints a new key. 409 copy tells the operator to request again.
Suggested next steps
Prefer this over #157 (50a711a) and dirty #144 (026e866). After merge: wait until Request enables, choose a corp if the token walks more than one, click Request a lineage reconstruction, then open the Pending row to confirm the cutoff corpus. Start reconstruction remains #142 — rebase that onto this tip; do not fold start into #164.
There was a problem hiding this comment.
Stale comment
Review
Verdict: COMMENT (no merge blockers). CodeRabbit CLI 0.7.3 is installed;
coderabbit auth login --agenttimed out (Automatic login timed out). This assessment is from the HEAD files atabebd1c, not from CodeRabbit output.Diff summary
24 files, +516 / −61,
69c035b(#145 / v0.87.0) →abebd1c(v0.87.1).This is the lineage-only create landing.
POST /api/analysis-runsrecords Pending lineage only. TEPP, period-report, and unknown kinds 422 before any snapshot write. Request stays disabled untilGET /api/mereturns affiliated corps.LineageEntityPickeris a tokenized Storybook module. Does not invent a theta. Not start reconstruction (#142).Issues
Critical: none
Warning: none
Info: one residual, not merge-blocking — if
/api/mesucceeds with an emptycorporate_entitieslist, Request enables and the click POSTs without an id. The API already 422s (Choose the corporate entity this run should cover.). Demo Analyst always has a corp. Close on a later slice by disabling Request when the list is empty and naming the next action (ask an administrator to affiliate the account).Checked on HEAD
- Kind gate runs first;
ForbiddenConnectionproves TEPP create never touches the registry. HTTP tests 422 TEPP (invent a measurement, notheta) and report (Reports panel).- Request is
Loading affiliated entities...+aria-busywhile me is in flight; failed me keeps Request disabled. Delayed-me does not POST. Multi-affiliation picker appears on the same load.- Failed lineage names Request a lineage reconstruction and does not mention TEPP. Home caption stays
kind · status · entity. Digests stay audible.- ADR 0017 sequence, ADR 0014, ARCHITECTURE, CLAUDE, CHANGELOG, and doctoring tables agree. Version is 0.87.1.
- In-flight Request reuses one idempotency key until success or 409.
Prefer this over #157 (
50a711a) and dirty #144 (026e866). After merge: wait until Request enables, choose a corp if the token walks more than one, click Request a lineage reconstruction, then open the Pending row to confirm the cutoff corpus. Rebase #142 onto this tip; do not fold start into #164.Sent by Cursor Automation: Fix Issues
There was a problem hiding this comment.
Verdict: SOUND
POST /api/analysis-runs rejects TEPP, period-report, and unknown kinds in _require_lineage_create_kind before any registry read or write. A delayed or failed GET /api/me keeps Request disabled and does not POST. Unaffiliated or malformed corp ids stay 404. This path does not invent a theta.
Prefer this landing over #157 (50a711a) and dirty #144 (026e866). Do not merge those. Do not fold start reconstruction (#142 / #167) into this slice.
Locked on this head
- Kind check is the first statement in
create_pending_analysis_run.ForbiddenConnectionproves a TEPP body never touches the connection. - Request AccName is
Loading affiliated entities...until/api/mereturns, thenReload to choose a corporate entitywhen that call fails. - Failed lineage copy names Request a lineage reconstruction. Failed TEPP copy names the measurement service.
LineageEntityPickeris a tokenized Storybook module (Analysis/LineageEntityPicker).
Residual (not merge-blocking)
After /api/me returns two or more corps, the panel auto-selects the first id and enables Request. ADR 0017 says the operator chooses. The server still 422s if the id is omitted. A follow-up should keep Request disabled until the picker changes from the empty choice, and should keep it disabled when the account has no affiliated corp (today that click 422s).
Checks were still queued at review time. That is not a blocker for this verdict.
Reviewer seonghobae requested.
Sent by Cursor Automation: Fix Issues
There was a problem hiding this comment.
Follow-up for the residual auto-select note: #189 (19ba98e) keeps Request disabled until a multi-affiliation operator picks a corp, and keeps it disabled when the account has none. #164 stays SOUND for the 422-before-write and load-race. Prefer #189 when the buyer must choose. Do not merge #157 or #144.
Sent by Cursor Automation: Fix Issues


TL;DR
This is the lineage-only create landing on the #145 tip (v0.87.1).
POST /api/analysis-runsrecords Pending lineage only. TEPP and period-report kinds are 422 before any snapshot write. The Request button stays disabled until affiliated corps load, so a multi-affiliation operator cannot POST before the picker appears. Preview the picker in Storybook (Analysis/LineageEntityPicker).Prefer this over #157 (
50a711a) and dirty #144 (026e866). Do not merge those.Why this PR
#125 accepted
analysis_run_teppon create. A Pending TEPP row that never calledtepp_clientis a fabricated measurement request. #157 closed that hole but left Request clickable whileGET /api/mewas in flight, and it still claimed 0.86.3 after #145 landed 0.87.0.What to review first
backend/app/analysis_run_ingestion.py—_require_lineage_create_kind422s TEPP/report/unknown before any snapshot write./api/mereturns; picker then appears when the token walks more than one corp.LineageEntityPicker— tokenized module; StorybookAnalysis/LineageEntityPicker./api/medoes not POST; failed/api/mekeeps Request disabled.What this is not
Verify
cd frontend && pnpm run lint && pnpm exec tsc -b && pnpm run test— 62 passedcd frontend && pnpm run storybook— openAnalysis/LineageEntityPicker, choose Northridge GridAfter merge: open Analysis runs, wait until Request enables, choose a corp if needed, click Request a lineage reconstruction, then open the Pending row to confirm the cutoff corpus.