Repository navigation
feat(clirequest): carry the child's working directory (unit 1 of #819) - #290
Conversation
`#CliRequest` gains `dir?: string` — the working directory for the `charly <argv>` child the host runs. Empty inherits the caller's cwd, which is what every caller gets today, so the field is additive and opt-in. Why it exists. "The current project" is not a stable referent in this codebase: a consumer that shells out on behalf of an IMPORTED project needs the child to read THAT project while its own process cwd is the importer's. Measured on opencharly/charly#819: a `kind: local` bed invoked QUALIFIED (`charly.check-task` from the umbrella) ran `${CHARLY_BIN} task list` in the umbrella and asserted against the umbrella's task list, so the check passed vacuously instead of testing the bed's own project. There was no way to ask for the other directory, because the wire type carried none. Generated, never hand-written: `charly task cue-gen` produced `spec/cue_types_gen.go`'s `Dir` field from this CUE edit, and the task's own reproducibility check passed on the committed tree. This is unit 1 of the opencharly/charly#819 cutover. Unit 2 makes the host's cli seam honour the field; unit 3 sets it from `spec.UnifiedFile.BedScope(entity).RootDir` in plugin-check. The tracking issue stays open until the last unit lands and the qualified bed goes green. Agent: containerd-crabbox-program, session 8b1c01cf-7f79-4a75-bff8-240415a06208 Assisted-by: Claude Code DeepSeek V4.1 Flash (fully tested and validated)
Review — PASSHead SHA: Change class: schema/wire-contract (additive), Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…1104) `runCliSubcommand` now sets `cmd.Dir` from `spec.CliRequest.Dir` when the caller supplies one. Empty inherits this process's cwd, so every existing caller is byte-identical in behaviour. Why. A caller that runs a subcommand on behalf of an IMPORTED project must have the child read THAT project, while the caller's own process stands in the importer's. Measured on #819: a `kind: local` bed invoked QUALIFIED (`charly.check-task` from the umbrella) ran `${CHARLY_BIN} task list` against the umbrella and its assertion passed vacuously instead of testing the bed's own project. The wire type could not carry the directory, so this could not be fixed below the host seam — opencharly/spec#290 added the field (tag v0.2026307.1209). Also bumps the spec pin v0.2026302.327 -> v0.2026307.1209 in the four modules that pin it together (charly + the three tool modules the lockstep rule binds: tools/generate-packages, tools/golden-cloudinit, tools/golden-compile). `go mod tidy` also dropped five stale `// indirect` entries from tools/golden-cloudinit, because the new spec no longer requires them at that module's level; they are generated, never hand-edited. Coverage. TestRunCliSubcommandHonoursRequestDir drives the shipped function with a /bin/sh helper that prints `pwd -P`: with `Dir` set the child reports that directory, and with `Dir` empty it reports the caller's. Mutating out the `cmd.Dir` assignment turns it red — `child cwd = "…", want the request's Dir "…" — the child inherited the caller's cwd`. This is unit 2 of three. Unit 3 sets the field from `spec.UnifiedFile.BedScope(entity).RootDir` in plugin-check; the tracking issue stays open until the qualified bed goes green. Agent: containerd-crabbox-program, session 8b1c01cf-7f79-4a75-bff8-240415a06208 Assisted-by: Claude Code DeepSeek V4.1 Flash (fully tested and validated) Co-authored-by: Andreas Trawoeger <[email protected]>
Summary
Head
5dea399fc393d4ad922934ece491133870847fee— 2 files, +23 lines, no deletions.#CliRequestgains one optional field:diris the working directory for thecharly <argv>child the host runs on a plugin's behalf. Empty inherits the caller's cwd — which is what every caller gets today — so the field is additive and opt-in.Why it has to exist. "The current project" is not a stable referent in this codebase. A consumer that shells out on behalf of an imported project needs the child to read that project, while its own process cwd is the importer's. Measured on opencharly/charly#819:
The bed is declared in the charly repo; invoked qualified from the umbrella, its
${CHARLY_BIN} task liststep read the umbrella's project, so the assertion passed vacuously instead of testing the bed's own project. There was no way to ask for the other directory, because the wire type carried none —#CliRequesthadargv,capture,combined,best_effort,envand nothing else.Generated, never hand-written.
charly task cue-genproduced the Go field from this CUE edit:This is unit 1 of a tracked three-repo cutover
opencharly/charly#819is the tracking issue and stays open until the last unit lands:spec— this PR.#CliRequestcarries the directory. (landed here)plugin-check— set it fromspec.UnifiedFile.BedScope(entity).RootDir, applied to the bed's step requests, whilebedSetupkeeps the root project for bed resolution.That split is deliberate and it is not scope-shrinking: an earlier attempt to do unit 3 alone, by passing the namespace root into
bedSetup, was disproved by a live run —"charly.check-task" is not a disposable check bed— becausebedSetup'sdirserves both resolution and the run's project dir. The wire type is the head of the chain because nothing downstream can carry the directory until it does.No consumer in this PR, stated plainly. The field is inert until unit 2. It is optional, so no existing caller changes behaviour, and
TestGenReproducibleplus the full suite confirm nothing else moved.How tested
The reproducibility step is the one that matters for an SDD change: the generated file is a projection of the schema, and a second generation is a no-op.
Rulebook compliance
/charly-internals:goand/charly-internals:plugin(the schema/plugin rows the dispatcher selects forspec/schema/*.cue)main; no force-push, no bypass;spechad no open PR before this onecue-gen's reproducibility check + the full suite); the field's effect is unit 2/3 and is not claimed herecuethe task provisionscharly task cue-gen+ the module's tests; both pastedgofmt -l spec/empty;go vet ./...rc=0#CliRequestcontract inspec, which is where wire shapes liveSTATUSon#819naming the order; no contended scopeChange classification
Wire contract, additive. One optional field on
#CliRequest. Breaking change + rollback: none — optional, absent means today's behaviour; rollback is reverting the two files.Filed issues
opencharly/charly#819 is the tracking issue for this cutover and stays open until unit 3 lands and the qualified bed goes green.
Agent:
containerd-crabbox-program· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code DeepSeek V4.1 Flash (fully tested and validated)