Skip to content

fix: wait for affiliated corps before lineage create (v0.87.1) - #164

Open
cursor[bot] wants to merge 5 commits into
feat/role-responsibility-agent-ontologyfrom
cursor/bc-df79cce8-b5dd-4da6-afd2-4f5edc5104e7-4a0a
Open

fix: wait for affiliated corps before lineage create (v0.87.1)#164
cursor[bot] wants to merge 5 commits into
feat/role-responsibility-agent-ontologyfrom
cursor/bc-df79cce8-b5dd-4da6-afd2-4f5edc5104e7-4a0a

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

TL;DR

This is the lineage-only create landing on the #145 tip (v0.87.1). POST /api/analysis-runs records 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_tepp on create. A Pending TEPP row that never called tepp_client is a fabricated measurement request. #157 closed that hole but left Request clickable while GET /api/me was in flight, and it still claimed 0.86.3 after #145 landed 0.87.0.

What to review first

  1. backend/app/analysis_run_ingestion.py_require_lineage_create_kind 422s TEPP/report/unknown before any snapshot write.
  2. ADR 0017 sequence — kind check is first; the registry is not touched on 422.
  3. Home panel — Request stays on Loading affiliated entities... until /api/me returns; picker then appears when the token walks more than one corp.
  4. LineageEntityPicker — tokenized module; Storybook Analysis/LineageEntityPicker.
  5. Tests — delayed /api/me does not POST; failed /api/me keeps Request disabled.

What this is not

Verify

  • cd frontend && pnpm run lint && pnpm exec tsc -b && pnpm run test — 62 passed
  • cd frontend && pnpm run storybook — open Analysis/LineageEntityPicker, choose Northridge Grid

After 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.

cursoragent and others added 4 commits August 16, 2026 16:27
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>
@seonghobae seonghobae changed the title fix: wait for affiliated corps before lineage create (v0.86.3) fix: wait for affiliated corps before lineage create (v0.87.1) Aug 16, 2026
@seonghobae
seonghobae marked this pull request as ready for review August 16, 2026 16:39
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Author

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 seonghobae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_run calls _require_lineage_create_kind before cutoff resolution, post fetch, or snapshot insert. test_create_pending_rejects_tepp_before_touching_the_registry uses a connection that asserts on any attribute access. HTTP test_create_analysis_run_records_pending_without_inventing_a_score 422s TEPP (invent a measurement, no theta) and report (Reports panel). Unknown kinds 422 with a next action. Lineage still writes snapshot + counts + run + scope + Pending in one transaction.
  • /api/me race. corporateEntities starts null. Request is disabled with Loading affiliated entities... and aria-busy until me succeeds. Failed me sets an error and keeps Request disabled (Reload to choose a corporate entity). Multi-affiliation keeps Request disabled until selectedEntityId is 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_code stays 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. LineageEntityPicker is a module under frontend/src/components/. Preview imports index.csstokens.css and App.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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Review

Verdict: COMMENT (no merge blockers). CodeRabbit CLI 0.7.3 is installed; coderabbit auth login --agent timed out (Automatic login timed out). This assessment 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).

This is the lineage-only create landing. POST /api/analysis-runs records Pending lineage only. TEPP, period-report, and unknown kinds 422 before any snapshot write. Request stays disabled until GET /api/me returns affiliated corps. LineageEntityPicker is 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/me succeeds with an empty corporate_entities list, 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; ForbiddenConnection proves TEPP create never touches the registry. HTTP tests 422 TEPP (invent a measurement, no theta) and report (Reports panel).
  • Request is Loading affiliated entities... + aria-busy while 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.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread frontend/src/App.tsx
@cursor
cursor Bot requested a review from seonghobae August 16, 2026 16:52

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. ForbiddenConnection proves a TEPP body never touches the connection.
  • Request AccName is Loading affiliated entities... until /api/me returns, then Reload to choose a corporate entity when that call fails.
  • Failed lineage copy names Request a lineage reconstruction. Failed TEPP copy names the measurement service.
  • LineageEntityPicker is 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.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

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.

2 participants