feat: seed a TEPP analysis run through tepp_client (v0.84.0) - #111
feat: seed a TEPP analysis run through tepp_client (v0.84.0)#111seonghobae wants to merge 1 commit into
Conversation
|
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. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Stale comment
The TEPP path is the right ecosystem move:
tepp_seed_outcome()callsTeppClientand treatsTeppNotAvailableas Failed /tepp_not_availableinstead of inventing a theta. Keep that. Do not merge this onto #110 atc2c8407.Do this before the next review:
- Rebase onto the #110 repair (#114 at
8fb81d0, or the same two commits onfeat/analysis-run-cutoff-posts). #110 still has the shared-fixture post-list break, unlabeled snapshot counts, and the lineage-run re-seed freeze.- Skip frozen
analysis_source_countinserts on the TEPP snapshot the same way #114 skips them on the lineage snapshot.ON CONFLICT DO NOTHINGstill firesBEFORE INSERTfreeze.- Move
tepp_clientandhashlibimports to the module top.- Make
AnalysisRunRequest.snapshot_idname the same capture this helper inserts. Today the request saysdemo-source-contract-v1while the row isdemo-tepp-contract-v1.- Add a doctoring/ADR note that seed records a failed TEPP run when the transport is missing, and that a later live transport must not write a local psychometric substitute.
test_tepp_seed_outcome_is_unavailable_not_a_fake_scoreis the right shape for the default transport. It does not provemake seedinserted the Failed run. After the rebase, add oneauthz_dbor seed-script assertion that the Demo TEPP run exists withtepp_not_available.Do not merge before #74 → repaired #110. Product CI does not run on this stacked base.
Sent by Cursor Automation: Fix Issues
| Never invents a psychometric score. ``tepp_not_available`` means the | ||
| channel was dropped, not a calibrated negative result. | ||
| """ | ||
| from lineageweave.tepp_client import AnalysisRunRequest, TeppClient, TeppNotAvailable |
There was a problem hiding this comment.
Move AnalysisRunRequest, TeppClient, and TeppNotAvailable to the module top with the other lineageweave imports. Same for hashlib in _seed_demo_tepp_run (and the existing lineage-run helper). Inline imports are disallowed unless there is a documented circular-import reason.
snapshot_id="demo-source-contract-v1" also does not match the TEPP snapshot this helper inserts (demo-tepp-contract-v1 / lineageweave-synthetic-tepp-snapshot-v1). If a transport is ever supplied, the request will name a different capture than the registry row. Use the same snapshot identity the insert uses.
| insert into analysis_source_count | ||
| (analysis_source_snapshot_id, count_type_code, count_value) | ||
| values (%s, 'analysis_count_document', 3) | ||
| on conflict do nothing |
There was a problem hiding this comment.
This is the same freeze hole as #110 / #107. BEFORE INSERT on analysis_source_count runs before ON CONFLICT. A second make seed after the TEPP run exists raises analysis_source_count_frozen_after_run.
Select existing counts and skip the insert when the snapshot already has rows — the same pattern as #114's lineage-run seed fix. Do not land this slice on #110 at c2c8407; rebase onto that repair first.
There was a problem hiding this comment.
Stale comment
Review of
87ebe13(stacked on #110)The buyer cut is right: home should show a TEPP kind, and a missing transport must be Failed /
tepp_not_available, never a fabricated theta. DefaultTeppClientfail-closed behavior matches that rule.Do not merge before #74 → #110. #110 still has open cutoff-test, live-list, and "3 documents" badge threads; this PR repeats
3 documentsinApp.test.tsx.Requested changes
- Do not mark TEPP
succeededwithout a persisted TEPP payload.tepp_seed_outcomediscardssubmit_analysis_runand returns succeeded if any transport accepts the request. Fail closed instead until a later slice stores the real measurement.- Bind the TEPP request to the snapshot this run persists.
snapshot_id="demo-source-contract-v1"is the other seed's contract string, not this run's digest /demo-tepp-contract-v1.- Stop writing dummy
d…/e…reproducibility digests. The detail pane from #110 will show them as approved revision/config prefixes.- Prove the no-fake-score contract in a seed/persistence test, not only
TeppClient()'s default raise.Independent review is still required; this comment does not approve or merge.
Sent by Cursor Automation: Fix Issues
| tenant_workspace_id="demo-workspace", | ||
| snapshot_id="demo-source-contract-v1", | ||
| knowledge_cutoff="2026-01-12T12:00:00Z", | ||
| model_contract_version="tepp-analysis-run-v1", |
There was a problem hiding this comment.
This snapshot_id is the lineage seed's source_contract_version string, not the snapshot this function persists (sha256(lineageweave-synthetic-tepp-snapshot-v1) / demo-tepp-contract-v1). A later real TEPP transport would measure a different capture than the run row. Pass the persisted snapshot digest (or UUID, if that is TEPP's published identifier) into tepp_seed_outcome.
| return "analysis_status_failed", "tepp_not_available" | ||
| return "analysis_status_succeeded", None | ||
|
|
||
|
|
There was a problem hiding this comment.
Any injected transport that does not raise marks the run succeeded and discards submit_analysis_run's return. The home list would then show a successful TEPP measurement with no theta, no calibration, and no stored response — a fabricated completion.
Keep the default TeppNotAvailable → Failed / tepp_not_available path. Do not return succeeded unless a later slice persists the real TEPP payload. Until then, unexpected success should fail closed (still Failed, distinct machine code) rather than look like a calibrated result.
| """, | ||
| (snapshot_id, requested_by_account_id, "d" * 64, "e" * 40), | ||
| ) | ||
| run_id = cur.fetchone()[0] |
There was a problem hiding this comment.
"d" * 64 / "e" * 40 are not the code or configuration that produced this run. #110 already surfaces revision and config prefixes on the detail pane, so make seed would show those dummy hex strings as if they were approved digests.
Use the same digest source as the lineage seed run, or omit prefixes until a real revision is known. Do not invent reproducibility evidence.
| from scripts.seed_demo_data import tepp_seed_outcome | ||
|
|
||
|
|
||
| def test_tepp_seed_outcome_is_unavailable_not_a_fake_score() -> None: |
There was a problem hiding this comment.
This only proves the process-default TeppClient() raises. It still passes if _seed_demo_tepp_run writes succeeded, stores a dummy theta, or stops calling tepp_client.
Add a seed/Postgres case (or a monkeypatched insert helper) that: (1) default transport persists Failed / tepp_not_available and no measurement payload; (2) a fake successful transport does not persist analysis_status_succeeded without a stored TEPP response. Accuracy here is "no fabricated psychometric result," not "the helper returned a string."
There was a problem hiding this comment.
Stale comment
REQUEST_CHANGES on
87ebe13.Fail-closed TEPP usage is the right default:
TeppClientis called, the missing transport becomes Failed /tepp_not_available, and no theta is invented. Keep that. Do not merge before #74 → #110, and do not merge this head until the items below are fixed.Fix before merge:
- Move the new
tepp_clientandhashlibimports to the top ofscripts/seed_demo_data.py(workspace no-inline-imports rule).- Rewrite the 0.84.0 changelog. The home list caption is
kind · status · entityonly. After seed it showsTEPP measurement · Failed · Demo Corp.tepp_not_availablelives on detail status history (ADR 0014), not the list.- Prove
tepp_clientwas used. The new test passes iftepp_seed_outcomehard-codes the failed tuple. Spysubmit_analysis_runand assert the seededAnalysisRunRequest.- Add a Failed TEPP detail mock and click that row. Today only list text is asserted; opening the TEPP run in this test 404s, so the machine code that distinguishes “not wired” from “measurement failed” is untested.
Also align the seed with ADR 0013 before calling this idempotent: reuse the lineage snapshot (one capture, many runs) instead of
demo-source-contract-v1on the wire anddemo-tepp-contract-v1in Postgres, and do notINSERTcounts after a run already points at the snapshot (analysis_source_count_frozen_after_runfires BEFORE INSERT, soON CONFLICT DO NOTHINGstill abortsmake seedon re-run).Do not invent a local Unavailable status, and do not fabricate a theta to make the list look green. Next action: apply the four fixes on this stack, then re-request review.
Sent by Cursor Automation: Fix Issues
| Never invents a psychometric score. ``tepp_not_available`` means the | ||
| channel was dropped, not a calibrated negative result. | ||
| """ | ||
| from lineageweave.tepp_client import AnalysisRunRequest, TeppClient, TeppNotAvailable |
There was a problem hiding this comment.
Move this tepp_client import to the module top with psycopg2 / http_client. New code must not add inline imports.
| Uses :func:`tepp_seed_outcome`. Default transport is unavailable, so | ||
| the run ends Failed / ``tepp_not_available`` -- never a fake theta. | ||
| """ | ||
| import hashlib |
There was a problem hiding this comment.
Same rule: import hashlib at the top of the file. _seed_demo_analysis_run already inlines it; do not copy that pattern here.
| request = AnalysisRunRequest( | ||
| idempotency_key="demo-tepp-seed-2026-w02", | ||
| tenant_workspace_id="demo-workspace", | ||
| snapshot_id="demo-source-contract-v1", |
There was a problem hiding this comment.
This wire snapshot_id is the lineage contract version, but the inserted snapshot uses demo-tepp-contract-v1 and a different digest. Reuse the lineage snapshot (ADR 0013: one capture, many runs) or set snapshot_id to the persisted snapshot identity so a later real transport submits the capture that seed stored.
| else: | ||
| snapshot_id = snapshot_row[0] | ||
| cur.execute( | ||
| """ |
There was a problem hiding this comment.
After the first seed, a run already points at this snapshot. enforce_analysis_source_count_freeze runs BEFORE INSERT, so ON CONFLICT DO NOTHING still raises analysis_source_count_frozen_after_run and rolls back the whole seed() transaction. Skip the count insert when the snapshot already has counts or is referenced by a run.
| from scripts.seed_demo_data import tepp_seed_outcome | ||
|
|
||
|
|
||
| def test_tepp_seed_outcome_is_unavailable_not_a_fake_score() -> None: |
There was a problem hiding this comment.
This passes if the function hard-codes analysis_status_failed / tepp_not_available. Spy TeppClient.submit_analysis_run (or inject a transport) and assert it was called with the seeded AnalysisRunRequest. A hardcoded skip is not proof the client was used.
|
|
||
| - `make seed` records a Demo Corp TEPP measurement run through | ||
| `tepp_client`. The default transport is unavailable, so the home | ||
| list shows "TEPP measurement · Failed · Demo Corp" with |
There was a problem hiding this comment.
The list caption is kind · status · entity only (analysisRunCaption). After seed the home list shows TEPP measurement · Failed · Demo Corp and does not show tepp_not_available. Say the list shows Failed, and that detail history keeps the machine code.
| }, | ||
| ], | ||
| }, | ||
| { |
There was a problem hiding this comment.
This list fixture has no matching GET /api/analysis-runs/run-demo-tepp stub. The lineage-only detail mock is at /api/analysis-runs/run-demo-lineage. Clicking the TEPP row in this test 404s.
| expect(await screen.findByRole("heading", { name: "Analysis runs" })).toBeInTheDocument(); | ||
| const list = screen.getByRole("list", { name: "Analysis runs" }); | ||
| expect(list).toHaveTextContent("Lineage reconstruction · Succeeded · Demo Corp"); | ||
| expect(list).toHaveTextContent("TEPP measurement · Failed · Demo Corp"); |
There was a problem hiding this comment.
Only list text is new. Click the Failed TEPP row and assert status history includes tepp_not_available. That is the buyer-visible difference between “channel dropped” and “measurement failed.”
Buyer gap: home Analysis runs only showed lineage reconstruction. make seed now records a Demo Corp TEPP measurement via tepp_client. The default transport is unavailable, so the row is Failed / tepp_not_available -- never a fabricated theta. TEPP stays a wire client, not a local psychometric engine.
87ebe13 to
34fdb89
Compare
There was a problem hiding this comment.
REQUEST_CHANGES on 34fdb892 (now stacked on #74, not #110).
Retargeting did not fix the seed holes. Fail-closed TEPP usage is still the right default — keep calling TeppClient and never invent a theta. Do not merge this head.
Land #118 instead. That repair reuses the shared Demo Corp snapshot, skips frozen count inserts, keeps a live unused envelope Failed / tepp_result_not_persisted, spies submit_analysis_run, and opens the Failed TEPP row so detail history shows tepp_not_available.
Do not merge #115: it still targets feat/analysis-run-cutoff-posts. Do not invent a local psychometric substitute. Independent review is still required; this comment does not approve or merge.
Next action: review and land #118 on #74, then close #111 and #115 as superseded.
Sent by Cursor Automation: Fix Issues
| Never invents a psychometric score. ``tepp_not_available`` means the | ||
| channel was dropped, not a calibrated negative result. | ||
| """ | ||
| from lineageweave.tepp_client import AnalysisRunRequest, TeppClient, TeppNotAvailable |
There was a problem hiding this comment.
Move AnalysisRunRequest, TeppClient, and TeppNotAvailable to the module top. New code must not add inline imports.
snapshot_id="demo-source-contract-v1" is the lineage contract string, not the snapshot this helper inserts (demo-tepp-contract-v1). Pass the shared Demo Corp digest (sha256(lineageweave-synthetic-demo-snapshot-v1)). That repair is on #118.
| except TeppNotAvailable: | ||
| return "analysis_status_failed", "tepp_not_available" | ||
| return "analysis_status_succeeded", None | ||
|
|
There was a problem hiding this comment.
Any injected transport that does not raise marks the run Succeeded and discards the envelope. The home list would then show a successful TEPP measurement with no stored payload.
Keep TeppNotAvailable → Failed / tepp_not_available. Until a later slice persists the real measurement, an unexpected accept must stay Failed (tepp_result_not_persisted).
| insert into analysis_source_count | ||
| (analysis_source_snapshot_id, count_type_code, count_value) | ||
| values (%s, 'analysis_count_document', 3) | ||
| on conflict do nothing |
There was a problem hiding this comment.
enforce_analysis_source_count_freeze runs BEFORE INSERT, so ON CONFLICT DO NOTHING still raises analysis_source_count_frozen_after_run on a second make seed. Select existing counts and skip the insert when the snapshot already has rows.
| from scripts.seed_demo_data import tepp_seed_outcome | ||
|
|
||
|
|
||
| def test_tepp_seed_outcome_is_unavailable_not_a_fake_score() -> None: |
There was a problem hiding this comment.
This passes if tepp_seed_outcome hard-codes the failed tuple. Spy submit_analysis_run and assert the seeded AnalysisRunRequest. Also prove an accepting transport does not persist analysis_status_succeeded.
|
|
||
| - `make seed` records a Demo Corp TEPP measurement run through | ||
| `tepp_client`. The default transport is unavailable, so the home | ||
| list shows "TEPP measurement · Failed · Demo Corp" with |
There was a problem hiding this comment.
The list caption is kind · status · entity only. After seed the home list shows TEPP measurement · Failed · Demo Corp and does not show tepp_not_available. Say the list shows Failed and the next action; detail history keeps the machine code.
| }, | ||
| ], | ||
| }, | ||
| { |
There was a problem hiding this comment.
This list fixture has no matching GET /api/analysis-runs/run-demo-tepp stub. Clicking the TEPP row 404s. Add the Failed detail (status history includes tepp_not_available) and click that row.
* feat: seed a TEPP analysis run through tepp_client (v0.84.0) Buyer gap: home Analysis runs only showed lineage reconstruction. make seed now records a Demo Corp TEPP measurement via tepp_client. The default transport is unavailable, so the row is Failed / tepp_not_available -- never a fabricated theta. TEPP stays a wire client, not a local psychometric engine. * fix: fail-closed TEPP seed on the shared Demo Corp snapshot #111 still marked a live unused envelope Succeeded, named a different capture than the registry row, and re-inserted frozen counts. Seed now reuses the lineage snapshot (ADR 0013), skips count inserts after the first run, and keeps missing or unused TEPP Failed. The home list tells the operator to open the run and connect TEPP; detail history keeps tepp_not_available. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com> --------- Co-authored-by: Seongho Bae <me@seonghobae.me> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
* feat: seed a TEPP analysis run through tepp_client (v0.84.0) Buyer gap: home Analysis runs only showed lineage reconstruction. make seed now records a Demo Corp TEPP measurement via tepp_client. The default transport is unavailable, so the row is Failed / tepp_not_available -- never a fabricated theta. TEPP stays a wire client, not a local psychometric engine. * fix: fail-closed TEPP seed on the shared Demo Corp snapshot #111 still marked a live unused envelope Succeeded, named a different capture than the registry row, and re-inserted frozen counts. Seed now reuses the lineage snapshot (ADR 0013), skips count inserts after the first run, and keeps missing or unused TEPP Failed. The home list tells the operator to open the run and connect TEPP; detail history keeps tepp_not_available. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com> * fix: keep failed-run next actions kind-specific A failed lineage row must not tell the operator to connect TEPP. Stacked PRs now run the same GitHub Checks as PRs to main. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com> * docs: keep TEPP next-action copy off failed lineage rows Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com> * fix: keep TEPP corpus hint off a succeeded measurement A calibrated TEPP row must not tell the operator to replace Failed. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com> --------- Co-authored-by: Seongho Bae <me@seonghobae.me> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>


Buyer gap: home Analysis runs only showed lineage reconstruction.
Verified locally: tepp/seed pytest (4 passed); frontend 43 tests + oxlint.