mostlyright-data 0.30.3__tar.gz → 0.30.4__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.30.3 → mostlyright_data-0.30.4}/PKG-INFO +1 -1
  2. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/SKILL.md +1 -0
  3. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/sources.md +27 -0
  4. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/recipe_lint.py +269 -0
  5. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/table_search_contract.json +1 -1
  6. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4.py +2 -2
  7. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/.gitignore +0 -0
  8. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/README.md +0 -0
  9. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/pyproject.toml +0 -0
  10. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/scripts/hatch_build.py +0 -0
  11. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/agents/openai.yaml +0 -0
  12. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/1-open-the-page-and-the-link-to-it-in-the-first-message.md +0 -0
  13. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/2-brief-two-to-four-questions-each-with-a-recommended-answer.md +0 -0
  14. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/3-probe-read-a-source-before-committing-to-it.md +0 -0
  15. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/4-decide-say-what-you-chose-what-you-refused-and-ask-one-question.md +0 -0
  16. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/5-draft-one-recipe-document-one-call.md +0 -0
  17. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md +0 -0
  18. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/7-interrogate-ask-the-run-what-it-actually-delivered.md +0 -0
  19. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/8-fix-revise-the-document-and-register-it-again.md +0 -0
  20. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/9-present-only-what-survived-inspection-with-caveats.md +0 -0
  21. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/agent-protocol.md +0 -0
  22. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/autonomous-delivery.md +0 -0
  23. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/before-the-first-tool-call.md +0 -0
  24. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/boundaries.md +0 -0
  25. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/cloud-authentication-preflight.md +0 -0
  26. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/commands.md +0 -0
  27. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/cross-repository-protocol-reference.md +0 -0
  28. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/installation-parity.md +0 -0
  29. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/live-run.md +0 -0
  30. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/making-a-table-incremental.md +0 -0
  31. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/narrating-the-run.md +0 -0
  32. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/not-hosted-yet.md +0 -0
  33. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/one-install.md +0 -0
  34. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/patterns.md +0 -0
  35. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/prediction-labels.md +0 -0
  36. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/preparing-table-search.md +0 -0
  37. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/promote.md +0 -0
  38. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/readers.md +0 -0
  39. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/receipts.md +0 -0
  40. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/recipe-test.md +0 -0
  41. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/recording-a-stream-venue.md +0 -0
  42. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/recovering-an-import-failure.md +0 -0
  43. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/reference-pages.md +0 -0
  44. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/required-protocol.md +0 -0
  45. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/source-credentials.md +0 -0
  46. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/the-one-thing-to-say-about-the-skill-itself.md +0 -0
  47. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/transforms.md +0 -0
  48. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/user-communication-contract.md +0 -0
  49. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/references/writing-a-decision-record.md +0 -0
  50. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/skills/mr-data-build/scripts/write_research_notebook.py +0 -0
  51. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/__init__.py +0 -0
  52. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/agent_protocol.py +0 -0
  53. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/canonical.py +0 -0
  54. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/formats.py +0 -0
  55. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/hosted_crawler_protocol.py +0 -0
  56. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/key_seam.py +0 -0
  57. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/page_coverage.py +0 -0
  58. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/part_check_evidence.py +0 -0
  59. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/session_probes.py +0 -0
  60. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/skill_assets.py +0 -0
  61. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/table_manifest.py +0 -0
  62. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/__init__.py +0 -0
  63. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/acquire.py +0 -0
  64. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/acquire_cancel.py +0 -0
  65. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/activity.py +0 -0
  66. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/approvals.py +0 -0
  67. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/backoff.py +0 -0
  68. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/categories.py +0 -0
  69. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/commands.py +0 -0
  70. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/dataset-categories-v1.json +0 -0
  71. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/download.py +0 -0
  72. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/fast_features.py +0 -0
  73. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/narrative.py +0 -0
  74. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/parity.py +0 -0
  75. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/probe.py +0 -0
  76. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/progress_rate.py +0 -0
  77. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/progress_vocabulary.py +0 -0
  78. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/propose.py +0 -0
  79. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/recipe.py +0 -0
  80. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/recipe_brief.py +0 -0
  81. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/recipe_explain.py +0 -0
  82. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/recipe_forecast.py +0 -0
  83. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/recipe_test.py +0 -0
  84. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/refresh_rehearsal.py +0 -0
  85. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/release_check.py +0 -0
  86. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/research.py +0 -0
  87. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/router.py +0 -0
  88. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/run_diagnose.py +0 -0
  89. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/run_prefix.py +0 -0
  90. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/runs.py +0 -0
  91. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/session.py +0 -0
  92. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/stream.py +0 -0
  93. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/stream_venue.py +0 -0
  94. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/studio_capabilities.py +0 -0
  95. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/support.py +0 -0
  96. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/transport.py +0 -0
  97. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/user_agent.py +0 -0
  98. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_artifacts.py +0 -0
  99. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_catalog.py +0 -0
  100. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_connected.py +0 -0
  101. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_connections.py +0 -0
  102. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_dataset_covers.py +0 -0
  103. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_datasets.py +0 -0
  104. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_handoff.py +0 -0
  105. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_narrative.py +0 -0
  106. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_public.py +0 -0
  107. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_query.py +0 -0
  108. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_reader.py +0 -0
  109. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_runs.py +0 -0
  110. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_search.py +0 -0
  111. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_search_contract.py +0 -0
  112. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_secrets.py +0 -0
  113. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_stream.py +0 -0
  114. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/v4_tables.py +0 -0
  115. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/thin/vocabulary.py +0 -0
  116. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/__init__.py +0 -0
  117. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/attendance.py +0 -0
  118. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/clarification.py +0 -0
  119. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/cloud_auth.py +0 -0
  120. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/commands/__init__.py +0 -0
  121. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/commands/auth.py +0 -0
  122. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/commands/clarify.py +0 -0
  123. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/commands/login.py +0 -0
  124. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/commands/whoami.py +0 -0
  125. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/credential_native.py +0 -0
  126. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/credential_store.py +0 -0
  127. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/credentials.py +0 -0
  128. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/login.py +0 -0
  129. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/path_kind.py +0 -0
  130. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/plain_file.py +0 -0
  131. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/src/mostlyright/data_harness/ux/remediation.py +0 -0
  132. {mostlyright_data-0.30.3 → mostlyright_data-0.30.4}/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.30.3
