mostlyright-data 0.31.48__tar.gz → 0.31.50__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 (132) hide show
  1. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/PKG-INFO +1 -1
  2. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/SKILL.md +1 -0
  3. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/4-decide-say-what-you-chose-what-you-refused-and-ask-one-question.md +10 -0
  4. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/5-draft-one-recipe-document-one-call.md +9 -0
  5. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md +40 -8
  6. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/agent-protocol.md +4 -2
  7. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/commands.md +1 -1
  8. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/patterns.md +9 -1
  9. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/readers.md +14 -2
  10. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/transport.py +52 -12
  11. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_query.py +49 -7
  12. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/remediation.py +15 -1
  13. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/.gitignore +0 -0
  14. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/README.md +0 -0
  15. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/pyproject.toml +0 -0
  16. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/scripts/hatch_build.py +0 -0
  17. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/agents/openai.yaml +0 -0
  18. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/1-open-the-page-and-the-link-to-it-in-the-first-message.md +0 -0
  19. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/2-brief-two-to-four-questions-each-with-a-recommended-answer.md +0 -0
  20. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/3-probe-read-a-source-before-committing-to-it.md +0 -0
  21. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/7-interrogate-ask-the-run-what-it-actually-delivered.md +0 -0
  22. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/8-fix-revise-the-document-and-register-it-again.md +0 -0
  23. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/9-present-only-what-survived-inspection-with-caveats.md +0 -0
  24. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/autonomous-delivery.md +0 -0
  25. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/before-the-first-tool-call.md +0 -0
  26. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/boundaries.md +0 -0
  27. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/cloud-authentication-preflight.md +0 -0
  28. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/enriching-with-small-models.md +0 -0
  29. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/live-run.md +0 -0
  30. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/making-a-table-incremental.md +0 -0
  31. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/narrating-the-run.md +0 -0
  32. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/not-hosted-yet.md +0 -0
  33. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/one-install.md +0 -0
  34. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/predicting-with-tabular-models.md +0 -0
  35. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/prediction-labels.md +0 -0
  36. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/preparing-table-search.md +0 -0
  37. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/promote.md +0 -0
  38. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/receipts.md +0 -0
  39. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/recipe-test.md +0 -0
  40. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/recording-a-stream-venue.md +0 -0
  41. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/recovering-an-import-failure.md +0 -0
  42. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/reference-pages.md +0 -0
  43. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/required-protocol.md +0 -0
  44. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/satellite-signals.md +0 -0
  45. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/source-credentials.md +0 -0
  46. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/sources.md +0 -0
  47. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/the-one-thing-to-say-about-the-skill-itself.md +0 -0
  48. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/transforms.md +0 -0
  49. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/user-communication-contract.md +0 -0
  50. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/references/writing-a-decision-record.md +0 -0
  51. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/skills/mr-data-build/scripts/write_research_notebook.py +0 -0
  52. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/__init__.py +0 -0
  53. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/agent_protocol.py +0 -0
  54. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/canonical.py +0 -0
  55. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/key_seam.py +0 -0
  56. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/page_coverage.py +0 -0
  57. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/part_check_evidence.py +0 -0
  58. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/session_probes.py +0 -0
  59. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/skill_assets.py +0 -0
  60. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/table_manifest.py +0 -0
  61. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/__init__.py +0 -0
  62. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/activity.py +0 -0
  63. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/backoff.py +0 -0
  64. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/categories.py +0 -0
  65. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/dataset-categories-v1.json +0 -0
  66. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/dataset_layout.py +0 -0
  67. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/delivery.py +0 -0
  68. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/description_shape.py +0 -0
  69. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/download.py +0 -0
  70. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/enrichment.py +0 -0
  71. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/fast_features.py +0 -0
  72. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/matching_benchmark.py +0 -0
  73. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/probe.py +0 -0
  74. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/progress_rate.py +0 -0
  75. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/progress_vocabulary.py +0 -0
  76. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/recipe.py +0 -0
  77. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/recipe_brief.py +0 -0
  78. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/recipe_explain.py +0 -0
  79. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/recipe_forecast.py +0 -0
  80. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/recipe_lint.py +0 -0
  81. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/recipe_test.py +0 -0
  82. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/refresh_rehearsal.py +0 -0
  83. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/release_check.py +0 -0
  84. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/research.py +0 -0
  85. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/router.py +0 -0
  86. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/run_diagnose.py +0 -0
  87. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/run_prefix.py +0 -0
  88. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/runs.py +0 -0
  89. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/session.py +0 -0
  90. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/stream.py +0 -0
  91. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/stream_venue.py +0 -0
  92. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/studio_capabilities.py +0 -0
  93. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/support.py +0 -0
  94. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/table_search_contract.json +0 -0
  95. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/table_view.py +0 -0
  96. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/user_agent.py +0 -0
  97. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4.py +0 -0
  98. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_artifacts.py +0 -0
  99. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_catalog.py +0 -0
  100. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_connected.py +0 -0
  101. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_connections.py +0 -0
  102. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_dataset_covers.py +0 -0
  103. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_datasets.py +0 -0
  104. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_handoff.py +0 -0
  105. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_matching.py +0 -0
  106. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_narrative.py +0 -0
  107. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_public.py +0 -0
  108. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_public_pull.py +0 -0
  109. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_reader.py +0 -0
  110. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_runs.py +0 -0
  111. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_search.py +0 -0
  112. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_search_contract.py +0 -0
  113. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_secrets.py +0 -0
  114. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_stream.py +0 -0
  115. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/v4_tables.py +0 -0
  116. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/thin/vocabulary.py +0 -0
  117. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/__init__.py +0 -0
  118. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/attendance.py +0 -0
  119. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/clarification.py +0 -0
  120. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/cloud_auth.py +0 -0
  121. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/commands/__init__.py +0 -0
  122. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/commands/auth.py +0 -0
  123. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/commands/clarify.py +0 -0
  124. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/commands/login.py +0 -0
  125. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/commands/whoami.py +0 -0
  126. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/credential_native.py +0 -0
  127. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/credential_store.py +0 -0
  128. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/credentials.py +0 -0
  129. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/login.py +0 -0
  130. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/path_kind.py +0 -0
  131. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/src/mostlyright/data_harness/ux/plain_file.py +0 -0
  132. {mostlyright_data-0.31.48 → mostlyright_data-0.31.50}/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.31.48
