Skip to content

feat: seed a TEPP analysis run through tepp_client (v0.84.0) - #111

Closed
seonghobae wants to merge 1 commit into
feat/role-responsibility-agent-ontologyfrom
feat/analysis-run-tepp-seed
Closed

feat: seed a TEPP analysis run through tepp_client (v0.84.0)#111
seonghobae wants to merge 1 commit into
feat/role-responsibility-agent-ontologyfrom
feat/analysis-run-tepp-seed

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Buyer gap: home Analysis runs only showed lineage reconstruction.

Verified locally: tepp/seed pytest (4 passed); frontend 43 tests + oxlint.

@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e80a4cad-1a14-4030-ac3b-03a014a88011

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Stacked on #110. Do not merge before #74#110. Seeded TEPP run uses tepp_client; default transport is Failed / tepp_not_available. Never a fabricated theta.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale comment

The TEPP path is the right ecosystem move: tepp_seed_outcome() calls TeppClient and treats TeppNotAvailable as Failed / tepp_not_available instead of inventing a theta. Keep that. Do not merge this onto #110 at c2c8407.

Do this before the next review:

  1. Rebase onto the #110 repair (#114 at 8fb81d0, or the same two commits on feat/analysis-run-cutoff-posts). #110 still has the shared-fixture post-list break, unlabeled snapshot counts, and the lineage-run re-seed freeze.
  2. Skip frozen analysis_source_count inserts on the TEPP snapshot the same way #114 skips them on the lineage snapshot. ON CONFLICT DO NOTHING still fires BEFORE INSERT freeze.
  3. Move tepp_client and hashlib imports to the module top.
  4. Make AnalysisRunRequest.snapshot_id name the same capture this helper inserts. Today the request says demo-source-contract-v1 while the row is demo-tepp-contract-v1.
  5. 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_score is the right shape for the default transport. It does not prove make seed inserted the Failed run. After the rebase, add one authz_db or seed-script assertion that the Demo TEPP run exists with tepp_not_available.

Do not merge before #74 → repaired #110. Product CI does not run on this stacked base.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread scripts/seed_demo_data.py
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread scripts/seed_demo_data.py
insert into analysis_source_count
(analysis_source_snapshot_id, count_type_code, count_value)
values (%s, 'analysis_count_document', 3)
on conflict do nothing

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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. Default TeppClient fail-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 documents in App.test.tsx.

Requested changes

  1. Do not mark TEPP succeeded without a persisted TEPP payload. tepp_seed_outcome discards submit_analysis_run and returns succeeded if any transport accepts the request. Fail closed instead until a later slice stores the real measurement.
  2. 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.
  3. Stop writing dummy d… / e… reproducibility digests. The detail pane from #110 will show them as approved revision/config prefixes.
  4. 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.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread scripts/seed_demo_data.py
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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread scripts/seed_demo_data.py
return "analysis_status_failed", "tepp_not_available"
return "analysis_status_succeeded", None


Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread scripts/seed_demo_data.py
""",
(snapshot_id, requested_by_account_id, "d" * 64, "e" * 40),
)
run_id = cur.fetchone()[0]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale comment

REQUEST_CHANGES on 87ebe13.

Fail-closed TEPP usage is the right default: TeppClient is 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:

  1. Move the new tepp_client and hashlib imports to the top of scripts/seed_demo_data.py (workspace no-inline-imports rule).
  2. Rewrite the 0.84.0 changelog. The home list caption is kind · status · entity only. After seed it shows TEPP measurement · Failed · Demo Corp. tepp_not_available lives on detail status history (ADR 0014), not the list.
  3. Prove tepp_client was used. The new test passes if tepp_seed_outcome hard-codes the failed tuple. Spy submit_analysis_run and assert the seeded AnalysisRunRequest.
  4. 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-v1 on the wire and demo-tepp-contract-v1 in Postgres, and do not INSERT counts after a run already points at the snapshot (analysis_source_count_frozen_after_run fires BEFORE INSERT, so ON CONFLICT DO NOTHING still aborts make seed on 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.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread scripts/seed_demo_data.py
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Move this tepp_client import to the module top with psycopg2 / http_client. New code must not add inline imports.

Comment thread scripts/seed_demo_data.py
Uses :func:`tepp_seed_outcome`. Default transport is unavailable, so
the run ends Failed / ``tepp_not_available`` -- never a fake theta.
"""
import hashlib

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same rule: import hashlib at the top of the file. _seed_demo_analysis_run already inlines it; do not copy that pattern here.

Comment thread scripts/seed_demo_data.py
request = AnalysisRunRequest(
idempotency_key="demo-tepp-seed-2026-w02",
tenant_workspace_id="demo-workspace",
snapshot_id="demo-source-contract-v1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread scripts/seed_demo_data.py
else:
snapshot_id = snapshot_row[0]
cur.execute(
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread CHANGELOG.md

- `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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread frontend/src/App.test.tsx
},
],
},
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread frontend/src/App.test.tsx
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");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@seonghobae
seonghobae changed the base branch from feat/analysis-run-cutoff-posts to feat/role-responsibility-agent-ontology August 16, 2026 15:24
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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread scripts/seed_demo_data.py
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread scripts/seed_demo_data.py
except TeppNotAvailable:
return "analysis_status_failed", "tepp_not_available"
return "analysis_status_succeeded", None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread scripts/seed_demo_data.py
insert into analysis_source_count
(analysis_source_snapshot_id, count_type_code, count_value)
values (%s, 'analysis_count_document', 3)
on conflict do nothing

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread CHANGELOG.md

- `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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread frontend/src/App.test.tsx
},
],
},
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@seonghobae
seonghobae marked this pull request as draft August 16, 2026 15:33
seonghobae added a commit that referenced this pull request Aug 16, 2026
* 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>
@seonghobae seonghobae closed this Aug 16, 2026
seonghobae added a commit that referenced this pull request Aug 16, 2026
* 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>
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.

1 participant