^R D3: migrate scripts/workcell runtime/gc invariants from verify-invariants.sh to Go#401
Merged
Merged
Conversation
Re-implement the contiguous block of ten scripts/workcell runtime/gc invariant checks (trusted Docker client seed, DOCKER_CONFIG-not-pinned guard, buildx_cmd invocation, the runtime_build_codex_arch musl/gnu release-asset guard, the hidden self-docker/self-staging probes, the --gc runtime-image/temp cleanup pair, the strict-mode rebuild rejection, and the two go_colimautil validators) as CheckRuntimeInvariants in internal/workcellhardening, reusing the shared evaluate() driver and the existing check kinds. Add a kindFunctionBlockAbsent kind for the negated sub-condition of the runtime_build_codex_arch guard (a gnu asset present inside the block is a violation): the shell joined two affirmative function_block_contains_fixed probes with one negated probe under a single message, expressed here as two kindFunctionBlock checks plus one kindFunctionBlockAbsent check sharing that message. Every rg pattern in the block is metacharacter-free after unescaping, so each reduces to fixed-string containment. Expose it through a new workcell-citools workcell-runtime-invariants ROOT_DIR subcommand (inert until verify-invariants.sh is wired to it). Table-driven tests cover the happy path plus one failing fixture per check, including the musl group (missing musl arch and a gnu asset inside the block both fail; a gnu asset outside the block does not) and the DOCKER_CONFIG pin. (byte-identical parity proven vs the shell on the real repo and crafted violations, full go test + vet + gofmt green; primary D3 check-group migration) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the inline block of ten scripts/workcell runtime/gc invariant
checks (between the SSH-collision check and the start_managed_profile
mount function-block group) with a single go_verify_citools
workcell-runtime-invariants "${ROOT_DIR}" || exit 1 call plus a D3
comment. The || exit 1 preserves the former block's exit-1-on-violation
so the top-level ERR trap does not fire and append trap diagnostics, and
go_verify_citools already strips go run's exit-status trailer, keeping
the failure stderr byte-identical to the originals.
(shellcheck -x / shfmt / bash -n green, byte-identical parity proven on
happy and crafted-violation paths; supporting shell wiring for the D3
migration above)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… (the migrated 'strict mode requires --prepare ... --rebuild.' check used fixed-string containment, but rg treats the trailing . as any char; added a kindRegexPresent kind - symmetric with kindRegexAbsent - and switched that one check to it, so it matches exactly what rg -q would; every other pattern in the block stays fixed-string) (go test/shellcheck green, parity-exact; supporting D3 migration fidelity)
Owner
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
D3 (migrate verify-invariants.sh to Go) — increment 4 of N. Follows #398/#399/#400. Migrates the 10
scripts/workcellruntime/gc invariant checks (trusted-docker-client seed, DOCKER_CONFIG, buildx, theruntime_build_codex_archmusl-arch group, the self-docker/staging probes, the--gccleanup pair, strict-mode-rebuild rejection, and the twogo_colimautilvalidators).What
internal/workcellhardening: newCheckRuntimeInvariants(rootDir)reusing the sharedevaluate()+ existing kinds. Adds two kinds:kindFunctionBlockAbsent(for the negatedruntime_build_codex_archsub-condition —unknown-linux-gnupresent inside the block is a violation) andkindRegexPresent(symmetric withkindRegexAbsent).cmd/workcell-citools: newworkcell-runtime-invariantssubcommand.scripts/verify-invariants.sh: block replaced bygo_verify_citools workcell-runtime-invariants "${ROOT_DIR}" || exit 1at the same location.Parity (identical pass/fail)
The
runtime_build_codex_archgroup (2 present + 1 negated function-block probe under one message) is expressed as ordered checks sharing that message — a test provesunknown-linux-gnuinside the block fails while outside the block passes (scoping guard). The strict-mode--rebuild.pattern is matched as a regex (rgtreats the trailing.as any-char); every other pattern is metachar-free after unescaping → fixed-string. Verified: real repo → exit 0; crafted violations (DOCKER_CONFIG pinned, buildx removed, gnu-in-block) → exit 1 byte-identical.Validation
go build/vet/gofmt, fullgo test ./...(table-driven, fixture per check + scoping guard),shellcheck -x,shfmt -d— all green. 4 files.🤖 Generated with Claude Code