Repository navigation
feat(file): the plan-space path grammar, and every authoring surface speaks it - #600
Merged
Merged
Conversation
…speaks it Phase 2, PR 2 of the resource-construction plan (#584) -- the co-landing the plan's sequencing constraint demanded: the grammar's semantics and the authoring surfaces flip together, because the moment a leading slash means "anchored at the run's root" every machine-absolute authored path double-prefixes and dies. The grammar (file.NormalizePlanSpacePath, applied at the planner's claiming seam through op.RegisterPlanPathNormalizer -- op stays generic, the file scheme owns its little language): foo/bar and /foo/bar name the same rel; volume, UNC, and backslash spellings are plan-time refusals; @name/... refuses as reserved for the named multi-root design (#597); escapes and the bare root refuse. One table pin covers every rule. Immediate-mode and programmatic construction are untouched -- the grammar governs what a plan may say, not what a session may do. devlore-test speaks plan space with one root everywhere: t.tmp returns rels (.devlore/tmp/<name>), t.run anchors at the same workspace root as the script session, and the harness's Go-side helpers resolve rels through one seam. writ's planners emit rels via deploy.PlanSpacePath against the run root writ already chooses; graph-origin annotations keep machine-absolute paths for the readback fold's keying. Process-cwd leaks fixed as discovered, each at its seam: shell.exec and powershell.exec anchor the command's cwd at the run's root (a planned command's relative paths mean the run's world, not wherever the host binary started); file.glob resolves relative patterns against the root; plan.save_definition and load_definition resolve relative document paths against the session root. The two remaining Windows baseline failures are fixed at their surfaces: the star integration fixture interpolates its path slash-form into generated starlark source (paths-in-text are neutral text -- the backslash escape failure), and lore's onboard manifest path uses a native join instead of string concatenation (the mixed-separator narration). Verified with make check (103 packages ok, 0 failures; the grammar pins and every scenario star green) and make vet under GOOS windows. Windows baseline expectation: 2 -> 0 -- the first fully green CI of the campaign; any remainder is re-diagnosed, not assumed. Refs #584, #547, #546, #597.
…its session
The first CI re-diagnosis of PR 2 -- two Windows names, neither what a green-except-Windows reading would
have assumed.
TestPlannedCopy_TheStoredCatalogIsInputIntent was the last unswept authoring surface: the Go judgment pin
interpolated machine-absolute paths into its star fixture, and the plan-space grammar refused them on
Windows exactly as designed ("carries a volume spelling"). The pin now authors plan-space rels -- no
interpolation at all, the same script text valid on every platform, and truer to the pin's own subject:
the session root is the run root, and the names resolve to the files the test writes.
TestSourceFile_StarlarkIntegration's escape failure was CURED by the slash-form interpolation fix -- the
residue was a Windows handle leak: the test never called the documented Application.Close, so the session
root (anchored at the Chdir'd temp dir) pinned the tree when TempDir cleanup ran. The established
t.Cleanup close pattern (the TestLintCopyright class) ends it.
Also chartered on #585 and recorded in the design (section 5.4) and the plan (phase-3 item 4): the graph's
intent rows drop the state field entirely -- the row becomes its own {id, uri} type and presence IS the
pending claim; state/etag/digest/producer stay trace vocabulary. The writer already forced Pending and the
reader ignored the field, so the ruling makes the document say exactly what the code means.
Verified with make check (103 packages ok, 0 failures), make vet under GOOS windows, gofmt clean. Windows
expectation stands: 2 -> 0.
Refs #584, #547, #585.
David-Noble-at-work
added a commit
that referenced
this pull request
Aug 21, 2026
…se 2 closes (#601) Phase 2, PR 3 of the resource-construction plan (#584) -- the activation binding the run-from-elsewhere ruling made load-bearing: a graph is planned or loaded in whatever environment happened to construct its resource objects, but every location fact about them belongs to the root the RUN binds. The executor's pre-flight resolve pass now re-bases every pending entry onto the run's environment and re-binds root-relative schemes rel-first through the new op.RootBinder seam: identity (the rel) is unchanged, the root becomes the run's, the native form derives. file.Resource implements BindRoot, and Resolve's abs-first rebind -- the documented inverse, which preserved the construction-time machine location -- flips rel-first. The verification consequence stays mark-don't-fail; phase 3 owns the transition-failure semantics. Pinned in both directions: a graph planned under root A and executed under root B verifies and observes under B. The trace records B as the binding; the claimed rel is Active when the file exists only under B (the plan root never held it), and Gone when it exists only under A (with the dispatch failing to find it). PR 1 made the identity payload relocatable; this PR makes the verification relocatable -- the two halves of "one graph, any machine." Phase 2 is complete: rel identity (#596), the plan-space grammar and authoring migration (#600), and the binding (this PR). The Windows CI leg went 28 known failures to zero during this phase and #547 closed; step 4's consumer sweep finished across the three PRs (readback in PR 1, providers already on the accessor, Resolve's rebind here). Closes #584. Verified with make check (103 packages ok, 0 failures) and make vet under GOOS windows. Windows expectation: green stays green. Refs #546, #585. Co-authored-by: David Noble <[email protected]>
David-Noble-at-work
added a commit
that referenced
this pull request
Aug 22, 2026
…ion (#607) The plan and design documents catch up with the campaign through phase 3 (#582-#585 delivered; #586-#587 remain). The plan (resource-construction.md): status in-progress; the phase-2/3 headings carry the merged PR numbers (#596/#600/#601; #602-#606); delivered markers on the docket's items 4/5, judgment scenario 1, and the fail-fast scenario; the directive-inventory rulings gain an execution-status note (the wire rename ran; the planner/struct_param/lifetime removals are chartered, not executed); the divergence table records which rows phases 0-3 resolved and which are phase 4's subject; phase 5's already-satisfied items are marked. 4-resource-management.md: the header's staging note now says phases 0-3 are in the tree; SS2's execution-time summary reflects bind-then-scoped-verify; SS3's delivered note extends to C2 (#606) -- every file-scheme mutator is a resource-typed consumer; SS5.4 marks the {id, uri} intent row delivered (#602); SS9 gains rulings 12-14 (claims taxonomy with Skip dropped, scoped verification, resource-typed mutation targets). The status companion records the landed phases and narrows outstanding work to #586 + #587. 4.1-resource-identity.md: identity never changes after construction -- the three "Resolve updates the cached URI" passages are replaced, the interface sketch corrects to Resolve() error with the RootBinder seam named, and file's opaque catalog identity (file:<rel>) is disambiguated from the rendered hierarchical form in SS2 and SS6. The status companion gains the rel-identity completion row. 3.5.4-file-provider.md: the mutator table carries the landed signatures (typed targets, on_missing defaults), a consumption-model paragraph ties the mutators to the claims taxonomy, and the SymbolicLink row records lstat existence. 2-execution-graph.md: Run's description includes the pre-flight binding pass and per-scope claim verification. Refs #581. Co-authored-by: David Noble <[email protected]>
David-Noble-at-work
pushed a commit
that referenced
this pull request
Aug 28, 2026
… proves it The Windows legs of this PR failed every knowledge-indexer test. The cause is older than the PR, and this is its fourth appearance in seventeen days -- #395, #548, #600, and now. The provider speaks two path dialects. file.join, file.glob, file.resolve and file.walk_tree build paths FOR USE, so they return OS-native strings. file.name and file.parent answer questions ABOUT a path, so they are slash-form. On Windows that means Name is handed a backslash path, slashpath.Base finds no separator in it, and the whole path comes back as the "last element": file.name(file.join("knowledge", "packages", "slots")) darwin -> "slots" windows -> "knowledge\packages\slots" The knowledge indexer therefore saw every asset directory on Windows as an unrecognized type. The previous indexer made the same call and had the same bug; it simply never ran there, because devlore-registry's workflow is ubuntu-only. Name and Parent now convert with filepath.ToSlash before Base and Dir: native input, slash-form output, which is what their documentation already claimed. ToSlash rather than a blind ReplaceAll, and the distinction matters -- a backslash is a legal character in a Unix filename, so it must not be read as a separator off Windows. WHY THIS KEEPS HAPPENING, and what stops it Every existing assertion writes its input in the dialect of the function under test. test_imm_file.star checks file.name against the literal "/some/dir/file.txt"; provider_test.go checks it against "/a/b/c.txt". Those are already slash-form, so they behave identically on every platform and the mismatch between the dialects is never exercised. Running the matrix on Windows buys nothing when the inputs cannot vary by platform. test_imm_file.star declines multi-part join explicitly: "it builds a path FOR USE, so its result is OS-native and a fixture cannot assert it without encoding a platform". True of join's RESULT -- but not of the composition. A fixture can assert that taking the last element of a joined path returns the last element, which names no separator and no platform, holds everywhere, and is false on Windows whenever the seam is broken. test_imm_file_path_seam.star does exactly that, over file.name(file.join(...)), file.parent(file.join(...)), and file.name(<glob match>) -- the last being the composition the indexer performs on every directory entry. PROVEN ON THE HARDWARE, NOT ARGUED Built for windows/arm64 and run on danoble-wd11-3. Without the fix: FAIL: equal("knowledge\packages\slots", "slots") FAIL: equal("a\b", "b") FAIL: equal(".", "knowledge/packages") FAIL: equal(["C:\...\seam_dir\slots"], ["slots"]) With it: PASS. The parent case is a second breakage nobody had noticed, for the same reason -- nothing composed those two either. scripts/Invoke-WindowsDevloreTest.sh is that loop, packaged: cross-compile here (the box carries Go 1.26.7 against a go.mod needing 1.27), ship the binary and data/, run over SSH. About a minute, against real Windows, instead of a fortnight of waiting for a CI leg to notice. One change was needed to make the binary portable: testdataDir resolved the fixture directory through runtime.Caller, which bakes in the BUILD host's source path. DEVLORE_TESTDATA overrides it.
David-Noble-at-work
added a commit
that referenced
this pull request
Aug 28, 2026
* fix(star): the knowledge indexer preserves what it did not write
star devlore knowledge index rebuilt each domain's index.yaml from a directory
listing and wrote {name: filename} per entry, discarding everything else. That
was invisible while devlore-registry's update-indexes workflow was failing. Its
first successful run after the unfreeze deleted the concepts section from two
domains, providers from a third, and every slot's package/description/platforms/
install_types -- an entire ollama slot with them.
It now UPDATES. Each existing entry is kept whole when its file is present; a new
file gets {name}. Entry metadata is hand-written, and tracking which files exist
is the only job this command has.
The rule the rest follows from: anything the indexer cannot classify is an ERROR,
not an omission. Its silence used to be indistinguishable from success -- the
output still parsed, so validate-yaml-schemas stayed green while content was
deleted. Five refusals now:
- a directory that is not a known asset type
- a file loose in a domain root, under no asset type
- a section naming an unknown type
- a section whose directory is gone
- an indexed entry whose file is absent
The last is not pedantry. signatures/dotfile-systems.yaml is indexed while the
file sits at the domain root: it moved rather than vanished, and an indexer that
merely drops entries without files would have deleted it silently.
ASSET_TYPES grows from six to nine. concepts (migration, packages) and providers
(shared) are sections in use that the indexer did not recognize; bindings
(package-authoring) is a directory with three files that appears in no index at
all. cmd/devlore-index, the uninvoked Go tool that looked like the fix, carries
the same six in its struct and would have destroyed concepts and providers too.
Two things surfaced while building this, both the same shape as the bug:
yaml.parse returns a yaml.Resource whose only attributes are equal, resource_base
and validate -- the document's data is unreachable through it. The first version
of load_existing used it, silently received nothing, and looked like it worked
while treating every index as empty. yaml.decode returns a dict.
The audit's findings went to note() on stdout but never into the error, so a
caller seeing the failure without stdout was told something was wrong but not
what. They are in the error now.
Nine integration tests cover both halves: metadata survives, a new file is added
without disturbing its neighbours, a second run is byte-identical, and each of
the five refusals fires for its own reason. The refusal tests assert the reason
rather than merely that an error occurred -- asserting only err != nil passed on
an unrelated failure, which is the same indistinguishable-from-success problem
these tests exist to prevent.
Also: the package indexer stamped its output "generated: star devlore knowledge
index packages". It is the package indexer. Fixed.
Phase 2 of docs/plans/knowledge-index-preserves-metadata.md. The registry side --
the schema, resolving the five real problems, and re-enabling the workflow -- is
phase 3 and lands separately.
* fix(file): name and parent accept OS-native paths, and a fixture that proves it
The Windows legs of this PR failed every knowledge-indexer test. The cause is
older than the PR, and this is its fourth appearance in seventeen days -- #395,
#548, #600, and now.
The provider speaks two path dialects. file.join, file.glob, file.resolve and
file.walk_tree build paths FOR USE, so they return OS-native strings. file.name
and file.parent answer questions ABOUT a path, so they are slash-form. On Windows
that means Name is handed a backslash path, slashpath.Base finds no separator in
it, and the whole path comes back as the "last element":
file.name(file.join("knowledge", "packages", "slots"))
darwin -> "slots"
windows -> "knowledge\packages\slots"
The knowledge indexer therefore saw every asset directory on Windows as an
unrecognized type. The previous indexer made the same call and had the same bug;
it simply never ran there, because devlore-registry's workflow is ubuntu-only.
Name and Parent now convert with filepath.ToSlash before Base and Dir: native
input, slash-form output, which is what their documentation already claimed.
ToSlash rather than a blind ReplaceAll, and the distinction matters -- a
backslash is a legal character in a Unix filename, so it must not be read as a
separator off Windows.
WHY THIS KEEPS HAPPENING, and what stops it
Every existing assertion writes its input in the dialect of the function under
test. test_imm_file.star checks file.name against the literal "/some/dir/file.txt";
provider_test.go checks it against "/a/b/c.txt". Those are already slash-form, so
they behave identically on every platform and the mismatch between the dialects is
never exercised. Running the matrix on Windows buys nothing when the inputs cannot
vary by platform.
test_imm_file.star declines multi-part join explicitly: "it builds a path FOR USE,
so its result is OS-native and a fixture cannot assert it without encoding a
platform". True of join's RESULT -- but not of the composition. A fixture can
assert that taking the last element of a joined path returns the last element,
which names no separator and no platform, holds everywhere, and is false on
Windows whenever the seam is broken.
test_imm_file_path_seam.star does exactly that, over file.name(file.join(...)),
file.parent(file.join(...)), and file.name(<glob match>) -- the last being the
composition the indexer performs on every directory entry.
PROVEN ON THE HARDWARE, NOT ARGUED
Built for windows/arm64 and run on danoble-wd11-3. Without the fix:
FAIL: equal("knowledge\packages\slots", "slots")
FAIL: equal("a\b", "b")
FAIL: equal(".", "knowledge/packages")
FAIL: equal(["C:\...\seam_dir\slots"], ["slots"])
With it: PASS. The parent case is a second breakage nobody had noticed, for the
same reason -- nothing composed those two either.
scripts/Invoke-WindowsDevloreTest.sh is that loop, packaged: cross-compile here
(the box carries Go 1.26.7 against a go.mod needing 1.27), ship the binary and
data/, run over SSH. About a minute, against real Windows, instead of a fortnight
of waiting for a CI leg to notice.
One change was needed to make the binary portable: testdataDir resolved the
fixture directory through runtime.Caller, which bakes in the BUILD host's source
path. DEVLORE_TESTDATA overrides it.
* test(file): state the parent assertion plainly, and drive Windows through bash
Three small corrections to the seam work.
The `and` in the file.parent case was a no-op. The expression evaluated to the
string literal whatever the left side returned, so it read as though it compared
two producer outputs while comparing nothing. Split into two direct assertions,
which also adds a second parent case. Both fail on unfixed Windows with got "."
-- slash-form Dir finds no separator in a backslash path and reports the current
directory -- for seven failures without the fix and PASS with it, verified on
danoble-wd11-3.
Invoke-WindowsDevloreTest.sh is formatted to shfmt -i 4 -ci, which is what
lint.shell runs. That was quality-gate's only complaint on the previous push;
every test leg passed, both Windows legs included.
The runner now drives the far side through Git Bash rather than PowerShell.
sshd's DefaultShell on that host is pwsh, so a bare ssh command lands there --
but ci.yaml sets `shell: bash` for the test job, and a local loop that uses a
different shell from CI reproduces the platform without reproducing the
environment. The defect this exists to catch is in Go path handling, where the
shell is irrelevant; anything quoting- or PATH-sensitive would have diverged, and
a green here would not have meant a green there.
It also drops two pwsh irritations: it splits `-test.run` at the dot unless every
argument is quoted, and it prints profile-not-found noise on each invocation.
---------
Co-authored-by: David Noble <[email protected]>
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.
Phase 2, PR 2 of resource-construction (#584) — the co-landing: the
grammar's semantics and the authoring surfaces flip together, because once a leading slash means "anchored
at the run's root," every machine-absolute authored path double-prefixes and dies.
The little language
file.NormalizePlanSpacePath, applied at the planner's claiming seam viaop.RegisterPlanPathNormalizer—op stays generic, the file scheme owns its grammar.
foo/bar≡/foo/bar; volume/UNC/backslash spellingsrefuse;
@name/…refuses as reserved for #597; escapes and the bare root refuse. One table pin perrule. Immediate-mode and programmatic construction untouched: the grammar governs what a plan may say.
The authoring surfaces
t.tmpreturns plan-space rels;t.runanchors at the same workspace root as thescript session (one root everywhere); the harness's Go helpers resolve rels through one seam. The
machine-absolute forms died by double-prefix exactly as the plan predicted.
PlanFileChainand the encrypt planner emit rels via the newdeploy.PlanSpacePathagainstthe run root writ already chooses; graph-origin annotations keep absolutes for the readback fold.
shell.exec/powershell.execcwd anchors at the run root;file.globpatterns andplan.save_definition/load_definitionpaths resolve against the root.Windows: 2 → 0
Both remaining baseline failures fixed at their surfaces: the star fixture interpolates its path
slash-form into generated starlark source (the
\Uescape failure), and lore's onboard manifest narrationuses a native join (the mixed-separator path). Expectation: the first fully green CI of the campaign.
Any remainder is re-diagnosed, not assumed.
Verified
make check— 103 ok, 0 failures (grammar pins, every scenario star, writ drift attribution)make vetGOOS=windowsRefs #584, #547, #546, #597.