-
Notifications
You must be signed in to change notification settings - Fork 1
feat: seed a TEPP analysis run through tepp_client (v0.84.0) #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # 0.84.0 TEPP analysis-run seed | ||
|
|
||
| Seed writes `analysis_run_tepp` via `tepp_client`. Missing transport | ||
| is Failed / `tepp_not_available`, not a fake measurement. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,16 @@ All notable changes to this project are documented here. Format follows | |
| [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning follows | ||
| [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [0.84.0] - 2026-08-16 | ||
|
|
||
| ### Added | ||
|
|
||
| - `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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The list caption is |
||
| `tepp_not_available` -- never a fabricated theta. TEPP stays a | ||
| wire client, not a local psychometric engine. | ||
|
|
||
| ## [0.83.0] - 2026-08-16 | ||
|
|
||
| ### Fixed | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,6 +236,25 @@ describe("App, authenticated", () => { | |
| }, | ||
| ], | ||
| }, | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This list fixture has no matching
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This list fixture has no matching |
||
| analysis_run_id: "run-demo-tepp", | ||
| run_kind_code: "analysis_run_tepp", | ||
| run_kind_label: "TEPP measurement", | ||
| scope_kind_code: "analysis_scope_corporate_entity", | ||
| scope_kind_label: "Corporate entity", | ||
| scope_entity_name: "Demo Corp", | ||
| status_code: "analysis_status_failed", | ||
| status_label: "Failed", | ||
| knowledge_cutoff: "2026-01-12T12:00:00Z", | ||
| requested_at: "2026-01-12T12:34:00Z", | ||
| source_counts: [ | ||
| { | ||
| count_type_code: "analysis_count_document", | ||
| count_type_label: "Documents", | ||
| count_value: 3, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }), | ||
| ); | ||
|
|
@@ -1374,6 +1393,7 @@ describe("App, authenticated", () => { | |
| 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"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| expect(list).toHaveTextContent("3 documents"); | ||
| expect(list).not.toHaveTextContent("postgresql://"); | ||
| expect(list).not.toHaveTextContent("select "); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,4 +55,4 @@ | |
| "sentence_excerpts", | ||
| ] | ||
|
|
||
| __version__ = "0.83.0" | ||
| __version__ = "0.84.0" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -333,6 +333,11 @@ def seed( | |
| account_ids["demo.analyst"], | ||
| corporate_entity_id, | ||
| ) | ||
| _seed_demo_tepp_run( | ||
| cur, | ||
| account_ids["demo.analyst"], | ||
| corporate_entity_id, | ||
| ) | ||
|
|
||
| conn.commit() | ||
| finally: | ||
|
|
@@ -1298,6 +1303,122 @@ def _seed_demo_analysis_run(cur, requested_by_account_id, corporate_entity_id) - | |
| ) | ||
|
|
||
|
|
||
| def tepp_seed_outcome() -> tuple[str, str | None]: | ||
| """Ask TEPP through the published client. A missing transport is Failed. | ||
|
|
||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move
|
||
|
|
||
| request = AnalysisRunRequest( | ||
| idempotency_key="demo-tepp-seed-2026-w02", | ||
| tenant_workspace_id="demo-workspace", | ||
| snapshot_id="demo-source-contract-v1", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This wire |
||
| knowledge_cutoff="2026-01-12T12:00:00Z", | ||
| model_contract_version="tepp-analysis-run-v1", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
| output_profile="calibrated_event_measurement", | ||
| ) | ||
| try: | ||
| TeppClient().submit_analysis_run(request) | ||
| except TeppNotAvailable: | ||
| return "analysis_status_failed", "tepp_not_available" | ||
| return "analysis_status_succeeded", None | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any injected transport that does not raise marks the run Keep the default |
||
| def _seed_demo_tepp_run(cur, requested_by_account_id, corporate_entity_id) -> None: | ||
| """Insert one Demo-Corp TEPP run so the kind is visible without a live TEPP. | ||
|
|
||
| Uses :func:`tepp_seed_outcome`. Default transport is unavailable, so | ||
| the run ends Failed / ``tepp_not_available`` -- never a fake theta. | ||
| """ | ||
| import hashlib | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same rule: import |
||
|
|
||
| digest = hashlib.sha256(b"lineageweave-synthetic-tepp-snapshot-v1").hexdigest() | ||
| cur.execute( | ||
| "select analysis_source_snapshot_id from analysis_source_snapshot " | ||
| "where snapshot_sha256 = %s", | ||
| (digest,), | ||
| ) | ||
| snapshot_row = cur.fetchone() | ||
| if snapshot_row is None: | ||
| cur.execute( | ||
| """ | ||
| insert into analysis_source_snapshot | ||
| (snapshot_sha256, source_contract_version, | ||
| maximum_available_time, captured_at) | ||
| values (%s, 'demo-tepp-contract-v1', | ||
| '2026-01-12T00:00:00Z', '2026-01-12T00:05:00Z') | ||
| returning analysis_source_snapshot_id | ||
| """, | ||
| (digest,), | ||
| ) | ||
| snapshot_id = cur.fetchone()[0] | ||
| else: | ||
| snapshot_id = snapshot_row[0] | ||
| cur.execute( | ||
| """ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After the first seed, a run already points at this snapshot. |
||
| insert into analysis_source_count | ||
| (analysis_source_snapshot_id, count_type_code, count_value) | ||
| values (%s, 'analysis_count_document', 3) | ||
| on conflict do nothing | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same freeze hole as #110 / #107. 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| """, | ||
| (snapshot_id,), | ||
| ) | ||
| cur.execute( | ||
| """ | ||
| select analysis_run_id from analysis_run | ||
| where requested_by_account_id = %s | ||
| and idempotency_key = 'demo-tepp-seed-2026-w02' | ||
| """, | ||
| (requested_by_account_id,), | ||
| ) | ||
| run_row = cur.fetchone() | ||
| if run_row is None: | ||
| cur.execute( | ||
| """ | ||
| insert into analysis_run | ||
| (analysis_source_snapshot_id, run_kind_code, idempotency_key, | ||
| requested_by_account_id, knowledge_cutoff, | ||
| configuration_schema_version, configuration_sha256, | ||
| code_revision_sha, requested_at) | ||
| values (%s, 'analysis_run_tepp', 'demo-tepp-seed-2026-w02', | ||
| %s, '2026-01-12T12:00:00Z', 'tepp-run-v1', %s, %s, | ||
| '2026-01-12T12:34:00Z') | ||
| returning analysis_run_id | ||
| """, | ||
| (snapshot_id, requested_by_account_id, "d" * 64, "e" * 40), | ||
| ) | ||
| run_id = cur.fetchone()[0] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Use the same digest source as the lineage seed run, or omit prefixes until a real revision is known. Do not invent reproducibility evidence. |
||
| else: | ||
| run_id = run_row[0] | ||
| cur.execute( | ||
| """ | ||
| insert into analysis_run_scope | ||
| (analysis_run_id, scope_kind_code, corporate_entity_id) | ||
| values (%s, 'analysis_scope_corporate_entity', %s) | ||
| on conflict (analysis_run_id) do nothing | ||
| """, | ||
| (run_id, corporate_entity_id), | ||
| ) | ||
| final_status, failure_code = tepp_seed_outcome() | ||
| events = [ | ||
| (1, "analysis_status_pending", "2026-01-12T12:35:00Z", None), | ||
| (2, "analysis_status_running", "2026-01-12T12:36:00Z", None), | ||
| (3, final_status, "2026-01-12T12:37:00Z", failure_code), | ||
| ] | ||
| for ordinal, status, occurred, fail in events: | ||
| cur.execute( | ||
| """ | ||
| insert into analysis_run_status_event | ||
| (analysis_run_id, status_ordinal, status_code, occurred_at, failure_code) | ||
| values (%s, %s, %s, %s, %s) | ||
| on conflict do nothing | ||
| """, | ||
| (run_id, ordinal, status, occurred, fail), | ||
| ) | ||
|
|
||
|
|
||
| def main() -> None: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("--postgres-dsn", default=DEFAULT_POSTGRES_DSN) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| """Seeded TEPP analysis runs go through tepp_client, never a local model.""" | ||
|
|
||
| from scripts.seed_demo_data import tepp_seed_outcome | ||
|
|
||
|
|
||
| def test_tepp_seed_outcome_is_unavailable_not_a_fake_score() -> None: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only proves the process-default Add a seed/Postgres case (or a monkeypatched insert helper) that: (1) default transport persists Failed /
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This passes if the function hard-codes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This passes if |
||
| status, failure = tepp_seed_outcome() | ||
| assert status == "analysis_status_failed" | ||
| assert failure == "tepp_not_available" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
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 · entityonly (analysisRunCaption). After seed the home list showsTEPP measurement · Failed · Demo Corpand does not showtepp_not_available. Say the list shows Failed, and that detail history keeps the machine code.