-
Notifications
You must be signed in to change notification settings - Fork 1
test(convergence): bind inferred residual proofs (#3899) #3899
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
3299455
db5d6de
f1b5533
9a489cd
23e584a
c040b54
0acc2b7
2917ced
6decc60
b101363
532e74b
c85d282
ed7f093
1e7c053
6a80b38
1e826a6
2276dac
5389ffa
1e559a9
cc47676
cd790ab
d11b06b
a7c2857
8bf4aa0
24b7d4a
833a169
d7746f5
78b45f8
09fd3e6
280d290
8e23770
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,12 +60,14 @@ def build_session_latency_profile_record( | |
| ) | ||
| if part | ||
| ) | ||
| source_updated_at = profile.updated_at | ||
| source_sort_timestamp = source_updated_at or profile.created_at | ||
| return SessionLatencyProfileRecord( | ||
| session_id=SessionId(str(session.id)), | ||
| materializer_version=SESSION_INSIGHT_MATERIALIZER_VERSION, | ||
| materialized_at=built_at, | ||
| source_updated_at=_iso_datetime(session.updated_at), | ||
| source_sort_key=float(session.updated_at.timestamp()) if session.updated_at is not None else None, | ||
| source_updated_at=_iso_datetime(source_updated_at), | ||
| source_sort_key=float(source_sort_timestamp.timestamp()) if source_sort_timestamp is not None else None, | ||
|
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.
For a session with Useful? React with 👍 / 👎.
Owner
Author
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. Reviewed at exact head e0cff49. The latency record retains the fallback sort key used for created-only sessions, and materialization uses that latency provenance. The fallback-sort-key and created-without-updated tests cover the readiness boundary. This older thread is addressed by the current branch. |
||
| input_high_water_mark=input_high_water_mark, | ||
| input_high_water_mark_source=input_high_water_mark_source, | ||
| input_row_count=input_row_count, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -787,6 +787,8 @@ def add_timing(name: str, started_at: float) -> None: | |
| profile, | ||
| latency_facts, | ||
| materialized_at=materialized_at, | ||
| input_high_water_mark=profile_record.input_high_water_mark, | ||
| input_high_water_mark_source=profile_record.input_high_water_mark_source, | ||
| ) | ||
| add_timing("build_records.latency_profile_record", t0) | ||
| t0 = time.perf_counter() | ||
|
|
@@ -1239,7 +1241,14 @@ def _large_session_profile_record_from_row( | |
| FallbackReason.NO_USER_TURNS, | ||
| ), | ||
| ) | ||
| source_sort_key = float(row["sort_key"]) if row["sort_key"] is not None else None | ||
| source_sort_timestamp = updated_at or created_at | ||
| source_sort_key = ( | ||
| float(row["sort_key"]) | ||
| if row["sort_key"] is not None | ||
| else float(source_sort_timestamp.timestamp()) | ||
| if source_sort_timestamp is not None | ||
| else None | ||
| ) | ||
| source_updated_at = updated_at.isoformat() if updated_at else None | ||
| search_text = " \n".join(part for part in (origin, title, row["git_branch"], row["git_repository_url"]) if part) | ||
| return SessionProfileRecord( | ||
|
|
@@ -1439,10 +1448,11 @@ def _stamp_bundle_materialization(conn: sqlite3.Connection, bundle: SessionInsig | |
| from polylogue.storage.sqlite.archive_tiers.write import apply_insight_materialization | ||
|
|
||
| profile = bundle.profile_record | ||
| latency = bundle.latency_profile_record | ||
| session_id = str(profile.session_id) | ||
| materialized_at_ms = _epoch_ms_or_none(profile.materialized_at) or 0 | ||
| source_updated_at_ms = _epoch_ms_or_none(profile.source_updated_at) | ||
| source_sort_key_ms = int(profile.source_sort_key * 1000) if profile.source_sort_key is not None else None | ||
| source_sort_key_ms = _source_sort_key_ms(profile.source_sort_key) | ||
| input_high_water_mark_ms = _epoch_ms_or_none(profile.input_high_water_mark) | ||
| # polylogue-f2qv.5: re-derive session_model_usage every time a session's | ||
| # insights are rebuilt (missing-profile backfill, stale-version repair, or | ||
|
|
@@ -1452,7 +1462,7 @@ def _stamp_bundle_materialization(conn: sqlite3.Connection, bundle: SessionInsig | |
| provider_usage_row_count = _refresh_provider_usage_rollup(conn, session_id) | ||
| for insight_type, materializer_version, input_row_count in ( | ||
| ("session_profile", profile.materializer_version, profile.input_row_count), | ||
| ("latency", profile.materializer_version, bundle.latency_profile_record.input_row_count), | ||
| ("latency", latency.materializer_version, latency.input_row_count), | ||
| ("work_events", SESSION_INSIGHT_MATERIALIZER_VERSION, len(bundle.work_event_records)), | ||
| ("phases", SESSION_INSIGHT_MATERIALIZER_VERSION, len(bundle.phase_records)), | ||
| ("runs", SESSION_INSIGHT_MATERIALIZER_VERSION, bundle.run_count), | ||
|
|
@@ -1461,20 +1471,34 @@ def _stamp_bundle_materialization(conn: sqlite3.Connection, bundle: SessionInsig | |
| ("thread", SESSION_INSIGHT_MATERIALIZER_VERSION, 1), | ||
| ("provider_usage", SESSION_INSIGHT_MATERIALIZER_VERSION, provider_usage_row_count), | ||
| ): | ||
| stamp_source_updated_at_ms = source_updated_at_ms | ||
| stamp_source_sort_key_ms = source_sort_key_ms | ||
| stamp_input_high_water_mark_ms = input_high_water_mark_ms | ||
| stamp_input_high_water_mark_source = profile.input_high_water_mark_source | ||
| if insight_type == "latency": | ||
| stamp_source_updated_at_ms = _epoch_ms_or_none(latency.source_updated_at) | ||
| stamp_source_sort_key_ms = _source_sort_key_ms(latency.source_sort_key) | ||
| stamp_input_high_water_mark_ms = _epoch_ms_or_none(latency.input_high_water_mark) | ||
| stamp_input_high_water_mark_source = latency.input_high_water_mark_source | ||
|
Comment on lines
+1481
to
+1482
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.
For every ordinary session rebuild, Useful? React with 👍 / 👎.
Owner
Author
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. Reviewed at exact head e0cff49. The ordinary latency rebuild now passes the profile provider high-water mark and source into the latency record, and the real convergence test asserts both the row and materialization marker. This current-head finding is addressed. |
||
| apply_insight_materialization( | ||
| conn, | ||
| insight_type=insight_type, | ||
| session_id=session_id, | ||
| materializer_version=materializer_version, | ||
| materialized_at_ms=materialized_at_ms, | ||
| source_updated_at_ms=source_updated_at_ms, | ||
| source_sort_key_ms=source_sort_key_ms, | ||
| input_high_water_mark_ms=input_high_water_mark_ms, | ||
| input_high_water_mark_source=profile.input_high_water_mark_source, | ||
| source_updated_at_ms=stamp_source_updated_at_ms, | ||
| source_sort_key_ms=stamp_source_sort_key_ms, | ||
| input_high_water_mark_ms=stamp_input_high_water_mark_ms, | ||
| input_high_water_mark_source=stamp_input_high_water_mark_source, | ||
| input_row_count=input_row_count, | ||
| ) | ||
|
|
||
|
|
||
| def _source_sort_key_ms(source_sort_key: float | None) -> int | None: | ||
| """Recover the canonical integer millisecond key from a float-seconds value.""" | ||
| return round(source_sort_key * 1000) if source_sort_key is not None else None | ||
|
|
||
|
|
||
| def _count_record_bundles( | ||
| bundles: Sequence[SessionInsightRecordBundle], | ||
| ) -> tuple[int, int, int]: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.