mostlyright-data 0.25.5__tar.gz → 0.25.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/PKG-INFO +5 -1
  2. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/README.md +4 -0
  3. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/pyproject.toml +1 -1
  4. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4.py +14 -2
  5. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_query.py +94 -11
  6. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_runs.py +58 -0
  7. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/.gitignore +0 -0
  8. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/scripts/hatch_build.py +0 -0
  9. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/SKILL.md +0 -0
  10. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/agents/openai.yaml +0 -0
  11. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/1-open-the-page-and-the-link-to-it-in-the-first-message.md +0 -0
  12. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/2-brief-two-to-four-questions-each-with-a-recommended-answer.md +0 -0
  13. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/3-probe-read-a-source-before-committing-to-it.md +0 -0
  14. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/4-decide-say-what-you-chose-what-you-refused-and-ask-one-question.md +0 -0
  15. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/5-draft-one-recipe-document-one-call.md +0 -0
  16. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md +0 -0
  17. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/7-interrogate-ask-the-run-what-it-actually-delivered.md +0 -0
  18. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/8-fix-revise-the-document-and-register-it-again.md +0 -0
  19. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/9-present-only-what-survived-inspection-with-caveats.md +0 -0
  20. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/agent-protocol.md +0 -0
  21. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/autonomous-delivery.md +0 -0
  22. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/before-the-first-tool-call.md +0 -0
  23. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/boundaries.md +0 -0
  24. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/cloud-authentication-preflight.md +0 -0
  25. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/commands.md +0 -0
  26. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/cross-repository-protocol-reference.md +0 -0
  27. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/installation-parity.md +0 -0
  28. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/live-run.md +0 -0
  29. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/narrating-the-run.md +0 -0
  30. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/not-hosted-yet.md +0 -0
  31. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/one-install.md +0 -0
  32. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/prediction-labels.md +0 -0
  33. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/promote.md +0 -0
  34. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/readers.md +0 -0
  35. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/receipts.md +0 -0
  36. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/recording-a-stream-venue.md +0 -0
  37. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/recovering-an-import-failure.md +0 -0
  38. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/reference-pages.md +0 -0
  39. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/required-protocol.md +0 -0
  40. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/source-credentials.md +0 -0
  41. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/sources.md +0 -0
  42. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/the-one-thing-to-say-about-the-skill-itself.md +0 -0
  43. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/transforms.md +0 -0
  44. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/user-communication-contract.md +0 -0
  45. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/references/writing-a-decision-record.md +0 -0
  46. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/skills/mr-data-build/scripts/write_research_notebook.py +0 -0
  47. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/__init__.py +0 -0
  48. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/agent_protocol.py +0 -0
  49. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/canonical.py +0 -0
  50. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/formats.py +0 -0
  51. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/hosted_crawler_protocol.py +0 -0
  52. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/key_seam.py +0 -0
  53. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/page_coverage.py +0 -0
  54. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/part_check_evidence.py +0 -0
  55. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/session_probes.py +0 -0
  56. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/skill_assets.py +0 -0
  57. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/table_manifest.py +0 -0
  58. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/__init__.py +0 -0
  59. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/acquire.py +0 -0
  60. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/acquire_cancel.py +0 -0
  61. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/activity.py +0 -0
  62. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/approvals.py +0 -0
  63. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/categories.py +0 -0
  64. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/commands.py +0 -0
  65. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/dataset-categories-v1.json +0 -0
  66. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/download.py +0 -0
  67. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/narrative.py +0 -0
  68. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/parity.py +0 -0
  69. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/probe.py +0 -0
  70. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/progress_vocabulary.py +0 -0
  71. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/propose.py +0 -0
  72. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/recipe.py +0 -0
  73. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/recipe_brief.py +0 -0
  74. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/recipe_lint.py +0 -0
  75. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/research.py +0 -0
  76. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/router.py +0 -0
  77. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/runs.py +0 -0
  78. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/session.py +0 -0
  79. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/stream.py +0 -0
  80. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/stream_venue.py +0 -0
  81. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/transport.py +0 -0
  82. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/user_agent.py +0 -0
  83. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_artifacts.py +0 -0
  84. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_catalog.py +0 -0
  85. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_connections.py +0 -0
  86. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_dataset_covers.py +0 -0
  87. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_datasets.py +0 -0
  88. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_handoff.py +0 -0
  89. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_narrative.py +0 -0
  90. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_reader.py +0 -0
  91. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_secrets.py +0 -0
  92. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_stream.py +0 -0
  93. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/v4_tables.py +0 -0
  94. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/thin/vocabulary.py +0 -0
  95. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/__init__.py +0 -0
  96. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/attendance.py +0 -0
  97. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/clarification.py +0 -0
  98. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/cloud_auth.py +0 -0
  99. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/commands/__init__.py +0 -0
  100. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/commands/auth.py +0 -0
  101. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/commands/clarify.py +0 -0
  102. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/commands/login.py +0 -0
  103. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/commands/whoami.py +0 -0
  104. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/credential_native.py +0 -0
  105. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/credential_store.py +0 -0
  106. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/credentials.py +0 -0
  107. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/login.py +0 -0
  108. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/path_kind.py +0 -0
  109. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/plain_file.py +0 -0
  110. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/remediation.py +0 -0
  111. {mostlyright_data-0.25.5 → mostlyright_data-0.25.6}/src/mostlyright/data_harness/ux/render.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyright-data
