feat(core): expose per-spec strides on bindColumns meta#80
Conversation
A pinned vec column hands its raw flat view through — row r's axes at [r*stride, (r+1)*stride) — so callers had to HARDCODE the arity (r*3), a silent mis-index waiting to happen if a vec3 later becomes a vec4. The eachChunk cursor already exposes the stride via stride(); bindColumns didn't. meta now carries strides: readonly number[] (slots-per-row per spec, in spec order — 1 for a scalar, N for a vecN), so a caller reads `const s = meta.strides[0]` ONCE outside the runner and indexes `view[r*s + axis]` without hardcoding. It's def-invariant (the vec arity is a field property, not an archetype one) and identity-stable per binding, read outside the hot loop, so the closure specialization the API exists for is untouched. Closes the last of the four deferred legs from the launch audit.
Greptile SummaryThis PR exposes
Confidence Score: 5/5Safe to merge — the change is additive, the new field is populated at the only construction site, and the meta object is correctly reused on reinvocation. The strides array is derived from the same authoritative source (c.layout.stride) as the eachChunk cursor's stride(), it's created once per binding and preserved across reinvokes via the existing b.meta reference, and the updated test directly asserts the expected [3, 1] value. No existing behaviour is modified; the field is purely additive. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "feat(core): expose per-spec strides on b..." | Re-trigger Greptile |
What
bindColumnshands avecfield's view through as the raw flat array — rowr's axes live at[r*stride, (r+1)*stride). Callers had to hardcode the arity (pos[r*3]), a silent mis-index if avec3later becomes avec4. TheeachChunkcursor already exposes this viastride(def, field);bindColumnsdidn't — an inconsistency and a footgun.metanow carriesstrides: readonly number[](slots-per-row per spec, in spec order — 1 scalar, N forvecN):Def-invariant (vec arity is a field property), identity-stable per binding, read outside the hot loop — so the V8 closure specialization the API exists for is untouched.
Review
Independent review: clean, no issues. Verified
col.layout.strideis the authoritative slots-per-row (parity with the cursor'sstride()), meta stays monomorphic (single construction site), and no orphaned meta construction lacks the field.Verification
pnpm test→ 163 files / 1247 green (vec3 test now readsmeta.stridesinstead of hardcoding; asserts[3, 1]) ·typecheck:tests·typecheck:extras·docs:check.Closes the last of the four deferred legs from the launch audit (topics-on-workers #73, react relations #75, gen-aware numeric #77/#79, and this).