3
+ Version: 0.31.50
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/
@@ -71,6 +71,7 @@ the source shape that fits.
71
71
  | --- | --- | --- | --- |
72
72
  | One public file that never changes | `public.https` with a Reader pin | `closed: true` | [one file](references/patterns.md#one-public-file-that-never-changes) |
73
73
  | One large public Parquet file whose publisher answers byte ranges | a `parquet.tabular@1.1.0` pin | `columns` | [ranged Parquet](references/patterns.md#one-large-public-parquet-file-read-by-range) |
74
+ | Many public files that each fit, together past 10 million rows | one `public.https` source per file, unioned | per-source `max_rows`, a `parquet.tabular` pin, a `row_expectation` past 10,000,000 | [many files](references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md#many-files-that-each-fit) |
74
75
  | Keyed JSON API paged by page number, whose first page states the page count | `authenticated.https.api_key@2.1.0` with the counted `pagination.parallel` | `total_pages_pointer`, `max_page_bytes`, the gap | [keyed API](references/patterns.md#keyed-json-api-with-pages-fetched-together) |
75
76
  | API that takes a date range | `window.request` | `lookback_seconds` | [date range](references/patterns.md#api-that-takes-a-date-range) |
76
77
  | Many pages behind one index | `public.https.collection@2.0.0` | the gap | [collection](references/patterns.md#many-pages-behind-one-index) |
@@ -31,6 +31,16 @@ consequences before changing the intended dataset. Carry the answers into the re
31
31
  table and column descriptions, source selection, transform and checks, and record assumptions
32
32
  separately from decisions the user made.
33
33
 
34
+ **A corpus of files that each fit is not a refusal.** When the publisher already ships many files
35
+ and each file is under a source's own ceiling, the decision is one source per file, with column
36
+ projection, a `parquet.tabular` pin in `reader.decode_options`, a per-source `max_rows`, and a
37
+ table `row_expectation` past 10,000,000 when the files together pass it. Do not refuse that
38
+ dataset, and do not ask the person to pick a country, a region or a year instead of those files.
39
+ A single file that itself passes 10,000,000 rows or 4 GiB decoded is the limit to name, after you
40
+ have looked for a per-file split the publisher already ships.
41
+ [Build sizing](6-build-one-run-sized-to-acquire-every-measured-source-whole.md#many-files-that-each-fit)
42
+ says which ceiling applies.
43
+
34
44
  **Blocked sources: always say what unlocks it and how to enrol the credential.** A source you could
35
45
  not reach because it needs an API key, an account or an approval is not a dead end and must never
36
46
  be reported as one. Name the unblock step in the block's `reason` and in the chat message: who
@@ -444,6 +444,15 @@ run, because the dialect is validated at the acquire stage rather than at regist
444
444
  | `continuity` | exactly one | `max_gap_seconds` |
445
445
  | `row_expectation` | none; naming one is refused | at least one of `min_rows`, `max_rows` |
446
446
 
447
+ `min_rows` and `max_rows` are integers. A `row_expectation` with either one past 10,000,000 is how
448
+ a table of that size is admitted: the Python engine seals at most 10,000,000 rows, and that check
449
+ moves the build to the native engine. Each source still states its own `limits.max_rows`. Omitting
450
+ it leaves the source at 10,000,000 rows even on the native engine. A publisher's many files, each
451
+ under that source ceiling, are many sources unioned in the first transform, not one check used as
452
+ a reason to shrink the place.
453
+ [Many files that each fit](6-build-one-run-sized-to-acquire-every-measured-source-whole.md#many-files-that-each-fit)
454
+ is the shape.
455
+
447
456
  `DECLARED_CHECK_INVALID: check X reads exactly one column and names 3` means write one check per
448
457
  column. Bounds are strings, because no fractional number may appear anywhere in the document:
449
458
  `"min_value": "-50"`.
@@ -176,8 +176,8 @@ most 1 GiB, because the whole decoded relation is held in memory while it is cla
176
176
  A staged source is decoded to a file and is not narrowed to that 1 GiB. On either route the decoded
177
177
  table is also held to the source's own `limits.max_source_bytes`, so when a source inflates, as a
178
178
  compressed archive does, declare that at the decoded size and not at the size of the download. A
179
- wide source is still best narrowed by projection, which is what shrinks the decoded relation; a
180
- long source can still be split.
179
+ wide source is narrowed by projecting fewer columns in `reader.decode_options`. A long corpus
180
+ is not narrowed by dropping a place. The ceilings below say which of those is a real limit.
181
181
 
182
182
  `limits.max_source_bytes` states where fetching STOPS rather than how big the source is, so the
183
183
  preflight does not refuse a large one. Registration puts one sentence on the receipt under
@@ -194,13 +194,45 @@ After registering, run `mr-data recipe forecast RECIPE_ID --digest DIGEST` and c
194
194
  schedule, and under the projection every scheduled rebuild is held
195
195
  ([rebuild](making-a-table-incremental.md#rebuild-the-fifth-continuation)).
196
196
 
197
- **Which remedy applies depends on which way the source is too big, and lowering the ceiling is
198
- never it** — that truncates the preview or refuses the full build rather than fetching less. A WIDE
199
- source is narrowed by projecting fewer columns in the reader's own settings; splitting it would not
200
- help. A LONG source is split across several sources — one per month, per region, per whatever the
201
- publisher paginates on — and unioned in a first transform step; a recipe names up to 256.
197
+ ### Many files that each fit
198
+
199
+ **A table past 10,000,000 rows fits when the recipe says so.** The Python engine seals at most
200
+ 10,000,000 rows. A `row_expectation` whose `min_rows` or `max_rows` is past 10,000,000 admits the
201
+ table on the native engine. That engine seals one table version as at most 4,096 parts of
202
+ 4,194,304 rows and 256 MiB each, about 17 billion rows and 1 TiB. A run of that recipe left on
203
+ the Python engine is refused `409 KEEL_ENGINE_REQUIRED` before it starts, because the recipe
204
+ declares more rows than the Python engine builds. Omitting the check leaves the seal on the
205
+ Python engine's 10,000,000-row ceiling. Neither is a reason to offer a smaller place when each
206
+ file already fits.
207
+
208
+ **Each source keeps its own ceiling, on either engine.** A whole file stays at 10,000,000 rows and
209
+ 4 GiB staged. A ranged Parquet fetch stays at 1 GiB of selected column chunks and 2,048 ranges. A
210
+ source that is not staged decodes at most 1 GiB. A recipe names at most 256 sources. A source that
211
+ omits `limits.max_rows` stays at 10,000,000 rows even on the native engine, so state `max_rows`
212
+ on every source of a large table, at that file's measured rows with headroom, and not above what
213
+ that file's route can read. Lowering `max_rows` or `max_source_bytes` to make a corpus fit
214
+ truncates the preview or refuses the full build. It does not fetch less.
215
+
216
+ **Many files that each fit are one source per file.** Project the columns the table needs, pin
217
+ `parquet.tabular`, and put the projection in `reader.decode_options`. `mr-data reader normalize`
218
+ reads that object from `--options-file`. The parameter name is `reader.decode_options`. A
219
+ parameter named `options` is refused `422` as "not a reserved Reader pin parameter". Set each
220
+ source's `max_rows`. Union the sources in the first transform step. When the table will pass
221
+ 10,000,000 rows, declare the `row_expectation` above. Sixteen GeoParquet files of about 5.1
222
+ million rows and a projected 264-376 MiB each, such as an Overture Places release, are sixteen
223
+ sources. Build all of them. Do not tell the person the dataset does not fit and ask them to pick
224
+ a country.
225
+
226
+ **One file past its own ceiling is a real limit. Name the ceiling.** A single file over
227
+ 10,000,000 rows, or over 4 GiB decoded, does not fit. One GHCN `by_year` CSV.gz is that file: the
228
+ recipe cannot split bytes the publisher put in one object. Before you ask the person to drop a
229
+ year or a place, use a per-file split the publisher already ships — one file per station, per
230
+ month, or per part, when those files themselves fit — and make each a source. Offer a smaller
231
+ scope only when no such split exists.
232
+
233
+ A wide file is still narrowed by projection in `reader.decode_options`, not by splitting it.
202
234
  [The recipe document](https://mostlyright.md/docs/reference/recipe/) carries the measured numbers
203
- behind the ceiling.
235
+ behind a source ceiling.
204
236
 
205
237
  A corpus of many pages behind one index is a COLLECTION rather than many sources: see
206
238
  [Authoring a collection source](sources.md#authoring-a-collection-source).
@@ -41,8 +41,10 @@ input. `unknown` never means “revise the recipe”.
41
41
 
42
42
  ## Reader options
43
43
 
44
- `reader.decode_options` is canonical JSON text in the recipe's connector parameters. The options
45
- inside that text form an object. The certified Reader family and version in the server remain authoritative for allowed
44
+ `reader.decode_options` is canonical JSON text in the recipe's connector parameters. The wire
45
+ field is `decode_options`. A connector parameter named `options` is refused `422` as "not a
46
+ reserved Reader pin parameter". The CLI flag that supplies the object is `--options-file`. The
47
+ certified Reader family and version in the server remain authoritative for allowed
46
48
  keys, defaults and semantics. The CLI does not validate or invent family-specific options.
47
49
 
48
50
  ## Bounded source inspection
@@ -17,7 +17,7 @@ run in full.
17
17
  | `mr-data clarify` | Check whether clarification is allowed. Use `--attended` for an active user chat and `--unattended` for a scheduled invocation; an explicit operator veto such as `MOSTLYRIGHT_ATTENDED=0` still wins. A non-TTY subprocess does not prove the user is absent. The command does not ask the person in chat or wait for a reply; the agent must do that. It exits non-zero when nobody can answer or the recipe is already registered. |
18
18
  | `mr-data probe` | `probe SOURCE_ID QUESTION_ID --dataset DATASET_ID [--kind source_inspect\|sample_rows\|profile_columns\|evaluate_expression]` asks one already-registered source one question and prints the answer. **It rides the frozen `/v3/sessions` routes, which a deployment may have switched off, so do not plan a source inspection around it.** Both positionals are identifiers. `QUESTION_ID` is a question identifier, which no v4 registration receipt returns. The v4 way to look at a source before registering it is `mr-data source inspect`, in the next row. The other way to read one is a bounded run of a scratch table, never of the real table, as [the probe rule](3-probe-read-a-source-before-committing-to-it.md#the-probe-rule-test-on-a-scratch-table-never-on-the-real-table) says. |
19
19
  | `mr-data source` | `source inspect` takes a bounded look at one source, and it is the v4 path where `probe` is not. [Stage 3](3-probe-read-a-source-before-committing-to-it.md) says when to use it. It starts one of three ways, and each prints the `session_id`, `probe_id` and `source_id`, plus the `dataset_id` and `question_id` when it has them. For a new public HTTPS CSV that needs no key, give `--dataset-id`, `--question`, `--source-name`, `--source-url`, `--claimed-basis` and `--claim-evidence-digest`: it prepares the source and opens a session. For a source already prepared, give `--dataset-id`, `--question-id` and `--source-id`, which opens a session. In a session you already hold, give `--session-id` with `--source-id`. `--context-source-id` adds a source to a session it opens. `--session-id` with `--probe-id` reads the answer back; `--probe-id` alone is refused. A look is bounded to 65,536 bytes, 1,000 rows and 300 seconds. A larger file can fail `BYTE_LIMIT` after a wait, so read it by a bounded run of a scratch table. `queued` and `truncated` are not complete answers, and `capability_unavailable` means this deployment cannot inspect, so read the source by a bounded run of a scratch table instead, as [the probe rule](3-probe-read-a-source-before-committing-to-it.md#the-probe-rule-test-on-a-scratch-table-never-on-the-real-table) says. What it finds is exploratory evidence, not a run and not a receipt. |
20
- | `mr-data reader` | `reader normalize --family-id ID --family-version VERSION --options-file FILE [--workspace-id ID]` asks the server's Reader service to apply one certified family's own defaults and option rules to a JSON object of options, at most 64 KiB, and prints the normalized `decode_options`, `decode_options_json` and `options_digest`. The second is the text a recipe carries as `reader.decode_options`, and the third is the `options_digest` a Generic API's `generic_api.response.reader` states for exactly those options. A connector pin takes no `reader.options_digest` parameter ([Readers](readers.md)). It changes nothing, and this client does not validate or invent a family's options: the server decides. Run it for every Reader pin before you register, so a wrong option is refused here and not inside a run. |
20
+ | `mr-data reader` | `reader normalize --family-id ID --family-version VERSION --options-file FILE [--workspace-id ID]` asks the server's Reader service to apply one certified family's own defaults and option rules to a JSON object of options, at most 64 KiB, and prints the normalized `decode_options`, `decode_options_json` and `options_digest`. The second is the text a recipe carries as `reader.decode_options`, and the third is the `options_digest` a Generic API's `generic_api.response.reader` states for exactly those options. The wire field is `decode_options`. A connector parameter named `options` is refused `422` as "not a reserved Reader pin parameter", and a connector pin takes no `reader.options_digest` parameter ([Readers](readers.md)). It changes nothing, and this client does not validate or invent a family's options: the server decides. Run it for every Reader pin before you register, so a wrong option is refused here and not inside a run. |
21
21
  | `mr-data catalog` | `catalog search "QUESTION"` asks the sealed public-source catalogue which of its entries might answer a question and ranks them best first. Every ranked entry comes back with the disposition its own facts earned — `admitted`, `human_escalation_required` or `refused` — because an entry the catalogue could not vouch for is still a finding. `--format csv` states the one data format the question requires — one token per question, never repeated — and it is not a filter: an entry that does not declare that format still comes back ranked, with disposition `refused` and `filters_match` false, so nothing is held back; `--limit N` ranks at most N, up to 25. It fetches nothing and registers nothing. The catalogue holds one provider (Data.gov) and only part of it, so it is never exhaustive and an empty answer is not evidence that no such source exists. When the answer is `catalog_unavailable`, this deployment has no catalogue to search: record the lane and carry on. |
22
22
  | `mr-data public` | Read Mostly Right's public dataset catalogue. `public search "QUERY"` ranks published datasets (`--topic`, `--limit` and `--cursor` narrow and page it), `show SLUG` reads one overview, `tables SLUG` lists its table identifiers, `schema TABLE_ID` reads one table's schema, `sample TABLE_ID` prints its published preview rows, `lookup "QUERY"` is the connector search shape and `fetch SLUG` returns the dataset's Markdown document. Those seven need no login. For app integration or polling, run `mr-data public api-guide TABLE_ID` for the table’s query and conditional snapshot requests. A public guide needs no login. For a private workspace table set `MOSTLYRIGHT_USE_KEY` in the environment. A `query` body with `search.engine=resident` uses MCP and the workspace of `MOSTLYRIGHT_USE_KEY`. For ordinary query bodies, `query TABLE_ID`, with `--body` or `--body-file`, and `download-url TABLE_ID` do need `mr-data login`: they ask Cloud, with the device key, to run one query over a public table and to say how it can be downloaded. Preview rows are not a query, and those commands pass no table bytes. `pull SLUG` writes the dataset into `DIR/SLUG/` (`--dir`, default `./datasets`; `--table TABLE_ID` repeats to pick tables): `README.md`, `dataset.json`, and per table `schema.json` and `sample.json`, all read-only. Only with `--data` does it add each table's `data.parquet`, and only where the publisher enabled download and an `mr_use_` key is in the `MOSTLYRIGHT_USE_KEY` environment variable; never pass the key as an argument. `--data` connects the dataset to the key's workspace and counts each download against its allowance, so leave it off unless the bytes are needed. A rerun asks Cloud whether a file it already verified is still current and keeps it when Cloud says so, and a failed table is recorded in `dataset.json` without stopping the others. |
23
23
  | `mr-data connected` | `connected list` shows the public datasets connected to this workspace and `connected add SLUG` connects one by its slug. It needs `mr-data login`: both ask Cloud, with the device key, over the routes MCP's `list_connected_datasets` and `connect_dataset` use. |
@@ -134,7 +134,15 @@ explicit resync. Use it only for a file that will not change, such as a dated re
134
134
  whole file. Its `columns` are `{path, as}` objects. `limits.max_requests` is 3 plus one per range,
135
135
  here 3 plus the 2,048 ranges a read may take. The publisher must answer a range request with
136
136
  `206` and an `ETag` or `Last-Modified`, or the run fails. A source that pins it states no window,
137
- and the recipe states no `execution_policy`. [Readers](readers.md) has every limit.
137
+ and the recipe states no `execution_policy`. The pin parameter is `reader.decode_options`; the
138
+ command that fills it reads `--options-file`. A parameter named `options` is refused `422`.
139
+ `limits.max_rows` here is this one ranged file, whose selected chunks stay inside 1 GiB. A whole
140
+ file still stops at 10,000,000 rows and 4 GiB staged. A single file over 10,000,000 rows or 4 GiB
141
+ decoded still does not fit. A release that is already many files, each under its own route, is
142
+ one source per file with its own `max_rows`, plus a table `row_expectation` past 10,000,000 when
143
+ the files together pass it. It is not a smaller country.
144
+ [Many files that each fit](6-build-one-run-sized-to-acquire-every-measured-source-whole.md#many-files-that-each-fit)
145
+ is the rule. [Readers](readers.md) has every limit.
138
146
 
139
147
  ```json
140
148
  {
@@ -31,8 +31,12 @@ field and finding none does not mean v4 cannot pin one.
31
31
  }
32
32
  ```
33
33
 
34
- A parameter under `reader.` that is not one of those three is refused rather than ignored. All three
35
- or none: there is no other place a Reader is named. Read the pin grammar and the closed registry of
34
+ A parameter under `reader.` that is not one of those three is refused rather than ignored. The
35
+ name `options` is not one of them: a connector parameter `options`, or `reader.options`, is a
36
+ `422` whose message is "not a reserved Reader pin parameter". The wire field is `decode_options`,
37
+ on this pin and on `mr-data reader normalize`. The command reads the object from `--options-file`
38
+ and returns it as `decode_options` and `decode_options_json`. All three or none: there is no other
39
+ place a Reader is named. Read the pin grammar and the closed registry of
36
40
  certified coordinates at [Readers](https://mostlyright.md/docs/reference/readers/).
37
41
 
38
42
  **No command tries a Reader against a URL.** `mr-data peek` reads the preview one hosted run sealed.
@@ -170,6 +174,14 @@ needs. Check every limit before you pin it.
170
174
  - A recipe that states `execution_policy` cannot use it. The run is refused.
171
175
  - A source that pins it may not declare a request window. Pin `1.0.0` there.
172
176
  - Its `columns` are objects of `path` and `as`, not the bare names `1.0.0` takes.
177
+ - The pin that carries those columns is `reader.decode_options`. A parameter named `options` is
178
+ refused `422` as "not a reserved Reader pin parameter". The file `--options-file` reads is the
179
+ object; it is not a field named `options`.
180
+ - One ranged file stays inside 1 GiB and 2 048 ranges. A release of many such files, each also
181
+ under 10,000,000 rows, is one source per file. The table's `row_expectation` is what admits the
182
+ combined rows.
183
+ [Many files that each fit](6-build-one-run-sized-to-acquire-every-measured-source-whole.md#many-files-that-each-fit)
184
+ is the rule. A whole file over 10,000,000 rows or 4 GiB decoded is still one file too big.
173
185
 
174
186
  `mr-data reader normalize --family-id parquet.tabular --family-version 1.1.0` checks the options.
175
187
  `mr-data recipe explain` names a `1.0.0` pin that could move, under `fast_features`.
@@ -35,6 +35,12 @@ from mostlyright.data_harness.thin.user_agent import with_user_agent
35
35
  #: passes its own, much larger, timeout.
36
36
  REQUEST_TIMEOUT_SECONDS = 30.0
37
37
 
38
+ #: Drop a pooled socket that has been idle longer than this, instead of reusing it. The sandbox
39
+ #: forwarder is a Node server whose default ``keepAliveTimeout`` is five seconds; a request written
40
+ #: on a socket the server has already closed fails before any response byte. Four seconds leaves a
41
+ #: margin between this check and that close.
42
+ POOLED_CONNECTION_IDLE_SECONDS = 4.0
43
+
38
44
  #: A JSON answer from Cloud or Studio that exceeds this is refused unread. Every response this
39
45
  #: lane parses is a small object; a signed download session is the largest of them.
40
46
  MAX_JSON_RESPONSE_BYTES = 1024 * 1024
@@ -361,7 +367,12 @@ class ReusableHttpsTransport(UrlLibTransport):
361
367
  urllib deliberately sends Connection: close. A query client reuses its
362
368
  own connection instead, never a global credential-bearing pool. Changing
363
369
  origin closes the old socket. Responses are bounded and fully framed;
364
- any failure discards the socket and is raised without replaying a POST.
370
+ a failure discards the socket. A POST is replayed only when
371
+ ``idempotent_post`` is set. Query submit sets it: Studio derives the query
372
+ id from the canonical command, so a second identical POST is the same query.
373
+ A reused connection that then fails before any response byte is sent again
374
+ once, on a new connection. A pooled socket idle longer than
375
+ :data:`POOLED_CONNECTION_IDLE_SECONDS` is closed instead of reused.
365
376
  Only the host-only root GAESA routing cookie is retained in memory, bound
366
377
  to this client's exact origin and authorization context, never login cookies.
367
378
  """
@@ -371,12 +382,15 @@ class ReusableHttpsTransport(UrlLibTransport):
371
382
  *,
372
383
  timeout: float | Callable[[], float] = REQUEST_TIMEOUT_SECONDS,
373
384
  context: ssl.SSLContext | None = None,
385
+ idempotent_post: bool = False,
374
386
  ) -> None:
375
387
  self._timeout = timeout if callable(timeout) else float(timeout)
376
388
  self._context = context if context is not None else ssl.create_default_context()
389
+ self._idempotent_post = bool(idempotent_post)
377
390
  self._lock = threading.Lock()
378
391
  self._connection: http.client.HTTPConnection | None = None
379
392
  self._connection_origin: tuple[str, str, int] | None = None
393
+ self._connection_idle_at: float | None = None
380
394
  self._routing = CookieJar(policy=_RoutingCookiePolicy())
381
395
  self._routing_context: tuple[tuple[str, str, int], bytes] | None = None
382
396
  self._stream_lock = threading.Lock()
@@ -387,6 +401,7 @@ class ReusableHttpsTransport(UrlLibTransport):
387
401
  def _discard(self) -> None:
388
402
  connection, self._connection = self._connection, None
389
403
  self._connection_origin = None
404
+ self._connection_idle_at = None
390
405
  if connection is not None:
391
406
  connection.close()
392
407
 
@@ -597,10 +612,23 @@ class ReusableHttpsTransport(UrlLibTransport):
597
612
  if parts.query:
598
613
  path += "?" + parts.query
599
614
  outgoing_headers = dict(cookie_request.header_items())
600
- idempotent = method.upper() in {"GET", "HEAD"}
615
+ # GET and HEAD are safe to send again. A POST is safe only when the caller has said
616
+ # this transport's posts are idempotent. Query submit is: the id is a digest of the
617
+ # command. A session open or a metered mint is not, and stays one send.
618
+ idempotent = method.upper() in {"GET", "HEAD"} or (
619
+ self._idempotent_post and method.upper() == "POST"
620
+ )
601
621
  response: http.client.HTTPResponse | None = None
602
622
  for attempt in range(2):
603
623
  reused = self._connection is not None and self._connection.sock is not None
624
+ if (
625
+ reused
626
+ and self._connection_idle_at is not None
627
+ and time.monotonic() - self._connection_idle_at
628
+ > POOLED_CONNECTION_IDLE_SECONDS
629
+ ):
630
+ self._discard()
631
+ reused = False
604
632
  if self._connection is None:
605
633
  self._connection = self._open_connection(origin, remaining())
606
634
  self._connection_origin = origin
@@ -609,20 +637,30 @@ class ReusableHttpsTransport(UrlLibTransport):
609
637
  if connection.sock is not None:
610
638
  connection.sock.settimeout(remaining())
611
639
  try:
640
+ # A reset or a broken pipe here is the write, before any response byte.
641
+ # RemoteDisconnected is a ConnectionResetError, so it is included.
612
642
  connection.request(method, path, body=body, headers=outgoing_headers)
613
- if connection.sock is not None:
614
- connection.sock.settimeout(remaining())
643
+ except (ConnectionResetError, BrokenPipeError):
644
+ self._discard()
645
+ if not (idempotent and reused and attempt == 0):
646
+ raise
647
+ continue
648
+ if connection.sock is not None:
649
+ connection.sock.settimeout(remaining())
650
+ try:
615
651
  response = connection.getresponse()
616
- break
617
- except (
618
- http.client.RemoteDisconnected,
619
- http.client.BadStatusLine,
620
- ConnectionResetError,
621
- BrokenPipeError,
622
- ):
652
+ except http.client.RemoteDisconnected:
653
+ # An empty status line: the server closed before sending a response.
654
+ # A BadStatusLine is bytes that are not a status, and a ConnectionResetError
655
+ # while reading may follow bytes already delivered. Neither is sent again.
623
656
  self._discard()
624
- if not (idempotent and reused) or attempt == 1:
657
+ if not (idempotent and reused and attempt == 0):
625
658
  raise
659
+ continue
660
+ except (ConnectionResetError, BrokenPipeError):
661
+ self._discard()
662
+ raise
663
+ break
626
664
  assert response is not None
627
665
  expected = response.length
628
666
  chunks: list[bytes] = []
@@ -650,6 +688,8 @@ class ReusableHttpsTransport(UrlLibTransport):
650
688
  response.close()
651
689
  if response.will_close or connection.sock is None or status < 200:
652
690
  self._discard()
691
+ else:
692
+ self._connection_idle_at = time.monotonic()
653
693
  return status, raw, response_headers
654
694
  except BaseException:
655
695
  self._discard()
@@ -39,6 +39,7 @@ from __future__ import annotations
39
39
 
40
40
  import argparse
41
41
  import hashlib
42
+ import http.client
42
43
  import os
43
44
  import re
44
45
  import time
@@ -305,6 +306,40 @@ def _cloud_asked_for_a_moment(refusal: ThinLaneError) -> bool:
305
306
  return getattr(refusal, "studio_code", None) is None
306
307
 
307
308
 
309
+ def _cloud_transport_refusal(error: BaseException, *, act: str) -> ThinLaneError:
310
+ """The refusal for one transport failure, named by which kind it was.
311
+
312
+ A timeout waited out its clock. A dropped connection, including one the transport already
313
+ replayed once, closed before a full answer. A refused connection or a name that did not
314
+ resolve never opened. Anything else that still cannot be classified is unreachable too:
315
+ the host was not a party to an exchange.
316
+ """
317
+
318
+ if isinstance(error, TimeoutError):
319
+ return ThinLaneError(
320
+ "THIN_CLOUD_TIMEOUT", f"Cloud did not answer in time the request to {act}"
321
+ )
322
+ # RemoteDisconnected is a ConnectionResetError for an empty status line. A reset, a broken
323
+ # pipe, a status line that is not HTTP, or a body cut short are a connection that closed.
324
+ # A refusal, a DNS failure, and anything else that never exchanged bytes stay unreachable.
325
+ if isinstance(
326
+ error,
327
+ (
328
+ ConnectionResetError,
329
+ BrokenPipeError,
330
+ http.client.BadStatusLine,
331
+ http.client.IncompleteRead,
332
+ ),
333
+ ):
334
+ return ThinLaneError(
335
+ "THIN_CLOUD_CONNECTION_DROPPED",
336
+ f"Cloud dropped the connection on the request to {act}",
337
+ )
338
+ return ThinLaneError(
339
+ "THIN_CLOUD_UNREACHABLE", f"Cloud could not be reached for the request to {act}"
340
+ )
341
+
342
+
308
343
  class CloudRunQueryClient(CloudClient):
309
344
  """Cloud's two metered query routes, behind the device key.
310
345
 
@@ -319,9 +354,12 @@ class CloudRunQueryClient(CloudClient):
319
354
  :data:`QUERY_REQUEST_TIMEOUT_SECONDS` is longer than that, so Cloud's own answer always lands.
320
355
 
321
356
  ⚠ AND THE SAME BOUNDED RETRIES AS THE METERED MINTS, on Cloud's own 429 and 503 only. A
322
- transport failure is ``THIN_CLOUD_UNREACHABLE`` at once. A resubmit after a 503 is safe as well
323
- as bounded: Studio derives the query's identifier from the command, so a submit that was queued
324
- before Cloud failed is answered again as the same query.
357
+ resubmit after a 503 is safe as well as bounded: Studio derives the query's identifier from the
358
+ command, so a submit that was queued before Cloud failed is answered again as the same query.
359
+ That is also why the transport this client constructs may replay one POST when a reused
360
+ connection dies before any response byte. A timeout is ``THIN_CLOUD_TIMEOUT``. A connection
361
+ dropped, including after that one replay, is ``THIN_CLOUD_CONNECTION_DROPPED``. A connection
362
+ that never opened — refused, or a name that did not resolve — stays ``THIN_CLOUD_UNREACHABLE``.
325
363
  """
326
364
 
327
365
  def __init__(
@@ -331,9 +369,15 @@ class CloudRunQueryClient(CloudClient):
331
369
  transport: Transport | None = None,
332
370
  sleep: Callable[[float], None] = time.sleep,
333
371
  ) -> None:
372
+ # Query submit is the only POST this client sends, and it is idempotent: Studio derives
373
+ # the query id from the canonical command. The flag is not the default, because the same
374
+ # transport class also carries posts that must not be sent twice.
334
375
  super().__init__(
335
376
  credentials,
336
- transport=transport or ReusableHttpsTransport(timeout=QUERY_REQUEST_TIMEOUT_SECONDS),
377
+ transport=transport
378
+ or ReusableHttpsTransport(
379
+ timeout=QUERY_REQUEST_TIMEOUT_SECONDS, idempotent_post=True
380
+ ),
337
381
  )
338
382
  self._sleep = sleep
339
383
 
@@ -364,9 +408,7 @@ class CloudRunQueryClient(CloudClient):
364
408
  method, f"{self._origin}{path}", headers, encoded, MAX_JSON_RESPONSE_BYTES
365
409
  )
366
410
  except (OSError, HTTPException) as error:
367
- raise ThinLaneError(
368
- "THIN_CLOUD_UNREACHABLE", f"Cloud did not answer the request to {act}"
369
- ) from error
411
+ raise _cloud_transport_refusal(error, act=act) from error
370
412
  if response_headers is not None:
371
413
  response_headers.clear()
372
414
  response_headers.update(answered)
@@ -11,7 +11,7 @@ neither affordable nor honest:
11
11
  * **Families.** Every code prefix is assigned to a family -- 224 of them, plus 20 compound
12
12
  prefixes, across 40 families. A family is one paragraph: what this class of failure is about,
13
13
  where to look, and what to do. Every prefix has one, so no code can fail to say something useful.
14
- * **Curated codes.** The 130 failures a person actually meets get their own exact sentences, and
14
+ * **Curated codes.** The 132 failures a person actually meets get their own exact sentences, and
15
15
  where one command is the whole answer, the command itself.
16
16
 
17
17
  Those four counts are not a note somebody remembered to update:
@@ -2435,6 +2435,20 @@ CODES: dict[str, Remediation] = {
2435
2435
  "files it already verified.",
2436
2436
  ),
2437
2437
  ),
2438
+ "THIN_CLOUD_TIMEOUT": Remediation(
2439
+ lines=(
2440
+ "Mostly Right Cloud did not answer before the deadline.",
2441
+ "Run the command again. For a bounded query, a repeat is the same question and "
2442
+ "reads that query back rather than starting another.",
2443
+ ),
2444
+ ),
2445
+ "THIN_CLOUD_CONNECTION_DROPPED": Remediation(
2446
+ lines=(
2447
+ "Mostly Right Cloud closed the connection before a full answer arrived.",
2448
+ "Run the command again. For a bounded query, a repeat is the same question and "
2449
+ "reads that query back rather than starting another.",
2450
+ ),
2451
+ ),
2438
2452
  "THIN_RATE_LIMITED": Remediation(
2439
2453
  lines=(
2440
2454
  "Mostly Right Cloud asked this command to slow down. Nothing was changed.",