3
- Version: 0.25.5
3
+ Version: 0.25.6
4
4
  Summary: Mostly Right hosted CLI for reviewed datasets
5
5
  Project-URL: Homepage, https://mostlyright.md/
6
6
  Project-URL: Documentation, https://mostlyright.md/docs/guides/cli/
@@ -86,6 +86,10 @@ Full builds are progressive by default: one acquisition exposes an inspection ch
86
86
  about five minutes and continues toward the finished table. Inspect it with
87
87
  `mr-data status RUN_ID --inspection --json`; the checkpoint does not pause for approval or start
88
88
  another full acquisition. Any required spend confirmation happens before acquisition.
89
+ When a run has sealed queryable table checkpoints, `mr-data status RUN_ID --checkpoints --json`
90
+ lists their exact immutable identifiers and `mr-data query RUN_ID "SELECT …" --checkpoint
91
+ CHECKPOINT_ID` reads one without advancing underneath the query. These workspace-private snapshots
92
+ remain incomplete, keep checks pending, and never become the serving table.
89
93
  `--progressive` remains a compatibility alias. Use `--sample` only for an explicit standalone
90
94
  bounded inspection; row ceilings do not impose a five-minute acquisition limit.
91
95
 
@@ -74,6 +74,10 @@ Full builds are progressive by default: one acquisition exposes an inspection ch
74
74
  about five minutes and continues toward the finished table. Inspect it with
75
75
  `mr-data status RUN_ID --inspection --json`; the checkpoint does not pause for approval or start
76
76
  another full acquisition. Any required spend confirmation happens before acquisition.
77
+ When a run has sealed queryable table checkpoints, `mr-data status RUN_ID --checkpoints --json`
78
+ lists their exact immutable identifiers and `mr-data query RUN_ID "SELECT …" --checkpoint
79
+ CHECKPOINT_ID` reads one without advancing underneath the query. These workspace-private snapshots
80
+ remain incomplete, keep checks pending, and never become the serving table.
77
81
  `--progressive` remains a compatibility alias. Use `--sample` only for an explicit standalone
78
82
  bounded inspection; row ceilings do not impose a five-minute acquisition limit.
79
83
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyright-data"
3
- version = "0.25.5"
3
+ version = "0.25.6"
4
4
  description = "Mostly Right hosted CLI for reviewed datasets"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -119,8 +119,8 @@ from mostlyright.data_harness.thin.transport import ThinLaneError
119
119
  #: ``JOB_INVALID`` outright, which in production was every refresh a collection epoch was offered
