Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

sandbox-run

БесплатноБез исполняемых скриптовНе проверен

Run a BigQuery sandbox to validate pipeline or view changes before merge. Picks between load_end_to_end_data_sandbox (ingest, normalization or pipeline…

Recidivizот Recidiviz★ 48 звёзд на GitHub

Об этом скилле

Skill: Run Sandbox

Overview

Two tools build BigQuery sandboxes from a branch's code:

  • load_views_to_sandbox rebuilds BigQuery views only. Minutes to an hour.
  • load_end_to_end_data_sandbox rebuilds the Dataflow pipelines (ingest, metrics, supplemental) for one state, then the views on top of them. 1-3 hours.

It covers four jobs: choosing between the tools, a views-only load, an unattended end-to-end run, and loading views on top of an end-to-end run's outputs. Comparing the results with compare_views is an optional last step.

By default, hand the user the command to run themselves; the tools consume shared compute. When the user asks Claude to run an end-to-end sandbox, use --unattended (below). Never pipe yes into either tool: after launching each Dataflow pipeline the end-to-end tool asks "Has it completed?", and answering before the job finishes starts the next stage on unfinished data.

Which mode

Neither tool decides this. Classify the branch's diff:

git diff --name-only $(git merge-base HEAD origin/main)
Any changed file under Mode Why
recidiviz/ingest/direct/regions/*/ingest_views/, .../ingest_mappings/, .../raw_data/, recidiviz/pipelines/, recidiviz/persistence/entity/, or a normalization delegate under recidiviz/pipelines/utils/state_utils/ End-to-end These change normalized_state or the Dataflow outputs; a views-only load would read the stale deployed versions. Ingest views read raw tables through the raw_data/ configs' primary keys, columns and ordering, so a raw config edit counts unless it only changes descriptions
Anything else (view SQL, view builders, Python constants that feed SQL) Views-only auto The pipelines are unaffected

Three situations change that answer:

Situation Mode
No uncommitted code to measure; comparing deployed datasets No sandbox. Query staging or prod. Staging deploys ahead of prod, so say which project a number came from.
The pipeline change is already in the last staging deploy Views-only against staging; its normalized_state is already correct. The rebase pre-flight below shows the deployed version.
Iterating on views while an end-to-end run's tables last (24 hours from when each was created, so count from its ingest stage) Views-only reading that run's outputs. See "Views off an end-to-end sandbox".

Present this as a recommendation: say which rule fired and which files triggered it, and let the user pick the other tool if they prefer, for example views-only for speed, knowing the views read the deployed pipeline outputs.

Pre-flight (both tools)

  1. Credentials: gcloud auth login --update-adc. Both tools exit with that message when ADC has expired. If the views to load read Google Sheets (TN's validation_views.us_tn_loopback_* and analyst_data.workflows_live_completion_event_types_by_state do), use gcloud auth login --enable-gdrive-access --update-adc instead, or those views fail with a Drive permission error.
  2. Dataflow access, end-to-end only. Seeing Dataflow jobs needs the dataflow.jobs.list and dataflow.jobs.get permissions on the project; launching them does not, so a run without them launches jobs nobody can then follow. This read-only command fails with Permission 'dataflow.jobs.list' denied without them:
    gcloud dataflow jobs list --project=recidiviz-staging --limit=1
    
    If it fails, ask the Data Platform team for access. --unattended runs the same check before it starts and stops without it.
  3. End-to-end only: git config user.name is set. It names the Dataflow image, dataflow-dev/{name lowercased, no spaces}/build:latest, one per person.
  4. Rebase. auto mode and the end-to-end tool exit 1, with no prompt, unless the branch contains the commit of the last successful staging view update:
    uv run python -m recidiviz.tools.deploy.print_latest_view_update_version --project_id recidiviz-staging
    
    Staging deploys during the day, so a branch cut in the morning can fail this after an afternoon deploy. Rebasing onto main's tip fixes it, but everything merged since the deploy then counts as changed and loads too; rebasing onto the deployed commit itself keeps the sandbox to your changes. This command only reads. The tools' own rebase check also runs git fetch --all --tags --prune --prune-tags --force, which deletes local tags that are not on the remote. Worktrees share one repository's refs, so two runs fetching at once can fail one of them with cannot lock ref; see "Launch order" below.
  5. Prefix: {username}{MMDDYY}{xx}, where xx is a short tag of your choosing, conventionally the state's two letters plus a letter per run when there is more than one (agaidus100526nd, agaidus100726oza). A us_xx token in the prefix (agaidus_us_nd) is different: it must match the state filter. The end-t
Полный SKILL.md на GitHub

Установить sandbox-run в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл sandbox-run?

Run a BigQuery sandbox to validate pipeline or view changes before merge. Picks between load_end_to_end_data_sandbox (ingest, normalization or pipeline changes) and load_views_to_sandbox (view-only changes), builds the command with the right flag order, runs an end-to-end sandbox unattended with --unattended, chains view-only loads off an end-to-end sandbox's outputs, and diffs results with compare_views. Use when the user mentions a sandbox, says "load views to sandbox", "load my views to a sandbox", "end-to-end sandbox", "load_views_to_sandbox", "load_end_to_end_data_sandbox", "test this view change against real data", "validate my ingest change", "which sandbox tool should I use", "did every view get loaded", "compare sandbox output", or "compare my sandbox view output to what's deployed".

Как установить скилл sandbox-run?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл sandbox-run запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить sandbox-run с