feat(dev): select env mode and job layer in datahub-dev Docker mode

DE
14h ago
+191-12

Stacked on #21821.

datahub-dev Docker mode now selects the env mode and job layer that the optional compose slots read.

  • _dev_env() exports DATAHUB_ENV_MODE (ci when CI is set, else local), using the same rule as the Docker-free launcher.
  • start --job smoke-test|playwright and --mode local|ci now work in Docker mode. They are recorded per worktree, and _dev_env() exports DATAHUB_ENV_JOB_DIR as an absolute path, so rebuild, env restart, reset and nuke reuse them. When no job is recorded, _dev_env() drops a DATAHUB_ENV_JOB_DIR inherited from the shell, so it cannot select a job layer by accident. The job folders and mode names come from the Docker-free launcher.
  • A remote start forwards --job and --mode to the remote runner.
  • env list in Docker mode prints layers: the env files that exist and that compose reads for GMS, lowest precedence first.
  • Docs in scripts/dev/README.md and scripts/dev/AGENTS.md.

A plain start renders the same config as before: docker compose config is byte-identical with DATAHUB_ENV_MODE unset and set to local.

Job values that compose environment: already sets do not take effect until they move to layer files, because environment: beats env_file.

Verification

  • ./gradlew :scripts:dev:test: 191 passed, 1 skipped.
  • A scratch job folder with an extra key in gms.env renders into the GMS service environment.

Checklist

  • Conforms to the Contributing Guideline and PR title format
  • Tests added
  • Docs updated
  • No breaking changes

šŸ¤– Generated with Claude Code


Summary by cubic

datahub-dev Docker mode now selects the env mode and job layer for the optional compose slots, matching the Docker-free launcher.

  • start --job smoke-test|playwright and --mode local|ci now work in Docker mode and on remote start, recorded per worktree so rebuild, env restart, reset and nuke reuse them.
  • _dev_env() exports DATAHUB_ENV_MODE (defaults to ci when CI is set, else local; an explicit --mode overrides it) and DATAHUB_ENV_JOB_DIR as an absolute path, dropping any stale inherited value when no job is recorded.
  • _dev_env() fails when the extension or job env folder does not exist, because compose lists them as required: false and would skip a typo silently.
  • --job/--mode choices come from the Docker-free launcher so the two modes stay in sync.
  • env list prints layers: the env files compose reads for GMS, lowest precedence first, including the extension folder when DATAHUB_ENV_EXTENSION_DIR is set.
  • A plain start keeps rendering the same config as before.
  • Job values already set by compose environment: keys do not apply until they move to layer files, because environment: overrides env_file.