120
120
  #: for rather than only the collection runs. This package must not reach a Studio older than the
121
121
  #: commit it pins; ``docs/V4-WORKER-PROTOCOL.md`` states it beside the layout's own ordering rule.
122
- PINNED_V4_OPENAPI_SOURCE_SHA256 = "8af29918f5568dcc64d104f137dbf6bf88562e0687c9fb054ea9266cf4c5146b"
123
- PINNED_V4_CONTRACT_VERSION = "4.11.0"
122
+ PINNED_V4_OPENAPI_SOURCE_SHA256 = "2f4e1f566bfd788ba1f9981d8b214c62e43294320da87167ced462a527abe848"
123
+ PINNED_V4_CONTRACT_VERSION = "4.12.0"
124
124
 
125
125
  # --------------------------------------------------------------------------------------------
126
126
  # The routes
@@ -215,6 +215,14 @@ RUN_PROGRESS_PATH = "/v4/runs/{run_id}/progress"
215
215
  #: ``GET`` -- declared shape and bounded observed evidence for a progressive full run.
216
216
  RUN_INSPECTION_PATH = "/v4/runs/{run_id}/inspection"
217
217
 
218
+ #: ``GET`` -- the bounded list of immutable, workspace-private snapshots this run has sealed.
219
+ RUN_CHECKPOINTS_PATH = "/v4/runs/{run_id}/checkpoints"
220
+
221
+ #: ``GET`` -- one exact immutable build checkpoint. ``POST :resolve`` on the same path belongs to
222
+ #: Cloud's query executor; the thin client queries through the ordinary run query route instead
223
+ #: of receiving artifact storage coordinates.
224
+ RUN_CHECKPOINT_PATH = "/v4/runs/{run_id}/checkpoints/{checkpoint_id}"
225
+
218
226
  # Reader recovery uses Studio's versioned authority. These routes deliberately live beside the
219
227
  # other V4 wire constants so a client cannot silently turn transport canonicalisation into reader
220
228
  # validation.