3
+ Version: 0.30.4
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/
@@ -44,6 +44,7 @@ session finds it. Then choose the source shape that fits.
44
44
  | One request per row of another source | a per-row `request`, with `batch` when a `GET` takes a list of ids | the gap | [per-row](references/patterns.md#one-request-per-row-many-ids-per-request) |
45
45
  | Bulk dump beside a windowed source | `reference` | `recheck_seconds` | [reference](references/patterns.md#bulk-dump-beside-a-windowed-source) |
46
46
  | Live `wss://` feed | a recorded stream | see [Streams](references/recording-a-stream-venue.md) | none |
47
+ | A join of tables this workspace already built, rebuilt when one promotes | `table.version@1.0.0` sources with `refresh: upstream_promoted` and `rebuild` (Studio 4.38) | one shared `data_classification`, `debounce_seconds` | [table sources](references/sources.md#reading-another-table-of-this-workspace) |
47
48
 
48
49
  [Patterns](references/patterns.md) has one complete recipe per row, with the pace set.
49
50
  [Sources](references/sources.md#pace-and-width) has the pace rules and the limits of parallel
@@ -383,3 +383,30 @@ with `epoch_millis_value` on the raw millisecond time column, and size the reque
383
383
  for all slices and pages. Do not substitute a whole-day query:
384
384
  1,440 one-minute bars exceed Binance's 1,000-row response cap. Existing credential-free
385
385
  `public.https` file fetches and `public.https.collection@2.0.0` keep their own contracts.
386
+
387
+ ### Reading another table of this workspace
388
+
389
+ Needs Studio 4.38. When the user wants a table that joins or reshapes tables this workspace has
390
+ already built, do not fetch the upstream data again. Read each upstream as a source:
391
+
392
+ - `source_class: mostlyright_table`, and a `table` locator with `{table_id, version:
393
+ latest_promoted}`.
394
+ - Adapter `table.version@1.0.0`, with `credential_mode: none` and the Reader pin
395
+ `parquet.tabular` `1.0.0`, decode options `{}`.
396
+ - `limits.max_source_bytes` above the upstream's real bytes. Take them from `mr-data table show`;
397
+ Studio refuses a run whose pinned upstream version is larger.
398
+
399
+ To rebuild the join whenever an upstream promotes, declare `rebuild` and add `refresh: {trigger:
400
+ upstream_promoted, debounce_seconds: N}`. Pick N so upstreams that promote together start one
401
+ rebuild; 900 is a sound default.
402
+
403
+ Three rules cost a round trip when they are missed:
404
+
405
+ - Every source states the same `data_classification`. Use the strictest upstream's class.
406
+ - The upstreams must be in this workspace, promoted, not archived, and not this table. No edge may
407
+ close a cycle.
408
+ - The trigger runs only after the user chose updates with `mr-data promote --cadence`. That
409
+ cadence stays the fallback schedule.
410
+
411
+ The full member list is in `docs/RECIPE-DOCUMENT.md`, "Needs Studio 4.38".
412
+
@@ -231,6 +231,8 @@ def lint_document(document: Mapping[str, Any]) -> list[Finding]:
231
231
  findings.extend(_columns(document.get("table")))
232
232
  findings.extend(_identifiers(document))
233
233
  findings.extend(_sources(document.get("sources")))
234
+ findings.extend(_table_sources(document.get("sources")))
235
+ findings.extend(_refresh_trigger(document))
234
236
  findings.extend(_row_filters(document.get("sources")))
235
237
  findings.extend(_row_request_credentials(document.get("sources")))
236
238
  findings.extend(_row_request_templates(document.get("sources")))
@@ -551,6 +553,272 @@ def _sources(sources: Any) -> list[Finding]:
551
553
  return findings
552
554
 
553
555
 
556
+ #: ``recipe.schema.json``'s Mostly Right table source (Studio 4.38.0, ADR 0100): the one adapter
557
+ #: that reads another table of this workspace, its source class and its locator kind.
558
+ TABLE_SOURCE_ADAPTER_ID = "table.version@1.0.0"
559
+ TABLE_SOURCE_CLASS = "mostlyright_table"
560
+ TABLE_LOCATOR_KIND = "table"
561
+
562
+ #: ``#/$defs/table_source_locator/properties/version``: the one selector v1 admits.
563
+ TABLE_SOURCE_VERSIONS: frozenset[str] = frozenset({"latest_promoted"})
564
+
565
+ #: Members a table source never carries: it is read whole, presents no credential and names no
566
+ #: origin, so the schema refuses each of these beside it.
567
+ TABLE_SOURCE_FORBIDDEN: tuple[str, ...] = (
568
+ "credential",
569
+ "window",
570
+ "collection",
571
+ "closed",
572
+ "reference",
573
+ "document_archive",
574
+ )
575
+ TABLE_CONNECTOR_FORBIDDEN: tuple[str, ...] = (
576
+ "origin",
577
+ "generic_api",
578
+ "stream_connector_document_digest",
579
+ )
580
+
581
+ #: ``#/$defs/table_refresh_trigger``.
582
+ REFRESH_TRIGGERS: frozenset[str] = frozenset({"upstream_promoted"})
583
+ MAX_REFRESH_DEBOUNCE_SECONDS = 86_400
584
+
585
+ _UUID = re.compile(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")
586
+
587
+
588
+ def is_table_source(source: Any) -> bool:
589
+ """Whether a source is a Mostly Right table source by any of the three marks the schema reads.
590
+
591
+ The schema applies the table-source rules when the adapter, the locator kind OR the source
592
+ class says so, so a source that states only one of them is held to all of them here too.
593
+ """
594
+
595
+ if not isinstance(source, Mapping):
596
+ return False
597
+ connector = source.get("connector")
598
+ locator = source.get("locator")
599
+ return (
600
+ (isinstance(connector, Mapping) and connector.get("adapter_id") == TABLE_SOURCE_ADAPTER_ID)
601
+ or (isinstance(locator, Mapping) and locator.get("kind") == TABLE_LOCATOR_KIND)
602
+ or source.get("source_class") == TABLE_SOURCE_CLASS
603
+ )
604
+
605
+
606
+ def _table_sources(sources: Any) -> list[Finding]:
607
+ """A Mostly Right table source's shape, which the schema refuses at the wire (Studio 4.38.0).
608
+
609
+ It reads the latest promoted version of another table in this workspace: source class
610
+ ``mostlyright_table``, a ``table`` locator naming the upstream ``table_id`` and
611
+ ``version: latest_promoted``, adapter ``table.version@1.0.0`` with ``credential_mode: none``
612
+ and the Reader pin that decodes the upstream's Parquet parts. Which table it names, whether that
613
+ table is in this workspace, promoted, archived, the table itself or closes a cycle, is Studio's
614
+ to judge at registration; nothing here can see the workspace.
615
+ """
616
+
617
+ findings: list[Finding] = []
618
+ for index, source in enumerate(sources if isinstance(sources, list) else ()):
619
+ if not is_table_source(source):
620
+ continue
621
+ pointer = f"/sources/{index}"
622
+ if source.get("source_class") != TABLE_SOURCE_CLASS:
623
+ findings.append(
624
+ Finding(
625
+ DOCUMENT_INVALID,
626
+ f"{pointer}/source_class",
627
+ f"must be {TABLE_SOURCE_CLASS!r} for a source that reads another table",
628
+ )
629
+ )
630
+ locator = source.get("locator")
631
+ locator = locator if isinstance(locator, Mapping) else {}
632
+ if locator.get("kind") != TABLE_LOCATOR_KIND:
633
+ findings.append(
634
+ Finding(
635
+ DOCUMENT_INVALID,
636
+ f"{pointer}/locator/kind",
637
+ f"must be {TABLE_LOCATOR_KIND!r} for a source that reads another table",
638
+ )
639
+ )
640
+ table = locator.get("table")
641
+ if not isinstance(table, Mapping):
642
+ findings.append(
643
+ Finding(
644
+ DOCUMENT_INVALID,
645
+ f"{pointer}/locator/table",
646
+ "is absent; it names the upstream table as {table_id, version: "
647
+ "latest_promoted}",
648
+ )
649
+ )
650
+ else:
651
+ table_id = table.get("table_id")
652
+ if not isinstance(table_id, str) or _UUID.match(table_id) is None:
653
+ findings.append(
654
+ Finding(
655
+ DOCUMENT_INVALID,
656
+ f"{pointer}/locator/table/table_id",
657
+ "is not a lowercase UUID naming a table of this workspace",
658
+ )
659
+ )
660
+ if _outside(table.get("version"), TABLE_SOURCE_VERSIONS):
661
+ findings.append(
662
+ Finding(
663
+ DOCUMENT_INVALID,
664
+ f"{pointer}/locator/table/version",
665
+ "must be 'latest_promoted', the one version selector Studio admits",
666
+ )
667
+ )
668
+ for member in sorted(set(table) - {"table_id", "version"}):
669
+ findings.append(
670
+ Finding(
671
+ DOCUMENT_INVALID,
672
+ f"{pointer}/locator/table/{_escape(str(member))}",
673
+ "is not a member of a table locator",
674
+ )
675
+ )
676
+ connector = source.get("connector")
677
+ connector = connector if isinstance(connector, Mapping) else {}
678
+ if connector.get("adapter_id") != TABLE_SOURCE_ADAPTER_ID:
679
+ findings.append(
680
+ Finding(
681
+ DOCUMENT_INVALID,
682
+ f"{pointer}/connector/adapter_id",
683
+ f"must be {TABLE_SOURCE_ADAPTER_ID!r} for a source that reads another table",
684
+ )
685
+ )
686
+ if connector.get("credential_mode") != "none":
687
+ findings.append(
688
+ Finding(
689
+ DOCUMENT_INVALID,
690
+ f"{pointer}/connector/credential_mode",
691
+ "must be 'none': a table source reads this workspace's own sealed parts",
692
+ )
693
+ )
694
+ parameters = connector.get("parameters")
695
+ if not isinstance(parameters, list) or len(parameters) < 2:
696
+ findings.append(
697
+ Finding(
698
+ DOCUMENT_INVALID,
699
+ f"{pointer}/connector/parameters",
700
+ "must pin the Reader that decodes the upstream's Parquet parts "
701
+ "(reader.family_id parquet.tabular, reader.family_version, "
702
+ "reader.decode_options)",
703
+ )
704
+ )
705
+ for member in TABLE_CONNECTOR_FORBIDDEN:
706
+ if member in connector:
707
+ findings.append(
708
+ Finding(
709
+ DOCUMENT_INVALID,
710
+ f"{pointer}/connector/{member}",
711
+ "is not stated on a table source, which reaches no origin",
712
+ )
713
+ )
714
+ for member in TABLE_SOURCE_FORBIDDEN:
715
+ if member in source:
716
+ findings.append(
717
+ Finding(
718
+ DOCUMENT_INVALID,
719
+ f"{pointer}/{member}",
720
+ "is not stated on a table source, which is read whole and presents no "
721
+ "credential",
722
+ )
723
+ )
724
+ return findings
725
+
726
+
727
+ def _refresh_trigger(document: Mapping[str, Any]) -> list[Finding]:
728
+ """``refresh: {trigger: upstream_promoted, debounce_seconds}`` and what it requires.
729
+
730
+ The trigger asks Studio to rebuild this table when an upstream table it reads promotes a new
731
+ version, so the schema requires ``rebuild`` beside it (the rebuild is what answers the request,
732
+ under its own interval and byte bounds) and at least one ``table.version@1.0.0`` source.
733
+ """
734
+
735
+ if "refresh" not in document:
736
+ return []
737
+ refresh = document.get("refresh")
738
+ if not isinstance(refresh, Mapping):
739
+ return [Finding(DOCUMENT_INVALID, "/refresh", "is not one JSON object")]
740
+ findings: list[Finding] = []
741
+ if _outside(refresh.get("trigger"), REFRESH_TRIGGERS):
742
+ findings.append(
743
+ Finding(DOCUMENT_INVALID, "/refresh/trigger", "must be 'upstream_promoted'")
744
+ )
745
+ debounce = refresh.get("debounce_seconds")
746
+ if (
747
+ isinstance(debounce, bool)
748
+ or not isinstance(debounce, int)
749
+ or not 0 <= debounce <= MAX_REFRESH_DEBOUNCE_SECONDS
750
+ ):
751
+ findings.append(
752
+ Finding(
753
+ DOCUMENT_INVALID,
754
+ "/refresh/debounce_seconds",
755
+ f"must be a whole number of seconds from 0 to {MAX_REFRESH_DEBOUNCE_SECONDS}",
756
+ )
757
+ )
758
+ for member in sorted(set(refresh) - {"trigger", "debounce_seconds"}):
759
+ findings.append(
760
+ Finding(
761
+ DOCUMENT_INVALID,
762
+ f"/refresh/{_escape(str(member))}",
763
+ "is not a member of refresh",
764
+ )
765
+ )
766
+ if "rebuild" not in document:
767
+ findings.append(
768
+ Finding(
769
+ DOCUMENT_INVALID,
770
+ "/rebuild",
771
+ "is absent, and refresh requires it: the declared whole-table rebuild is what "
772
+ "answers an upstream promotion",
773
+ )
774
+ )
775
+ sources = document.get("sources")
776
+ if not any(
777
+ isinstance(source, Mapping)
778
+ and isinstance(source.get("connector"), Mapping)
779
+ and source["connector"].get("adapter_id") == TABLE_SOURCE_ADAPTER_ID
780
+ for source in (sources if isinstance(sources, list) else ())
781
+ ):
782
+ findings.append(
783
+ Finding(
784
+ DOCUMENT_INVALID,
785
+ "/refresh",
786
+ f"needs at least one {TABLE_SOURCE_ADAPTER_ID} source: only an upstream table "
787
+ "this recipe reads can promote",
788
+ )
789
+ )
790
+ return findings
791
+
792
+
793
+ def _classification_coherence(sources: Any) -> list[Finding]:
794
+ """Every source of one run declares one ``data_classification``.
795
+
796
+ The worker's governance refuses a run whose sources declare two classifications
797
+ (``RUN_RECIPE_INVALID`` at acquire), after the document registered and a run was queued, so
798
+ it is named here. It matters most for a join of Mostly Right tables, whose sources inherit
799
+ each upstream's classification and must still agree.
800
+ """
801
+
802
+ stated = [
803
+ (index, source.get("data_classification"))
804
+ for index, source in enumerate(sources if isinstance(sources, list) else ())
805
+ if isinstance(source, Mapping) and isinstance(source.get("data_classification"), str)
806
+ ]
807
+ if len({value for _index, value in stated}) <= 1:
808
+ return []
809
+ first = stated[0][1]
810
+ return [
811
+ Finding(
812
+ DOCUMENT_INCOHERENT,
813
+ f"/sources/{index}/data_classification",
814
+ f"is {value!r} while /sources/{stated[0][0]} is {first!r}; the worker refuses a run "
815
+ "whose sources declare more than one classification, at acquire",
816
+ )
817
+ for index, value in stated
818
+ if value != first
819
+ ]
820
+
821
+
554
822
  def _row_filters(sources: Any) -> list[Finding]:
555
823
  """``collection.discovery.row_filter``: where one may stand, and what it must be.
556
824
 
@@ -905,6 +1173,7 @@ def _coherence(document: Mapping[str, Any], *, declared: Sequence[str]) -> list[
905
1173
  findings.extend(_table_partition_coherence(document, known=known))
906
1174
  findings.extend(_reference_coherence(document.get("sources")))
907
1175
  findings.extend(_rebuild_coherence(document))
1176
+ findings.extend(_classification_coherence(document.get("sources")))
908
1177
  return findings
909
1178
 
910
1179
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema_version": "mostlyright-thin-table-search-contract.v1",
3
- "source_commit": "b308bc2e9ebb424b4cfe1130438ab9f7d0b6736d",
3
+ "source_commit": "f61f08e29fc94e2fb1c2d16e0de2e08522a9f993",
4
4
  "recipe_search_definition": "spec",
5
5
  "$defs": {
6
6
  "evaluation_case": {
@@ -148,8 +148,8 @@ from mostlyright.data_harness.thin.transport import ThinLaneError
148
148
  #: ``JOB_INVALID`` outright, which in production was every refresh a collection epoch was offered
149
149
  #: for rather than only the collection runs. This package must not reach a Studio older than the
150
150
  #: commit it pins; ``docs/V4-WORKER-PROTOCOL.md`` states it beside the layout's own ordering rule.
151
- PINNED_V4_OPENAPI_SOURCE_SHA256 = "001a5e132e8af9872ac61168e41df4465627f34ac062066b212f1b48a88385f4"
152
- PINNED_V4_CONTRACT_VERSION = "4.35.0"
151
+ PINNED_V4_OPENAPI_SOURCE_SHA256 = "67cc1e66ae3610d9ae5c8b5469bb05e51a8519e55ecef502387fdbb4185b084e"
152
+ PINNED_V4_CONTRACT_VERSION = "4.38.0"
153
153
 
154
154
  #: The ``schema_version`` every command body that predates 4.14.0 stamps: ``dataset activity``,
155
155
  #: ``table rename``, ``table archive`` and ``dataset archive``. It is the number the 0.25 line