Skip to content

feat(clirequest): carry the child's working directory (unit 1 of #819) - #290

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/clirequest-dir
Nov 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/clirequest-dir

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Head 5dea399fc393d4ad922934ece491133870847fee — 2 files, +23 lines, no deletions. #CliRequest gains one optional field:

// #CliRequest (schema/seam.cue)
dir?: string @go(Dir)

dir is the working directory for the charly <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:

$ ./charly/bin/charly check run charly.check-task      # from the umbrella
  FAIL … charly task list enumerates the declared tasks … [task-list-declared]
       stdout: expected to contain "check-task-smoke"
       (got: hooks, map, org-map, pins, policy-b, prune, self-test, skills, sync, verify)

The bed is declared in the charly repo; invoked qualified from the umbrella, its ${CHARLY_BIN} task list step 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 — #CliRequest had argv, capture, combined, best_effort, env and nothing else.

Generated, never hand-written. charly task cue-gen produced the Go field from this CUE edit:

// spec/cue_types_gen.go
Dir string `yaml:"dir,omitempty" json:"dir,omitempty"`

This is unit 1 of a tracked three-repo cutover

opencharly/charly#819 is the tracking issue and stays open until the last unit lands:

  1. spec — this PR. #CliRequest carries the directory. (landed here)
  2. the host cli seam — honour it when running the child (today it has nowhere to put it).
  3. plugin-check — set it from spec.UnifiedFile.BedScope(entity).RootDir, applied to the bed's step requests, while bedSetup keeps 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 — because bedSetup's dir serves 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 TestGenReproducible plus the full suite confirm nothing else moved.

How tested

$ charly task cue-gen
task wire-gen: 1 step(s), 0 failed, 0 skipped
task cue-gen: 2 step(s), 0 failed, 0 skipped
  [pass] run — gengotypes + schemagen the generated Go
  [pass] check — regen is reproducible — TestGenReproducible passes on the committed tree

$ go build ./...     rc=0
$ go vet ./...       rc=0
$ gofmt -l spec/     (empty)
$ go test ./...
26 packages ok, 0 FAIL                             rc=0

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

rule how, or N/A and why
R0 /charly-internals:go and /charly-internals:plugin (the schema/plugin rows the dispatcher selects for spec/schema/*.cue)
R1 no anomaly; the generator and the suite both report zero failures
R2 one wire type; the field is added to the existing envelope, not a parallel one
R3 no workaround — the defect is fixed at the layer that owns the data
R4 product before prose: the schema, not a doc
R5 nothing retired
R6 fresh branch off main; no force-push, no bypass; spec had no open PR before this one
R7 the generated artifact is verified at its boundary (cue-gen's reproducibility check + the full suite); the field's effect is unit 2/3 and is not claimed here
R8 N/A — no live service
R9 N/A for a schema module (no binary); the generator is the pinned, checksum-verified cue the task provisions
R10 the gate that owns a schema change is charly task cue-gen + the module's tests; both pasted
DISP N/A
QUAL gofmt -l spec/ empty; go vet ./... rc=0
PIL/ADE/SDD SDD: CUE first, Go generated, clean regeneration proven
ARCH the field belongs on the existing #CliRequest contract in spec, which is where wire shapes live
CONC N/A
HC unit 1 of a declared three-unit decomposition of one contract; the tracking issue stays open
COORD STATUS on #819 naming the order; no contended scope

Change 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 · session 8b1c01cf-7f79-4a75-bff8-240415a06208
Assisted-by: Claude Code DeepSeek V4.1 Flash (fully tested and validated)

`#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)
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 5dea399fc393d4ad922934ece491133870847fee (branch: feat/clirequest-dir)

Change class: schema/wire-contract (additive), spec module.
Security screen: PASS — no secrets, no egress, no guardrail weakening, no injected directives; PR content treated as data.
Checklist: All applicable rules PASS or NA. SDD satisfied (schema + generated *_gen.go changed in the same commit, no hand-edit drift, @go(Dir) legal, TestGenReproducible guards the invariant). A1/A3 body complete; footer in correct form; tier consistent with a schema-only, inert-until-unit-2 field whose applicable gate (cue-gen + suite) ran green with pasted output. R1 no surviving warning; R5 nothing retired; HC is per-repo — this spec cutover is atomic and complete, downstream units are separate repos' scopes with a filed tracking issue (#819).
ARCH placement: CORRECT — a wire shape on #CliRequest belongs in spec, not core/sdk/candy.
Comment thread: empty (0 comments) — nothing to disposition.
Tool-limited: cannot re-verify the model name in the Assisted-by: footer or re-run cue-gen; the pasted output is internally consistent with the 2-file, +23/-0 diff.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 3, 2026 12:09
@github-actions
github-actions Bot merged commit 62c31d6 into main Nov 3, 2026
4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 3, 2026
github-actions Bot pushed a commit to opencharly/charly that referenced this pull request Nov 3, 2026
…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]>
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.

2 participants