mostlyright-data 0.31.20__tar.gz → 0.31.22__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.
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/PKG-INFO +1 -1
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/preparing-table-search.md +3 -1
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/session.py +30 -7
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/table_search_contract.json +87 -7
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/transport.py +59 -20
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4.py +2 -2
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_public.py +10 -5
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_search.py +27 -2
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/cloud_auth.py +7 -4
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/login.py +20 -8
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/remediation.py +9 -2
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/.gitignore +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/README.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/pyproject.toml +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/scripts/hatch_build.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/SKILL.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/agents/openai.yaml +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/1-open-the-page-and-the-link-to-it-in-the-first-message.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/2-brief-two-to-four-questions-each-with-a-recommended-answer.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/3-probe-read-a-source-before-committing-to-it.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/4-decide-say-what-you-chose-what-you-refused-and-ask-one-question.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/5-draft-one-recipe-document-one-call.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/7-interrogate-ask-the-run-what-it-actually-delivered.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/8-fix-revise-the-document-and-register-it-again.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/9-present-only-what-survived-inspection-with-caveats.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/agent-protocol.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/autonomous-delivery.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/before-the-first-tool-call.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/boundaries.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/cloud-authentication-preflight.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/commands.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/enriching-with-small-models.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/live-run.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/making-a-table-incremental.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/narrating-the-run.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/not-hosted-yet.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/one-install.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/patterns.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/prediction-labels.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/promote.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/readers.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/receipts.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/recipe-test.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/recording-a-stream-venue.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/recovering-an-import-failure.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/reference-pages.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/required-protocol.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/source-credentials.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/sources.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/the-one-thing-to-say-about-the-skill-itself.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/transforms.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/user-communication-contract.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/writing-a-decision-record.md +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/scripts/write_research_notebook.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/__init__.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/agent_protocol.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/canonical.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/key_seam.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/page_coverage.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/part_check_evidence.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/session_probes.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/skill_assets.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/table_manifest.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/__init__.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/activity.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/backoff.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/categories.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/dataset-categories-v1.json +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/delivery.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/description_shape.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/download.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/enrichment.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/fast_features.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/matching_benchmark.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/probe.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/progress_rate.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/progress_vocabulary.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe_brief.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe_explain.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe_forecast.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe_lint.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe_test.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/refresh_rehearsal.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/release_check.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/research.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/router.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/run_diagnose.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/run_prefix.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/runs.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/stream.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/stream_venue.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/studio_capabilities.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/support.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/table_view.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/user_agent.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_artifacts.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_catalog.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_connected.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_connections.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_dataset_covers.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_datasets.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_handoff.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_matching.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_narrative.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_query.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_reader.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_runs.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_search_contract.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_secrets.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_stream.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_tables.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/vocabulary.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/__init__.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/attendance.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/clarification.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/commands/__init__.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/commands/auth.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/commands/clarify.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/commands/login.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/commands/whoami.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/credential_native.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/credential_store.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/credentials.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/path_kind.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/plain_file.py +0 -0
- {mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/render.py +0 -0
|
@@ -361,7 +361,9 @@ mr-data search status TABLE_ID --version VERSION_ID --json
|
|
|
361
361
|
|
|
362
362
|
Exit code 0 means a generation serves the spec. Exit code 3 means not ready yet: a build is
|
|
363
363
|
running, or the version needs a build or an activation. Read `reason` before you wait.
|
|
364
|
-
`never_built`, `not_activated` and `spec_mismatch` need an action, not time. Exit code 1 means the build failed or was cancelled.
|
|
364
|
+
`never_built`, `not_activated` and `spec_mismatch` need an action, not time. Exit code 1 means the build failed or was cancelled. When `preparation_state` is `ready` but `package_state` is not, the
|
|
365
|
+
headline names this version's package. Exit code 1 means its build failed, and exit code 3 means
|
|
366
|
+
it is still building. The previous version's package may serve meanwhile. Never queue
|
|
365
367
|
a duplicate build while one runs. A failed build leaves the data published. Never call a table
|
|
366
368
|
partly ready.
|
|
367
369
|
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/session.py
RENAMED
|
@@ -25,7 +25,7 @@ from dataclasses import dataclass
|
|
|
25
25
|
from dataclasses import field as dataclass_field
|
|
26
26
|
from datetime import UTC, datetime, timedelta
|
|
27
27
|
from typing import Any
|
|
28
|
-
from urllib.parse import quote, urlencode
|
|
28
|
+
from urllib.parse import quote, urlencode, urlsplit
|
|
29
29
|
from uuid import UUID
|
|
30
30
|
|
|
31
31
|
from mostlyright.data_harness.canonical import (
|
|
@@ -40,10 +40,12 @@ from mostlyright.data_harness.thin.transport import (
|
|
|
40
40
|
ThinLaneError,
|
|
41
41
|
Transport,
|
|
42
42
|
UrlLibTransport,
|
|
43
|
+
cloud_origin,
|
|
44
|
+
is_loopback_ip,
|
|
43
45
|
service_origin,
|
|
44
46
|
)
|
|
45
47
|
from mostlyright.data_harness.thin.user_agent import agent_headers
|
|
46
|
-
from mostlyright.data_harness.ux.credentials import ResolvedCloudCredentials
|
|
48
|
+
from mostlyright.data_harness.ux.credentials import DEFAULT_CLOUD_URL, ResolvedCloudCredentials
|
|
47
49
|
|
|
48
50
|
#: Cloud's token-exchange route. Held identical to ``hosted_deploy.CLOUD_TOKEN_PATH`` by a test.
|
|
49
51
|
CLOUD_TOKEN_PATH = "/api/cli/studio-token"
|
|
@@ -224,17 +226,27 @@ class StudioSession:
|
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
|
|
229
|
+
def dashboard_origin(cloud_url: str) -> str:
|
|
230
|
+
"""The origin of a Cloud page a person opens: the public Cloud when the Cloud URL is loopback.
|
|
231
|
+
|
|
232
|
+
A loopback Cloud URL is a sandbox's forwarder, which is dead on the reader's own machine.
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
origin = cloud_origin(cloud_url)
|
|
236
|
+
return DEFAULT_CLOUD_URL if is_loopback_ip(urlsplit(origin).hostname) else origin
|
|
237
|
+
|
|
238
|
+
|
|
227
239
|
def team_dashboard_url(cloud_url: str) -> str:
|
|
228
240
|
"""The Cloud listing of this team's Datasets, from one validated origin."""
|
|
229
241
|
|
|
230
|
-
origin =
|
|
242
|
+
origin = dashboard_origin(cloud_url)
|
|
231
243
|
return origin + CLOUD_TEAM_DASHBOARD_PATH
|
|
232
244
|
|
|
233
245
|
|
|
234
246
|
def dataset_dashboard_url(cloud_url: str, dataset_id: str) -> str:
|
|
235
247
|
"""The Cloud page for one Dataset, with its identifier held to one path segment."""
|
|
236
248
|
|
|
237
|
-
origin =
|
|
249
|
+
origin = dashboard_origin(cloud_url)
|
|
238
250
|
encoded_dataset_id = quote(str(dataset_id), safe="")
|
|
239
251
|
return origin + CLOUD_DATASET_DASHBOARD_PATH.format(dataset_id=encoded_dataset_id)
|
|
240
252
|
|
|
@@ -273,7 +285,7 @@ def run_page_dashboard_url(cloud_url: str, run_id: str) -> str:
|
|
|
273
285
|
names :func:`run_record_dashboard_url`, which is the Dataset page somebody has been watching.
|
|
274
286
|
"""
|
|
275
287
|
|
|
276
|
-
origin =
|
|
288
|
+
origin = dashboard_origin(cloud_url)
|
|
277
289
|
return origin + CLOUD_RUN_DASHBOARD_PATH.format(run_id=quote(str(run_id), safe=""))
|
|
278
290
|
|
|
279
291
|
|
|
@@ -369,7 +381,7 @@ def open_studio_session(
|
|
|
369
381
|
"""
|
|
370
382
|
|
|
371
383
|
require_device_key(credentials)
|
|
372
|
-
cloud_url =
|
|
384
|
+
cloud_url = cloud_origin(credentials.cloud_url)
|
|
373
385
|
selected = transport or UrlLibTransport()
|
|
374
386
|
attempts_remaining = TOKEN_EXCHANGE_RETRY_ATTEMPTS
|
|
375
387
|
while True:
|
|
@@ -874,6 +886,17 @@ def cloud_refusal(
|
|
|
874
886
|
refusal = (ThinLaneError if composed else CloudRouteAbsent)(
|
|
875
887
|
"THIN_NOT_FOUND", f"{sentence}{suffix}"
|
|
876
888
|
)
|
|
889
|
+
elif status == 429:
|
|
890
|
+
# The same code the token exchange gives a 429, so one retry rule covers every Cloud
|
|
891
|
+
# route. Cloud's ``retry-after`` rides along as ``retry_after_seconds`` below.
|
|
892
|
+
wait = cloud_response_metadata(status, parsed, headers or {}).get("retry_after_seconds")
|
|
893
|
+
stated = named or said
|
|
894
|
+
refusal = ThinLaneError(
|
|
895
|
+
"THIN_RATE_LIMITED",
|
|
896
|
+
f"Cloud rate limited the request to {act}"
|
|
897
|
+
+ (f" (Cloud said: {stated})" if stated else "")
|
|
898
|
+
+ (f". Retry after {wait} seconds" if wait is not None else ". Retry later"),
|
|
899
|
+
)
|
|
877
900
|
elif named is not None:
|
|
878
901
|
refusal = ThinLaneError(f"THIN_CLOUD_{named}", f"Cloud refused to {act} ({named})")
|
|
879
902
|
else:
|
|
@@ -913,7 +936,7 @@ class CloudClient:
|
|
|
913
936
|
self, credentials: ResolvedCloudCredentials, *, transport: Transport | None = None
|
|
914
937
|
) -> None:
|
|
915
938
|
self._credentials = credentials
|
|
916
|
-
self._origin =
|
|
939
|
+
self._origin = cloud_origin(credentials.cloud_url)
|
|
917
940
|
self._transport = transport or UrlLibTransport()
|
|
918
941
|
self.response_metadata: dict[str, Any] = {}
|
|
919
942
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": "mostlyright-thin-table-search-contract.v1",
|
|
3
|
-
"source_commit": "
|
|
3
|
+
"source_commit": "de54ea1f6088aa39db57828e798c2bd4e8326191",
|
|
4
4
|
"recipe_search_definition": "recipe_search",
|
|
5
5
|
"$defs": {
|
|
6
6
|
"common.safe_integer": {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"long_text_columns"
|
|
125
125
|
]
|
|
126
126
|
},
|
|
127
|
-
"description": "
|
|
127
|
+
"description": "A recipe does not declare long_text_columns yet: a search revision declares it."
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
"not": {
|
|
@@ -206,11 +206,25 @@
|
|
|
206
206
|
"required": [
|
|
207
207
|
"phrase",
|
|
208
208
|
"column",
|
|
209
|
-
"operator"
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
"operator"
|
|
210
|
+
],
|
|
211
|
+
"if": {
|
|
212
|
+
"properties": {
|
|
213
|
+
"operator": {
|
|
214
|
+
"enum": [
|
|
215
|
+
"is_null",
|
|
216
|
+
"is_not_null"
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"else": {
|
|
222
|
+
"required": [
|
|
223
|
+
"value"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
212
226
|
},
|
|
213
|
-
"description": "Filter phrases (4.45.0: at most 512). The aliases and sort aliases together take at most 196,608 bytes as compact UTF-8 JSON, which
|
|
227
|
+
"description": "Filter phrases (4.45.0: at most 512). The aliases and sort aliases together take at most 196,608 bytes as compact UTF-8 JSON, which the server's registration holds. A recipe's `table.search` may declare at most 128 aliases and 64 sort aliases while the pinned engine reads no more; a search revision takes the full budget. A null test (`is_null`, `is_not_null`) may leave out `value` (4.59.0); every other operator carries one."
|
|
214
228
|
},
|
|
215
229
|
"sort_aliases": {
|
|
216
230
|
"type": "array",
|
|
@@ -553,7 +567,7 @@
|
|
|
553
567
|
}
|
|
554
568
|
},
|
|
555
569
|
"long_text_columns": {
|
|
556
|
-
"description": "Long string columns (4.42.0) whose text is searched by meaning, Mojirama's subtitles: plot synopses, descriptions, dialogue. Each row's text is cut into chunks, embedded and averaged into one vector per row in the package's `media.long_text`, and a plan's `long_text` ranks with it. Declared columns of type string; a public table only (
|
|
570
|
+
"description": "Long string columns (4.42.0) whose text is searched by meaning, Mojirama's subtitles: plot synopses, descriptions, dialogue. Each row's text is cut into chunks, embedded and averaged into one vector per row in the package's `media.long_text`, and a plan's `long_text` ranks with it. Declared columns of type string; a public table only (the server declares no media for another). Admitted on a search revision; a recipe's `table.search` may not name it yet.",
|
|
557
571
|
"type": "array",
|
|
558
572
|
"minItems": 1,
|
|
559
573
|
"maxItems": 4,
|
|
@@ -563,6 +577,72 @@
|
|
|
563
577
|
"minLength": 1,
|
|
564
578
|
"maxLength": 128
|
|
565
579
|
}
|
|
580
|
+
},
|
|
581
|
+
"keyword_roles": {
|
|
582
|
+
"description": "Optional (4.58.0): the lexical role of a keyword column, keyed by the column, each key one of keyword_columns. A role sets the column's field in the engine and with it its weight: title 3, person 2, brand and meta 1.7 (a brand column is also an entity column for the brand role's lookups), body 1. A keyword column with no entry keeps the role the server's declaration gives it today (title for the title role, person or brand for those roles' columns, else body). Declared by the catalog spec (contracts/fixtures/v4/catalog-search.spec.json); a table search revision that states it is accepted and the table declaration builder does not read it yet.",
|
|
583
|
+
"type": "object",
|
|
584
|
+
"maxProperties": 16,
|
|
585
|
+
"propertyNames": {
|
|
586
|
+
"type": "string",
|
|
587
|
+
"minLength": 1,
|
|
588
|
+
"maxLength": 128
|
|
589
|
+
},
|
|
590
|
+
"additionalProperties": {
|
|
591
|
+
"enum": [
|
|
592
|
+
"title",
|
|
593
|
+
"person",
|
|
594
|
+
"brand",
|
|
595
|
+
"meta",
|
|
596
|
+
"body"
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
"column_notes": {
|
|
601
|
+
"description": "Optional (4.58.0): the owner's note for a declared column, in place of the recipe column description the manifest's column_notes copy for a table (the catalog has no recipe). Each column is a declared column of this spec; a note is 1 to 160 characters without control characters, at most 480 UTF-8 bytes, at most one per column. The manifest carries them as column_notes, under its existing byte caps.",
|
|
602
|
+
"type": "array",
|
|
603
|
+
"maxItems": 96,
|
|
604
|
+
"items": {
|
|
605
|
+
"type": "object",
|
|
606
|
+
"additionalProperties": false,
|
|
607
|
+
"properties": {
|
|
608
|
+
"column": {
|
|
609
|
+
"type": "string",
|
|
610
|
+
"minLength": 1,
|
|
611
|
+
"maxLength": 128
|
|
612
|
+
},
|
|
613
|
+
"note": {
|
|
614
|
+
"type": "string",
|
|
615
|
+
"minLength": 1,
|
|
616
|
+
"maxLength": 160,
|
|
617
|
+
"pattern": "^[^\\u0000-\\u001F]+$"
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
"required": [
|
|
621
|
+
"column",
|
|
622
|
+
"note"
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
"collapse": {
|
|
627
|
+
"description": "Optional (4.58.0): collapse ranked rows to one result per distinct value of `column` (a display column): the best row of a group answers for it and at most `matched_via_max` other matching rows of the group are listed with it. Declared by the catalog spec (column dataset_id); the manifest carries it as catalog.collapse, and only the catalog result shape (catalog-search-result.schema.json) answers collapsed groups. A table search revision that states it is accepted and ignored.",
|
|
628
|
+
"type": "object",
|
|
629
|
+
"additionalProperties": false,
|
|
630
|
+
"properties": {
|
|
631
|
+
"column": {
|
|
632
|
+
"type": "string",
|
|
633
|
+
"minLength": 1,
|
|
634
|
+
"maxLength": 128
|
|
635
|
+
},
|
|
636
|
+
"matched_via_max": {
|
|
637
|
+
"type": "integer",
|
|
638
|
+
"minimum": 0,
|
|
639
|
+
"maximum": 8
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
"required": [
|
|
643
|
+
"column",
|
|
644
|
+
"matched_via_max"
|
|
645
|
+
]
|
|
566
646
|
}
|
|
567
647
|
},
|
|
568
648
|
"required": [
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/transport.py
RENAMED
|
@@ -192,8 +192,8 @@ class _RoutingCookiePolicy(DefaultCookiePolicy):
|
|
|
192
192
|
or len(cookie.value or "") > 4096
|
|
193
193
|
):
|
|
194
194
|
return False
|
|
195
|
-
# Cloud Run emits this without Secure. The
|
|
196
|
-
#
|
|
195
|
+
# Cloud Run emits this without Secure. The stored form must never
|
|
196
|
+
# permit an HTTP send, so a loopback HTTP origin never gets it back.
|
|
197
197
|
cookie.secure = True
|
|
198
198
|
return super().set_ok(cookie, request)
|
|
199
199
|
|
|
@@ -255,6 +255,8 @@ def _remember_routing_cookie(
|
|
|
255
255
|
class ReusableHttpsTransport(UrlLibTransport):
|
|
256
256
|
"""One serialized, verified HTTPS connection for repeated query requests.
|
|
257
257
|
|
|
258
|
+
Plain HTTP is accepted only for a loopback origin, as :func:`service_origin` allows.
|
|
259
|
+
|
|
258
260
|
urllib deliberately sends Connection: close. A query client reuses its
|
|
259
261
|
own connection instead, never a global credential-bearing pool. Changing
|
|
260
262
|
origin closes the old socket. Responses are bounded and fully framed;
|
|
@@ -267,7 +269,7 @@ class ReusableHttpsTransport(UrlLibTransport):
|
|
|
267
269
|
def __init__(self, *, timeout: float | Callable[[], float] = REQUEST_TIMEOUT_SECONDS) -> None:
|
|
268
270
|
super().__init__(timeout=timeout)
|
|
269
271
|
self._lock = threading.Lock()
|
|
270
|
-
self._connection: http.client.
|
|
272
|
+
self._connection: http.client.HTTPConnection | None = None
|
|
271
273
|
self._connection_origin: tuple[str, str, int] | None = None
|
|
272
274
|
self._routing = CookieJar(policy=_RoutingCookiePolicy())
|
|
273
275
|
self._routing_context: tuple[tuple[str, str, int], bytes] | None = None
|
|
@@ -302,13 +304,17 @@ class ReusableHttpsTransport(UrlLibTransport):
|
|
|
302
304
|
raise ThinLaneError("THIN_REQUEST_INVALID", "the response ceiling must be nonnegative")
|
|
303
305
|
parts = urlsplit(url)
|
|
304
306
|
service_origin(
|
|
305
|
-
f"{parts.scheme}://{parts.netloc}", "request origin", allow_loopback_http=
|
|
307
|
+
f"{parts.scheme}://{parts.netloc}", "request origin", allow_loopback_http=True
|
|
306
308
|
)
|
|
307
|
-
if parts.
|
|
309
|
+
if parts.fragment or parts.hostname is None:
|
|
308
310
|
raise ThinLaneError(
|
|
309
311
|
"THIN_REQUEST_INVALID", "a reusable request requires a valid HTTPS URL"
|
|
310
312
|
)
|
|
311
|
-
origin = (
|
|
313
|
+
origin = (
|
|
314
|
+
parts.scheme,
|
|
315
|
+
parts.hostname.lower(),
|
|
316
|
+
parts.port or (443 if parts.scheme == "https" else 80),
|
|
317
|
+
)
|
|
312
318
|
if any(
|
|
313
319
|
name.lower() == "host" and value.lower() != parts.netloc.lower()
|
|
314
320
|
for name, value in headers.items()
|
|
@@ -346,8 +352,13 @@ class ReusableHttpsTransport(UrlLibTransport):
|
|
|
346
352
|
if self._connection_origin != origin:
|
|
347
353
|
self._discard()
|
|
348
354
|
if self._connection is None:
|
|
349
|
-
self._connection =
|
|
350
|
-
|
|
355
|
+
self._connection = (
|
|
356
|
+
http.client.HTTPSConnection(
|
|
357
|
+
origin[1], origin[2], timeout=remaining(), context=self._context
|
|
358
|
+
)
|
|
359
|
+
if origin[0] == "https"
|
|
360
|
+
# service_origin admitted plain HTTP only for a loopback host.
|
|
361
|
+
else http.client.HTTPConnection(origin[1], origin[2], timeout=remaining())
|
|
351
362
|
)
|
|
352
363
|
self._connection_origin = origin
|
|
353
364
|
connection = self._connection
|
|
@@ -395,38 +406,66 @@ class ReusableHttpsTransport(UrlLibTransport):
|
|
|
395
406
|
self._lock.release()
|
|
396
407
|
|
|
397
408
|
|
|
409
|
+
def is_loopback_ip(hostname: str | None) -> bool:
|
|
410
|
+
"""Whether ``hostname`` is a loopback IP literal. A name such as ``localhost`` is not one."""
|
|
411
|
+
|
|
412
|
+
try:
|
|
413
|
+
return bool(hostname) and ipaddress.ip_address(hostname).is_loopback
|
|
414
|
+
except ValueError:
|
|
415
|
+
return False
|
|
416
|
+
|
|
417
|
+
|
|
398
418
|
def service_origin(value: str, label: str, *, allow_loopback_http: bool) -> str:
|
|
399
419
|
"""Return ``value`` when it is a bare HTTPS origin, and refuse it otherwise.
|
|
400
420
|
|
|
401
421
|
No user information, no path, no query, no fragment, and plain HTTP only for a loopback host,
|
|
402
|
-
which is what a developer running Studio locally needs
|
|
403
|
-
|
|
422
|
+
which is what a developer running Studio locally needs. Nothing reached over a network may be
|
|
423
|
+
plain HTTP.
|
|
404
424
|
"""
|
|
405
425
|
|
|
426
|
+
refusal = ThinLaneError(
|
|
427
|
+
"THIN_CONFIG_INVALID",
|
|
428
|
+
f"{label} must be an HTTPS origin without user information, path, query, or fragment",
|
|
429
|
+
)
|
|
406
430
|
if not isinstance(value, str) or not 1 <= len(value) <= 2048 or value.endswith("/"):
|
|
407
431
|
raise ThinLaneError("THIN_CONFIG_INVALID", f"{label} is not a usable origin")
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
432
|
+
if value != value.strip():
|
|
433
|
+
raise refusal
|
|
434
|
+
try:
|
|
435
|
+
parsed = urlsplit(value)
|
|
436
|
+
_ = parsed.port
|
|
437
|
+
except ValueError:
|
|
438
|
+
raise refusal from None
|
|
439
|
+
loopback = is_loopback_ip(parsed.hostname) or parsed.hostname == "localhost"
|
|
415
440
|
if (
|
|
416
441
|
parsed.scheme not in ({"https", "http"} if allow_loopback_http else {"https"})
|
|
417
442
|
or (parsed.scheme == "http" and not loopback)
|
|
418
443
|
or not parsed.hostname
|
|
444
|
+
or parsed.netloc.endswith(":")
|
|
419
445
|
or parsed.username is not None
|
|
420
446
|
or parsed.password is not None
|
|
421
447
|
or parsed.fragment
|
|
422
448
|
or parsed.path not in {"", "/"}
|
|
423
449
|
or parsed.query
|
|
424
450
|
):
|
|
451
|
+
raise refusal
|
|
452
|
+
return value
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
def cloud_origin(value: str) -> str:
|
|
456
|
+
""":func:`service_origin` for the Cloud URL: plain HTTP only on a loopback IP literal.
|
|
457
|
+
|
|
458
|
+
A sandbox reaches Cloud through a forwarder on ``http://127.0.0.1:<port>``. The name
|
|
459
|
+
``localhost`` is refused because a resolver search domain can send it off the machine.
|
|
460
|
+
"""
|
|
461
|
+
|
|
462
|
+
origin = service_origin(value, "Cloud URL", allow_loopback_http=True)
|
|
463
|
+
parsed = urlsplit(origin)
|
|
464
|
+
if parsed.scheme == "http" and not is_loopback_ip(parsed.hostname):
|
|
425
465
|
raise ThinLaneError(
|
|
426
|
-
"THIN_CONFIG_INVALID",
|
|
427
|
-
f"{label} must be an HTTPS origin without user information, path, query, or fragment",
|
|
466
|
+
"THIN_CONFIG_INVALID", "Cloud URL may be plain HTTP only on a loopback IP address"
|
|
428
467
|
)
|
|
429
|
-
return
|
|
468
|
+
return origin
|
|
430
469
|
|
|
431
470
|
|
|
432
471
|
def signed_transfer_url(value: str, label: str) -> str:
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4.py
RENAMED
|
@@ -147,8 +147,8 @@ from mostlyright.data_harness.thin.v4_matching import CONTRACT_PATHS as MATCHING
|
|
|
147
147
|
#: ``JOB_INVALID`` outright, which in production was every refresh a collection epoch was offered
|
|
148
148
|
#: for rather than only the collection runs. This package must not reach a Studio older than the
|
|
149
149
|
#: commit it pins; ``docs/V4-WORKER-PROTOCOL.md`` states it beside the layout's own ordering rule.
|
|
150
|
-
PINNED_V4_OPENAPI_SOURCE_SHA256 = "
|
|
151
|
-
PINNED_V4_CONTRACT_VERSION = "4.
|
|
150
|
+
PINNED_V4_OPENAPI_SOURCE_SHA256 = "5c7f52ee5045ba2ebcaadd5d158a63151fcf0b39f1fe3b5563b037fec7b5d1ec"
|
|
151
|
+
PINNED_V4_CONTRACT_VERSION = "4.59.0"
|
|
152
152
|
|
|
153
153
|
#: The ``schema_version`` every command body that predates 4.14.0 stamps: ``dataset activity``,
|
|
154
154
|
#: ``table rename``, ``table archive`` and ``dataset archive``. It is the number the 0.25 line
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_public.py
RENAMED
|
@@ -50,7 +50,7 @@ from mostlyright.data_harness.thin.transport import (
|
|
|
50
50
|
ThinLaneError,
|
|
51
51
|
Transport,
|
|
52
52
|
UrlLibTransport,
|
|
53
|
-
|
|
53
|
+
cloud_origin,
|
|
54
54
|
)
|
|
55
55
|
from mostlyright.data_harness.thin.user_agent import agent_headers, with_user_agent
|
|
56
56
|
from mostlyright.data_harness.ux.credentials import (
|
|
@@ -219,21 +219,21 @@ def resolve_public_origin(
|
|
|
219
219
|
values = os.environ if environment is None else environment
|
|
220
220
|
stated = values.get(CLOUD_URL_ENV)
|
|
221
221
|
if isinstance(stated, str) and stated.strip():
|
|
222
|
-
return
|
|
222
|
+
return cloud_origin(stated)
|
|
223
223
|
try:
|
|
224
224
|
stored = read_credentials(config_dir=config_dir)
|
|
225
225
|
except LoginError:
|
|
226
226
|
stored = None
|
|
227
227
|
if stored is not None:
|
|
228
|
-
return
|
|
229
|
-
return
|
|
228
|
+
return cloud_origin(stored.cloud_url)
|
|
229
|
+
return cloud_origin(DEFAULT_CLOUD_URL)
|
|
230
230
|
|
|
231
231
|
|
|
232
232
|
class PublicCatalogClient:
|
|
233
233
|
"""One bounded anonymous call to Cloud's public catalogue HTTP API."""
|
|
234
234
|
|
|
235
235
|
def __init__(self, origin: str, *, transport: Transport | None = None) -> None:
|
|
236
|
-
self._origin =
|
|
236
|
+
self._origin = cloud_origin(origin)
|
|
237
237
|
self._transport = transport or UrlLibTransport()
|
|
238
238
|
|
|
239
239
|
@property
|
|
@@ -290,6 +290,11 @@ class PublicCatalogClient:
|
|
|
290
290
|
if relayed is not None:
|
|
291
291
|
relayed.body = parsed # type: ignore[attr-defined]
|
|
292
292
|
raise relayed
|
|
293
|
+
if status == 429:
|
|
294
|
+
# The rate-limit code every Cloud route gives, with Cloud's retry-after.
|
|
295
|
+
limited = cloud_refusal(status, parsed, act=act, headers=response_headers)
|
|
296
|
+
limited.body = parsed # type: ignore[attr-defined]
|
|
297
|
+
raise limited
|
|
293
298
|
if not isinstance(parsed, dict):
|
|
294
299
|
raise ThinLaneError(
|
|
295
300
|
"THIN_CLOUD_REFUSED",
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_search.py
RENAMED
|
@@ -235,6 +235,8 @@ def search_exit_code(payload: dict[str, Any]) -> int:
|
|
|
235
235
|
readiness = payload.get("readiness")
|
|
236
236
|
if isinstance(readiness, dict) and readiness.get("preparation_state") != "ready":
|
|
237
237
|
return 1 if readiness.get("reason") in {"failed", "cancelled"} else 3
|
|
238
|
+
if isinstance(readiness, dict) and readiness.get("package_state") not in {None, "ready"}:
|
|
239
|
+
return 1 if readiness.get("package_state") == "unavailable" else 3
|
|
238
240
|
if result.get("status") in {"ambiguous", "clarification_required"}:
|
|
239
241
|
return 4
|
|
240
242
|
if result.get("status") in {
|
|
@@ -665,11 +667,20 @@ def _public_search(public_table_id: str, public: Any) -> dict[str, Any]:
|
|
|
665
667
|
table = body.get("table") if isinstance(body, dict) else None
|
|
666
668
|
capabilities = table.get("capabilities") if isinstance(table, dict) else None
|
|
667
669
|
search = capabilities.get("search") if isinstance(capabilities, dict) else None
|
|
668
|
-
if not isinstance(search, dict)
|
|
670
|
+
if not isinstance(search, dict):
|
|
669
671
|
raise ThinLaneError(
|
|
670
672
|
"THIN_SEARCH_CAPABILITY_UNAVAILABLE",
|
|
671
673
|
"this table is not published with search; live search runs only on public tables",
|
|
672
674
|
)
|
|
675
|
+
if not isinstance(search.get("spec_digest"), str):
|
|
676
|
+
# A revision activated after publication: ranked search serves it, the query route
|
|
677
|
+
# checks only the published spec.
|
|
678
|
+
raise ThinLaneError(
|
|
679
|
+
"THIN_SEARCH_CAPABILITY_UNAVAILABLE",
|
|
680
|
+
"this table's search is served by ranked search (mr-data search query, or the MCP "
|
|
681
|
+
"tool search_table). Search through the query route needs the spec published with "
|
|
682
|
+
"the table, and this table was published without one",
|
|
683
|
+
)
|
|
673
684
|
return search
|
|
674
685
|
|
|
675
686
|
|
|
@@ -1867,5 +1878,19 @@ def search(
|
|
|
1867
1878
|
)
|
|
1868
1879
|
_check_table_answer(answer, table_id, body, wanted_schemas)
|
|
1869
1880
|
if verb == "status":
|
|
1870
|
-
|
|
1881
|
+
readiness = _readiness(answer)
|
|
1882
|
+
payload = _payload(verb, answer, readiness=readiness)
|
|
1883
|
+
# preparation_state covers the generation only. A ready generation whose package
|
|
1884
|
+
# failed or is still building does not serve, so the headline names the package.
|
|
1885
|
+
if readiness["preparation_state"] == "ready" and readiness["package_state"] not in {
|
|
1886
|
+
None,
|
|
1887
|
+
"ready",
|
|
1888
|
+
}:
|
|
1889
|
+
said = readiness["package_reason"] or readiness["package_state"]
|
|
1890
|
+
planner = _planner_line(answer)
|
|
1891
|
+
# A building package may leave the previous version's package serving.
|
|
1892
|
+
payload["headline"] = f"This version's search package is {said}." + (
|
|
1893
|
+
f" {planner}" if planner else ""
|
|
1894
|
+
)
|
|
1895
|
+
return payload
|
|
1871
1896
|
return _payload(verb, answer)
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/cloud_auth.py
RENAMED
|
@@ -16,7 +16,7 @@ from collections.abc import Callable, Mapping
|
|
|
16
16
|
from dataclasses import dataclass
|
|
17
17
|
from typing import Any, Final
|
|
18
18
|
|
|
19
|
-
from mostlyright.data_harness.thin.transport import _NoRedirect
|
|
19
|
+
from mostlyright.data_harness.thin.transport import _NoRedirect, is_loopback_ip
|
|
20
20
|
from mostlyright.data_harness.thin.user_agent import agent_headers, with_user_agent
|
|
21
21
|
|
|
22
22
|
REQUEST_TIMEOUT_SECONDS: Final = 10.0
|
|
@@ -139,7 +139,7 @@ class _ObjectPairs(list[tuple[str, Any]]):
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
class CloudAuthClient:
|
|
142
|
-
"""The exact v1 current/list/delete contract, over direct HTTPS only."""
|
|
142
|
+
"""The exact v1 current/list/delete contract, over direct HTTPS or loopback HTTP only."""
|
|
143
143
|
|
|
144
144
|
def __init__(
|
|
145
145
|
self,
|
|
@@ -265,11 +265,14 @@ class CloudAuthClient:
|
|
|
265
265
|
|
|
266
266
|
|
|
267
267
|
def _validated_base_url(value: str) -> str:
|
|
268
|
-
if not isinstance(value, str) or len(value) > 2048:
|
|
268
|
+
if not isinstance(value, str) or len(value) > 2048 or value != value.strip():
|
|
269
269
|
raise CloudAuthError("CLOUD_AUTH_URL_INVALID", "Cloud URL is invalid")
|
|
270
270
|
parsed = urllib.parse.urlsplit(value)
|
|
271
271
|
if (
|
|
272
|
-
|
|
272
|
+
not (
|
|
273
|
+
parsed.scheme == "https"
|
|
274
|
+
or (parsed.scheme == "http" and is_loopback_ip(parsed.hostname))
|
|
275
|
+
)
|
|
273
276
|
or not parsed.hostname
|
|
274
277
|
or parsed.username is not None
|
|
275
278
|
or parsed.password is not None
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/login.py
RENAMED
|
@@ -47,7 +47,7 @@ from urllib.request import (
|
|
|
47
47
|
|
|
48
48
|
from mostlyright.data_harness.canonical import CanonicalJSONError, parse_foreign_json
|
|
49
49
|
from mostlyright.data_harness.key_seam import LEGACY_API_KEY_ENV
|
|
50
|
-
from mostlyright.data_harness.thin.transport import _NoRedirect
|
|
50
|
+
from mostlyright.data_harness.thin.transport import _NoRedirect, is_loopback_ip
|
|
51
51
|
from mostlyright.data_harness.thin.user_agent import agent_headers
|
|
52
52
|
from mostlyright.data_harness.ux.cloud_auth import CloudAuthClient, CloudAuthError
|
|
53
53
|
from mostlyright.data_harness.ux.credential_store import (
|
|
@@ -219,7 +219,7 @@ class UrlLibDeviceFlowTransport:
|
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
def _https_url(value: str, label: str) -> str:
|
|
222
|
-
"""Return ``value`` when it is a plain absolute https URL,
|
|
222
|
+
"""Return ``value`` when it is a plain absolute https URL, or http on a loopback IP.
|
|
223
223
|
|
|
224
224
|
Its own copy because a bad URL here is a ``LoginError``, not the transport's ``ThinLaneError``.
|
|
225
225
|
"""
|
|
@@ -228,18 +228,30 @@ def _https_url(value: str, label: str) -> str:
|
|
|
228
228
|
raise LoginError("LOGIN_CONFIG_INVALID", f"{label} is not a usable URL")
|
|
229
229
|
if value.endswith("/"):
|
|
230
230
|
raise LoginError("LOGIN_CONFIG_INVALID", f"{label} must not end with a slash")
|
|
231
|
-
|
|
231
|
+
refusal = LoginError(
|
|
232
|
+
"LOGIN_CONFIG_INVALID",
|
|
233
|
+
f"{label} must be an absolute https URL without user information, query or fragment",
|
|
234
|
+
)
|
|
235
|
+
if value != value.strip():
|
|
236
|
+
raise refusal
|
|
237
|
+
try:
|
|
238
|
+
parsed = urlsplit(value)
|
|
239
|
+
_ = parsed.port
|
|
240
|
+
except ValueError:
|
|
241
|
+
raise refusal from None
|
|
232
242
|
if (
|
|
233
|
-
|
|
243
|
+
not (
|
|
244
|
+
parsed.scheme == "https"
|
|
245
|
+
or (parsed.scheme == "http" and is_loopback_ip(parsed.hostname))
|
|
246
|
+
)
|
|
234
247
|
or not parsed.hostname
|
|
248
|
+
or parsed.netloc.endswith(":")
|
|
235
249
|
or parsed.username is not None
|
|
236
250
|
or parsed.password is not None
|
|
251
|
+
or parsed.query
|
|
237
252
|
or parsed.fragment
|
|
238
253
|
):
|
|
239
|
-
raise
|
|
240
|
-
"LOGIN_CONFIG_INVALID",
|
|
241
|
-
f"{label} must be an absolute https URL without user information or fragment",
|
|
242
|
-
)
|
|
254
|
+
raise refusal
|
|
243
255
|
return value
|
|
244
256
|
|
|
245
257
|
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/remediation.py
RENAMED
|
@@ -11,7 +11,7 @@ neither affordable nor honest:
|
|
|
11
11
|
* **Families.** Every code prefix is assigned to a family -- 223 of them, plus 20 compound
|
|
12
12
|
prefixes, across 38 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
|
|
14
|
+
* **Curated codes.** The 122 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:
|
|
@@ -1733,7 +1733,8 @@ CODES: dict[str, Remediation] = {
|
|
|
1733
1733
|
lines=(
|
|
1734
1734
|
"The address this command was pointed at is not a usable one.",
|
|
1735
1735
|
"Check MOSTLYRIGHT_CLOUD_URL: it has to be a plain https address with nothing else "
|
|
1736
|
-
"in it -- no user name, no trailing slash, no fragment."
|
|
1736
|
+
"in it -- no user name, no trailing slash, no query, no fragment. Plain http works "
|
|
1737
|
+
"only for a loopback IP address such as http://127.0.0.1:4545, not the name localhost.",
|
|
1737
1738
|
),
|
|
1738
1739
|
),
|
|
1739
1740
|
"LOGIN_TRANSPORT_FAILED": Remediation(
|
|
@@ -2307,6 +2308,12 @@ CODES: dict[str, Remediation] = {
|
|
|
2307
2308
|
"files it already verified.",
|
|
2308
2309
|
),
|
|
2309
2310
|
),
|
|
2311
|
+
"THIN_RATE_LIMITED": Remediation(
|
|
2312
|
+
lines=(
|
|
2313
|
+
"Mostly Right Cloud asked this command to slow down. Nothing was changed.",
|
|
2314
|
+
"Wait the retry_after_seconds the message names, then run the command again.",
|
|
2315
|
+
),
|
|
2316
|
+
),
|
|
2310
2317
|
"THIN_DATA_EGRESS_THROUGH_CLOUD": Remediation(
|
|
2311
2318
|
lines=(
|
|
2312
2319
|
"The server hands data to mr-data only through Mostly Right Cloud's metered routes.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/agents/openai.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/boundaries.md
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/commands.md
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/live-run.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/one-install.md
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/patterns.md
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/promote.md
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/readers.md
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/receipts.md
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/recipe-test.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/sources.md
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/skills/mr-data-build/references/transforms.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/__init__.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/agent_protocol.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/canonical.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/key_seam.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/page_coverage.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/session_probes.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/skill_assets.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/table_manifest.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/__init__.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/activity.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/backoff.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/delivery.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/download.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/probe.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/recipe.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/research.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/router.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/runs.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/stream.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/support.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_query.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_reader.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_runs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_stream.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/thin/v4_tables.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/__init__.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/attendance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/credentials.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/path_kind.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/plain_file.py
RENAMED
|
File without changes
|
{mostlyright_data-0.31.20 → mostlyright_data-0.31.22}/src/mostlyright/data_harness/ux/render.py
RENAMED
|
File without changes
|