Skip to content

^R D4: extract host-detection into scripts/lib/launcher/host-detect.sh + launcher-contract.md#394

Merged
omkhar merged 3 commits into
mainfrom
d4/launcher-host-detect
Jul 5, 2026
Merged

^R D4: extract host-detection into scripts/lib/launcher/host-detect.sh + launcher-contract.md#394
omkhar merged 3 commits into
mainfrom
d4/launcher-host-detect

Conversation

@omkhar

@omkhar omkhar commented Jul 5, 2026

Copy link
Copy Markdown
Owner

D4 (modularize the launcher) — increment 1 of N. scripts/workcell is a 9046-line monolith; D4 splits it into sourced scripts/lib/launcher/ modules with a docs/launcher-contract.md. Each increment is behavior-preserving and small enough to fit the PR-shape limit (moving code counts as delete+add, so this is inherently multi-PR).

What

  • New module scripts/lib/launcher/host-detect.sh: the 5 host-detection functions (support_matrix_host_override_allowed, detected_host_os/_arch/_distro/_distro_version) moved verbatim (byte-identical) from scripts/workcell, with the standard lib header. They're self-contained (only uname/ps/env) and first called far after the source point, so sourcing the module in the existing scripts/lib/*.sh block preserves definition order.
  • scripts/workcell: 116-line deletion + one source …/host-detect.sh line.
  • Registered the module in the shell_files gates (validate-repo.sh, dev-quick-check.sh); regenerated the control-plane manifest.
  • New docs/launcher-contract.md with the host-detection section (function contracts + the WORKCELL_TEST_SUPPORT_MATRIX_HOST_* harness overrides); grows as more modules land.

Behavior-preserving

Pure move, zero logic change — the extracted functions are byte-identical to the originals, and sourcing + calling the module returns the same values.

Validation

shellcheck -x, shfmt -d, bash -n scripts/workcell, control-plane manifest verify, markdownlint, and a source-and-call output-equality check — all green. 330 lines / 7 files. (Full container scenario suite runs in CI.)

🤖 Generated with Claude Code

omkhar and others added 2 commits July 5, 2026 13:59
…yte-identical move, shellcheck/shfmt/bash-n/manifest green and outputs verified equal; launcher is user-visible but behavior is unchanged)

First increment of roadmap item D4 (modularize the launcher). Moves the
five host-detection helpers verbatim out of scripts/workcell into a new
sourced module scripts/lib/launcher/host-detect.sh:

- support_matrix_host_override_allowed
- detected_host_os
- detected_host_arch
- detected_host_distro
- detected_host_distro_version

The functions are self-contained (uname/ps/PPID/env vars and each other
only) and are sourced before their first call site alongside the other
scripts/lib modules. Registers the new file in the validate-repo.sh and
dev-quick-check.sh shell gates and regenerates the control-plane manifest
hash for scripts/workcell. No logic change; the extracted block is
byte-identical to the original.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… code execution impact; supporting documentation for the D4 refactor)

New contract doc for the launcher decomposition (roadmap item D4). This
first increment documents the host-detection module: what each of the
five functions returns, the WORKCELL_TEST_SUPPORT_MATRIX_HOST_* harness-
only overrides gated by support_matrix_host_override_allowed, and that
values are emitted lowercased and normalized. Links the doc from its
existing mention in the D4 section of the improvement-tracks plan. The
doc will grow as more launcher modules are extracted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@omkhar

omkhar commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94feadb157

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/workcell
…(the extracted scripts/lib/launcher/host-detect.sh is now sourced launcher code, but GenerateControlPlaneManifest in internal/metadatautil/core.go only listed scripts/workcell + the older lib helpers, so the new module was outside the signed/provenance-verified manifest and host-detection changes wouldn't be caught; add it to hostArtifacts and regenerate control-plane-manifest.json) (manifest verify + go test green; supporting the D4 host-detect extraction - closes the provenance gap the move opened)
@omkhar

omkhar commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Fixed: added scripts/lib/launcher/host-detect.sh to the hostArtifacts list in internal/metadatautil/core.go's GenerateControlPlaneManifest and regenerated the manifest, so the extracted module is now inside the signed/provenance-verified control-plane manifest (a host-detection change is now caught). manifest verify + go test ./internal/metadatautil green.

@omkhar

omkhar commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 8c5c6b5a71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant