Repository navigation
VN36: parent(n).par.key in expressions (stacked on #5 and #4) - #6
Conversation
The mesh loader wrote a file's measured facts (vertices, triangles, parts, joints, clips, clipFrames, frameOrigin, bounds) onto the node it found with getGraph().nodes[nodeId]. An inner node's id is flattened (instance/inner), the document does not hold it, so the write never happened and the node compiled as the one-vertex stand-in: it drew nothing. The facts now land as that instance's overrides of the inner node (state.componentOverrides, keyed internalParameterPath), which flattening already applies over the definition. Each instance keeps its own size, two instances can load different files, and the shared definition is untouched. - setParameters gains an optional internalNodeId, on the precedent of setNodeChannelMask's: one op through the bus, so undo, audit and the revision check come with it. A non-instance and a nested path are refused by name (parameter.internal.notComponent / .nested). - "Already sized" reads the flattened node (definition plus overrides). - Ids are split and joined through domain/components/addressing.ts (enteredThrough, toInstance), per T1695b's gate. - One level only: an override key is <node>/<key>, so a mesh inside a nested component is refused as mesh.unsizable. mesh.component is retired. Tests: the literal bug on Dawn (the app's loader hook sizes two instances of one component loading different files, and each Geometry renders only its own instance's mesh); undo of the measure; the definition untouched; the nested refusal. Red-verified against the old lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
COMP-model stage 1 (proposal 01 §4). B41 renumbers the names inside the
second and later instances of a component, so an outer reference could
reach in only by a bare name, and a bare name binds the first copy. Three
instances of a Projector component could not be bound by one Render.
- `op('instance/node')`, `../node`, and path-valued source references
(every SOURCE_REFERENCE_PARAMETERS entry). Relative only. A segment is
a node's name as written in its own graph. Parsing and the walk live in
addressing.ts, the one joiner.
- Resolved once, at flatten (path-references.ts): each path is rewritten
to its target's unique flat label, so synthesis, the op() reader,
liveness and channels are unchanged. A path that reaches nothing stays
as written and is refused by name.
- Bare names resolve as before. New warning compiler/reference-cross-scope
when one reaches INTO an instance the referrer is not in, with the path
to write and how many copies carry the name. Reading outward is silent.
No shipped example raises it; stage-previz-8 raises 52.
- §V128: a rename moves the head of a path written in its graph. B41's
uniquing does not touch paths.
- `/` is refused in labels at the exact doors (node.label.separator); the
suggestion is TD's validName form (roleFromText). node.rename already
converts it.
Gate (Dawn, projector-paths.gpu.test.ts): one Projector component placed
three times through the app's commands, each with its own aim and pure
colour; the outer Render binds all three by path and each third of the
stage is lit in its own colour only. Red-verified with the pass removed.
The bare name, the old way, lights the left third alone and now warns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`parent()` / `parent(n)` followed by `.par.<key>` with an optional component,
refused at parse time in every other shape with the form to write. A bare
`parent` stays a variable name. The AST node records its span, so a caller
with the scope can rewrite the read in place (`parent-reads.ts`) without
re-serialising or pattern-matching the expression.
Nothing evaluates one yet: the evaluator refuses it as `reference.unreadable`
("not inside a component") rather than reading 0. The flattener's rewrite
lands in the next commits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flattening deletes the instance node, so the compiler's reader, over the flat graph, found nothing called `rig1`. T1485b answered that for `.chan`. This answers it for `.par`: the flattening hands over each instance's page (`FlatteningReads.instancePages`, label → the instance as flattened plus its published schema), and a name no flat node carries is resolved there, through the same `targetOf` as any node. An animated knob is evaluated once per frame at its publisher, and the reader gets a number. This is the read `parent()` becomes (next commit). It is a stage-1 bridge: when a COMP is a real node (proposal 01 stages 2–3) the name index finds it and the map retires. `instancePages` is REQUIRED on `FlatteningReads` (T1551b's rule), so every reader site says it: the compile and per-frame compile (beside `resolution.instances`), the value graph, the OSC pump, parameter commands, the controls pane, the inspector (the root flattening's pages while inside an instance) and the test harnesses. Gate (integration, real flattener/value graph/compiler): page value read and followed; an animated page knob at two frames; a compound component; an unknown key refused with the nearest spelling; the per-frame values-only compile equal to the full compile and moving. Red-verified: reader lookup off fails all five; the per-frame compile's pages off fails the last. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
COMP-model proposal 01 §2.3. An expression could not read its own
component's published parameter, so stage-previz-8 keeps 17 Constant
"knob holders" for formulas to read. Now `parent().par.gain * 0.5 +
op('lfo1').chan.value` is one expression.
TD's model: `parent()` names the COMP, and `.par.key` is evaluated once,
where it lives; readers get the number, not the formula.
- Flatten resolves a NAME (`compiler/parent-references.ts`, beside
`effectiveParameters`): `parent(n).par.key` becomes
`op('<the n-th enclosing instance>').par.key`. It runs as each node's
parameters are made, the instance's own page included, so a page slot
T1017 carries inward keeps the `parent()` it was written with.
- The reader reads that instance's page per frame (previous commit).
- Same rule as §V81: only the published page is reachable. A key it does
not publish, a root node, or reaching past the outermost component is
refused by name (`compiler/parent-reference-unknown-key`,
`-no-parent`, class never), and the parameter keeps its static (§V108).
It never reads 0.
- Value-graph order and liveness follow a read through the page, so a
page knob reading an LFO orders its readers after it and keeps what it
reads alive. T1485b's `.chan` branch no longer swallows `.par` reads.
- `component.detach` rewrites `parent()` for where the copies land, by
the rule it applies to `parent.` binds. What it cannot carry is said.
- `parent.<key>` binds are unchanged (VN38 migrates them).
- Fixes the grammar commit's case fallthrough (lint).
Gate (Dawn, parent-expressions.gpu.test.ts, through the app's commands):
a Solid saved as "Lamp" with red = parent().par.gain and green =
1 - parent().par.gain, placed twice at gain 1 and 0, renders pure red and
pure green. Cut the publish: both hold static black and four unknown-key
warnings. An animated page knob: two frames, two colours. Red-verified
(rewrite off: all three fail on the evaluator's refusal). Headless:
nesting, nested page values, a carried slot, root, too deep, value-graph
order, liveness, detach, each red-verified.
Design and follow-ups: docs/parent-expressions-2026-10-06.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acked on laubsauger#4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This is the next feature in the same chain: VN35 now exists on main through repaired #13, and VN33's useful coverage landed through #12 without restoring #4's unchecked writer. I ported only this PR's three VN36 commits onto that implementation. Its initial 81 focused tests and typecheck passed, but additional reproductions exposed unresolved paths on dissolved published pages, invisible parent/page cycles, and publication that activated a latent cycle. The repair also handles whitespace that the parser accepted but the span walker missed. The fixes are now published in #14. They keep the original grammar, per-frame page reader, parent rewrite, liveness/pruning and detach work, while sharing scope/path and cycle rules with the repaired VN35. The real app-command lamp fixture has a CPU compiler proof, with required Dawn checks kept explicit. The replacement preserves the contributor's history and is based on current main. The connector cannot update this fork branch, so this draft remains unchanged until the replacement's CI passes and it lands; it will then be closed here with the final link and validation result. |
|
The feature from this PR has now landed on main through #14 (merge commit 67b77ed). The replacement retains all three VN36 contributor commits and builds on the repaired path-name implementation in #13, without restoring #4's unchecked parameter writer or its nested-mesh limitation. GitHub may mark this original PR merged because the contributor head is preserved in the replacement's ancestry. Review fixes include path resolution for dissolved and nested instance pages; cycle validation for both command edits and loaded files; validation before publishing a control that could activate a latent cycle, including dry runs; and recognition of valid whitespace in parent() reads. Page records expose only schema-declared controls and compound components. Existing authoring scopes and validated descendant writes remain in place. The lamp fixture now uses the correct parent command context and disposes its runtime. Validation: focused compiler/domain/runtime tests, typecheck, lint, build, first-import checks and CI pass. All 11 real GPU regression tests across the mesh, projector-path and parent-expression fixtures pass on the Apple M3 Max after enabling Metal access. Earlier adapter failures were session restrictions, not missing machine support; no pixel tests were skipped or weakened. The broader gates had one devices-only helper timeout also reproduced on the unchanged baseline. The contributor fork could not be updated through the connector, so #14 provides the reviewable repair while preserving contributor history. Local Git history and the separate mapping integration were untouched. |
|
Validation follow-up: the isolated landing tree's src/devices/helper.test.ts now passes all 21 tests with unrestricted local execution. This clears the specific helper timeout previously observed under the restricted session. The real GPU fixtures had already passed all 11 checks after Metal access was enabled. This is a targeted rerun of the previously failing file, not a claim that the entire broader gate suite was rerun. |
…aubsauger#5/laubsauger#6 and closed laubsauger#4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of stage 1 of the COMP-model proposal (#3,
docs/comp-model-2026-10-06/01-comps-as-folders.md§2.3 and proposal 02).The problem
An expression could not read its own component's published parameter. So
stage-previz-8keeps 17 Constant "knob holders" for formulas to read. With this change,parent().par.gain * 0.5 + op('lfo1').chan.valueis one expression.The change
This follows TD's model:
parent()names the COMP, and.par.keyis evaluated once, where it lives. Readers get the number, not the formula.f0a14490grammar:parent()/parent(n)followed by.par.<key>, with an optional component. Every other shape is refused at parse time, and the error gives the form to write.parentstays a variable name, andparent.<key>binds parse as before.34a282b0reader:op('<instance>').par.<key>reads a dissolved instance's page..chan; this answers it for.par.FlatteningReads.instancePages). A name no flat node carries is resolved there, through the sametargetOfas any other node.instancePagesis REQUIRED (T1551b's rule), so every reader site states it.b04d4d78the rewrite:compiler/parent-references.ts, besideeffectiveParameters) rewritesparent(n).par.keytoop('<the n-th enclosing instance>').par.key.compiler/parent-reference-unknown-keyor-no-parent. The parameter keeps its static value (§V108); it never reads 0.prune.ts) follow a read through the page. Without the pruning change, a node read only through a page would be pruned as dead.component.detachrewritesparent()for where the copies land, and says what it cannot carry.parent.<key>binds are unchanged; migrating them is separate work.docs/parent-expressions-2026-10-06.md.Tests
src/tests/headless/parent-expressions.gpu.test.ts, through the app's commands): a Solid is saved as "Lamp" with red =parent().par.gainand green =1 - parent().par.gain, then placed twice, at gain 1 and gain 0. The two copies render pure red and pure green.pnpm test:gates(64 files / 3,706),pnpm typecheck,pnpm lint,pnpm build.Proposed §T row
🤖 Generated with Claude Code