@@ -603,6 +611,8 @@ DECLARED_V4_PATHS: frozenset[str] = frozenset(
603
611
  RUN_EVENTS_PATH,
604
612
  RUN_PROGRESS_PATH,
605
613
  RUN_INSPECTION_PATH,
614
+ RUN_CHECKPOINTS_PATH,
615
+ RUN_CHECKPOINT_PATH,
606
616
  # ⚠ PROMOTED OUT OF `PENDING_V4_PATHS` IN THE COMMIT THAT STARTED CALLING THEM. Studio
607
617
  # shipped the whole promotion surface while this client was being written against the
608
618
  # contract for it, and the ledger in `tests/test_thin_v4_contract.py` went red naming all
@@ -944,6 +954,8 @@ __all__ = [
944
954
  "RESCHEDULE_TABLE_PATH",
945
955
  "RESYNC_TABLE_PATH",
946
956
  "RUN_ARTIFACTS_PATH",
957
+ "RUN_CHECKPOINTS_PATH",
958
+ "RUN_CHECKPOINT_PATH",
947
959
  "RUN_EVENTS_PATH",
948
960
  "RUN_INSPECTION_PATH",
949
961
  "RUN_PROGRESS_PATH",
@@ -38,6 +38,7 @@ hop later.
38
38
  from __future__ import annotations
39
39
 
40
40
  import argparse
41
+ import re
41
42
  import time
42
43
  from collections.abc import Callable, Mapping
43
44
  from typing import Any
@@ -114,6 +115,8 @@ MASKED_SCAN_WARNING = (
114
115
  'export is refused; writing that identifier in "double quotes" puts it outside the scan'
115
116
  )
116
117
 
118
+ _CONTENT_DIGEST = re.compile(r"^sha256:[0-9a-f]{64}$")
119
+
117
120
  #: The four refusals that happen BEFORE anything is queued, and the fifth that bounds the body,
118
121
  #: each with the sentence this command adds to Studio's own message. Keyed by Studio's code, which
119
122
  #: is what ``thin.runs._studio_refusal`` carries through verbatim as ``THIN_STUDIO_{code}``.
@@ -199,7 +202,8 @@ class StudioV4QueryClient(StudioV4Client):
199
202
  """Queue one bounded read. ``202`` on a new query AND on a repeat of an identical one.
200
203
 
201
204
  ⚠ ``202`` IS THE ONLY ACCEPTED STATUS, and a repeat is not a second status. Studio derives
202
- the identifier from the digest of the canonical ``{sql, max_rows}`` command, so two
205
+ the identifier from the digest of the canonical command, including its immutable
206
+ checkpoint coordinate when present, so two
203
207
  identical submits converge on one query and the second answers ``202`` again with
204
208
  ``Idempotent-Replay: true``. Reading the header is what lets this command say which of the
205
209
  two happened; treating the replay as a fresh execution would tell an agent it had spent
@@ -295,7 +299,9 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
295
299
  f"for at most {int(MAX_QUERY_WAIT_SECONDS)} seconds, whichever comes first -- it is never "
296
300
  "a long poll. A wait that ends first leaves the question running and prints its "
297
301
  "identifier; running the same command again reads that same one back, because the "
298
- "identifier is derived from the statement, the row limit and the prune block. "
302
+ "identifier is derived from the statement, the row limit, the prune block and the "
303
+ "optional checkpoint. A checkpoint is already one exact immutable snapshot, so it "
304
+ "cannot be combined with --field, --from, --to or --partition. "
299
305
  "A table version is many Parquet parts and a bounded read may open only so many of "
300
306
  "them, so a question about a wide table is narrowed with --field plus --from/--to, or "
301
307
  "with --partition; Studio evaluates that against the part list before a worker is woken, "
@@ -317,6 +323,13 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
317
323
  help="stop at this many rows; left out, the server's own ceiling applies. A number above "
318
324
  "that ceiling is refused rather than lowered",
319
325
  )
326
+ parser.add_argument(
327
+ "--checkpoint",
328
+ metavar="CHECKPOINT_ID",
329
+ help="ask one immutable build checkpoint instead of the run's final table. The result "
330
+ "stays bound to this exact checkpoint while newer build data arrives; it cannot be "
331
+ "combined with --field, --from, --to or --partition",
332
+ )
320
333
  parser.add_argument(
321
334
  "--field",
322
335
  help="which field --from and --to are about, by column name. Without --from or --to it "
@@ -369,10 +382,10 @@ def _client(args: argparse.Namespace) -> StudioV4QueryClient:
369
382
  def submit_body(args: argparse.Namespace) -> dict[str, Any]:
370
383
  """The ``submit_query_command`` this invocation means, checked before anything is sent.
371
384
 
372
- Two members, because Studio decides everything else: the run names the table, the bearer names
373
- the workspace, and the deadline is deployment policy. ``max_rows`` is left OUT rather than sent
374
- as ``null`` when the caller states none -- "as many as the server allows" is a member absent,
375
- and a null would be refused by a command schema that admits two properties and no nulls.
385
+ The run names the table, the bearer names the workspace, and the deadline is deployment
386
+ policy. ``max_rows`` and ``checkpoint_id`` are left OUT rather than sent as ``null`` when the
387
+ caller states none. An absent checkpoint asks the final run table; an exact checkpoint keeps
388
+ the answer stable while later build data arrives.
376
389
  """
377
390
 
378
391
  statement = str(getattr(args, "sql", "") or "")
@@ -382,7 +395,16 @@ def submit_body(args: argparse.Namespace) -> dict[str, Any]:
382
395
  'mr-data query needs the question to ask: mr-data query RUN "SELECT ..."',
383
396
  )
384
397
  body: dict[str, Any] = {"sql": statement}
398
+ checkpoint = getattr(args, "checkpoint", None)
399
+ if checkpoint is not None:
400
+ body["checkpoint_id"] = identifier(str(checkpoint), "checkpoint identifier")
385
401
  prune = _prune(args)
402
+ if checkpoint is not None and prune:
403
+ raise ThinLaneError(
404
+ "THIN_REQUEST_INVALID",
405
+ "--checkpoint already names one exact immutable snapshot and cannot be combined "
406
+ "with --field, --from, --to or --partition",
407
+ )
386
408
  if prune:
387
409
  body["prune"] = prune
388
410
  max_rows = getattr(args, "max_rows", None)
@@ -464,6 +486,40 @@ def _record_identifier(record: Mapping[str, Any], run_id: str) -> str:
464
486
  return query_id
465
487
 
466
488
 
489
+ def _checkpoint_binding(
490
+ record: Mapping[str, Any],
491
+ checkpoint_id: str | None,
492
+ checkpoint_content_digest: str | None = None,
493
+ ) -> str | None:
494
+ """Validate the immutable coordinate on every submit and poll response."""
495
+
496
+ actual_id = record.get("checkpoint_id")
497
+ actual_digest = record.get("checkpoint_content_digest")
498
+ if checkpoint_id is None:
499
+ if actual_id is not None or actual_digest is not None:
500
+ raise ThinLaneError(
501
+ "THIN_RESPONSE_INVALID",
502
+ "Studio bound a final-table query to an unexpected build checkpoint",
503
+ )
504
+ return None
505
+ if actual_id != checkpoint_id:
506
+ raise ThinLaneError(
507
+ "THIN_RESPONSE_INVALID",
508
+ "Studio answered with a query bound to another or no build checkpoint",
509
+ )
510
+ if not isinstance(actual_digest, str) or _CONTENT_DIGEST.fullmatch(actual_digest) is None:
511
+ raise ThinLaneError(
512
+ "THIN_RESPONSE_INVALID",
513
+ "Studio answered a checkpoint query without its sealed content digest",
514
+ )
515
+ if checkpoint_content_digest is not None and actual_digest != checkpoint_content_digest:
516
+ raise ThinLaneError(
517
+ "THIN_RESPONSE_INVALID",
518
+ "Studio changed the checkpoint content digest while the query was running",
519
+ )
520
+ return actual_digest
521
+
522
+
467
523
  def _named_refusal(refusal: ThinLaneError) -> ThinLaneError:
468
524
  """One pre-queue refusal, with the sentence this command adds and the ``details`` it carries.
469
525
 
@@ -547,6 +603,8 @@ def _answer(record: Mapping[str, Any]) -> dict[str, Any]:
547
603
  "state": record.get("state"),
548
604
  "sql": record.get("sql"),
549
605
  "max_rows": record.get("max_rows"),
606
+ "checkpoint_id": record.get("checkpoint_id"),
607
+ "checkpoint_content_digest": record.get("checkpoint_content_digest"),
550
608
  # How much of the table this answer is an answer about. Studio records it because a
551
609
  # caller who pruned should be able to see that a one-day window read two parts rather
552
610
  # than be told to trust that it did.
@@ -606,7 +664,16 @@ def query(
606
664
  again.retry_after_seconds = window # type: ignore[attr-defined]
607
665
  raise _named_refusal(again) from None
608
666
  try:
609
- payload = _settled(selected, args, run_id, record, headers, sleep=sleep, clock=clock)
667
+ payload = _settled(
668
+ selected,
669
+ args,
670
+ run_id,
671
+ record,
672
+ headers,
673
+ checkpoint_id=body.get("checkpoint_id"),
674
+ sleep=sleep,
675
+ clock=clock,
676
+ )
610
677
  finally:
611
678
  closed = warm.close() if warm is not None else None
612
679
  if warm is not None:
@@ -625,6 +692,7 @@ def _settled(
625
692
  record: Mapping[str, Any],
626
693
  headers: Mapping[str, str],
627
694
  *,
695
+ checkpoint_id: str | None,
628
696
  sleep: Callable[[float], None],
629
697
  clock: Callable[[], float],
630
698
  ) -> dict[str, Any]:
@@ -636,7 +704,16 @@ def _settled(
636
704
  or str(headers.get(IDEMPOTENT_REPLAY_HEADER.lower(), "")).lower() == "true"
637
705
  )
638
706
  query_id = _record_identifier(record, run_id)
639
- record, read = _poll(selected, run_id, query_id, sleep=sleep, clock=clock)
707
+ checkpoint_content_digest = _checkpoint_binding(record, checkpoint_id)
708
+ record, read = _poll(
709
+ selected,
710
+ run_id,
711
+ query_id,
712
+ checkpoint_id=checkpoint_id,
713
+ checkpoint_content_digest=checkpoint_content_digest,
714
+ sleep=sleep,
715
+ clock=clock,
716
+ )
640
717
  head: dict[str, Any] = {
641
718
  "schema_version": QUERY_SCHEMA,
642
719
  "lane": "hosted",
@@ -656,12 +733,15 @@ def _settled(
656
733
  "state": state,
657
734
  "sql": record.get("sql"),
658
735
  "max_rows": record.get("max_rows"),
736
+ "checkpoint_id": record.get("checkpoint_id"),
737
+ "checkpoint_content_digest": record.get("checkpoint_content_digest"),
659
738
  "deadline_at": record.get("deadline_at"),
660
739
  "note": (
661
740
  f"This command read the answer back {read} times and it is still {state}. The "
662
741
  "query is unaffected: Studio terminalizes it at its own deadline above, and "
663
742
  "running this same command again reads it back rather than executing a second, "
664
- "because the identifier is derived from the statement and the row limit."
743
+ "because the identifier is derived from the statement, row limit, pruning and "
744
+ "checkpoint."
665
745
  ),
666
746
  }
667
747
  payload: dict[str, Any] = {**head, "status": "query_answered", **_answer(record)}
@@ -673,8 +753,8 @@ def _settled(
673
753
  )
674
754
  if replayed:
675
755
  notes.append(
676
- "This statement and row limit had already been asked of this run, so Studio answered "
677
- "with that one query rather than executing a second."
756
+ "This statement, row limit, pruning and checkpoint had already been asked of this "
757
+ "run, so Studio answered with that one query rather than executing a second."
678
758
  )
679
759
  if notes:
680
760
  payload["note"] = " ".join(notes)
@@ -763,6 +843,8 @@ def _poll(
763
843
  run_id: str,
764
844
  query_id: str,
765
845
  *,
846
+ checkpoint_id: str | None,
847
+ checkpoint_content_digest: str | None,
766
848
  sleep: Callable[[float], None],
767
849
  clock: Callable[[], float],
768
850
  ) -> tuple[dict[str, Any], int]:
@@ -791,6 +873,7 @@ def _poll(
791
873
  raise ThinLaneError(
792
874
  "THIN_RESPONSE_INVALID", "Studio answered with a query belonging to another run"
793
875
  )
876
+ _checkpoint_binding(record, checkpoint_id, checkpoint_content_digest)
794
877
  if record.get("state") in TERMINAL_QUERY_STATES:
795
878
  break
796
879
  return record, read
@@ -47,6 +47,8 @@ from mostlyright.data_harness.thin.v4 import (
47
47
  CREATE_RUN_PATH,
48
48
  GET_RUN_PATH,
49
49
  LIST_RUNS_PATH,
50
+ RUN_CHECKPOINT_PATH,
51
+ RUN_CHECKPOINTS_PATH,
50
52
  RUN_INSPECTION_PATH,
51
53
  bare_digest,
52
54
  identifier,
@@ -277,6 +279,45 @@ class StudioV4RunClient(StudioV4NarrativeClient):
277
279
  raise ThinLaneError("THIN_RESPONSE_INVALID", "Studio returned another run's inspection")
278
280
  return answer
279
281
 
282
+ def checkpoints(self, run_id: str) -> dict[str, Any]:
283
+ """Read the bounded discoverable checkpoint list for one run."""
284
+
285
+ answer = self._call("GET", RUN_CHECKPOINTS_PATH.format(run_id=run_id), expected=(200,))
286
+ if answer.get("schema_version") != "mostlyright-run-checkpoint.v1":
287
+ raise ThinLaneError(
288
+ "THIN_RESPONSE_INVALID", "Studio returned an invalid run checkpoint list"
289
+ )
290
+ rows = answer.get("checkpoints")
291
+ if answer.get("run_id") != run_id or not isinstance(rows, list):
292
+ raise ThinLaneError(
293
+ "THIN_RESPONSE_INVALID", "Studio returned another run's checkpoint list"
294
+ )
295
+ if any(
296
+ not isinstance(row, Mapping)
297
+ or row.get("schema_version") != "mostlyright-run-checkpoint.v1"
298
+ or row.get("run_id") != run_id
299
+ or not isinstance(row.get("checkpoint_id"), str)
300
+ for row in rows
301
+ ):
302
+ raise ThinLaneError(
303
+ "THIN_RESPONSE_INVALID", "Studio returned an invalid checkpoint in the run list"
304
+ )
305
+ return answer
306
+
307
+ def checkpoint(self, run_id: str, checkpoint_id: str) -> dict[str, Any]:
308
+ """Read one exact immutable checkpoint without resolving its artifact bytes."""
309
+
310
+ answer = self._call(
311
+ "GET",
312
+ RUN_CHECKPOINT_PATH.format(run_id=run_id, checkpoint_id=checkpoint_id),
313
+ expected=(200,),
314
+ )
315
+ if answer.get("schema_version") != "mostlyright-run-checkpoint.v1":
316
+ raise ThinLaneError("THIN_RESPONSE_INVALID", "Studio returned an invalid checkpoint")
317
+ if answer.get("run_id") != run_id or answer.get("checkpoint_id") != checkpoint_id:
318
+ raise ThinLaneError("THIN_RESPONSE_INVALID", "Studio returned another checkpoint")
319
+ return answer
320
+
280
321
  def runs(
281
322
  self,
282
323
  *,
@@ -495,6 +536,17 @@ def declare_status_arguments(parser: argparse.ArgumentParser) -> None:
495
536
  action="store_true",
496
537
  help="include the run's declared shape and observed checkpoint",
497
538
  )
539
+ selected = parser.add_mutually_exclusive_group()
540
+ selected.add_argument(
541
+ "--checkpoints",
542
+ action="store_true",
543
+ help="include the bounded list of immutable workspace build checkpoints",
544
+ )
545
+ selected.add_argument(
546
+ "--checkpoint",
547
+ metavar="CHECKPOINT_ID",
548
+ help="include one exact immutable build checkpoint",
549
+ )
498
550
  parser.add_argument("--receipts", action="store_true", help=_NO_EFFECT_RECEIPTS)
499
551
 
500
552
 
@@ -1527,6 +1579,12 @@ def status(args: argparse.Namespace, *, client: StudioV4RunClient | None = None)
1527
1579
  payload["flags_without_effect"] = {"--receipts": _NO_EFFECT_RECEIPTS}
1528
1580
  if getattr(args, "inspection", False):
1529
1581
  payload["inspection"] = selected.inspection(run_id)
1582
+ if getattr(args, "checkpoints", False):
1583
+ payload["checkpoints"] = selected.checkpoints(run_id)
1584
+ checkpoint = getattr(args, "checkpoint", None)
1585
+ if checkpoint is not None:
1586
+ checkpoint_id = identifier(str(checkpoint), "checkpoint identifier")
1587
+ payload["checkpoint"] = selected.checkpoint(run_id, checkpoint_id)
1530
1588
  if state == "awaiting_confirmation":
1531
1589
  held = {member: run[member] for member in _PROJECTION_MEMBERS[1:] if member in run}
1532
1590
  if held: