Skip to content

feat(lens): clampLens — clamps into a lens's first layer (3.5.1) - #37

Merged
agreenspan merged 2 commits into
mainfrom
feat/clamp-lens
Oct 8, 2026
Merged

agreenspan merged 2 commits into
mainfrom
feat/clamp-lens

Conversation

@agreenspan

Copy link
Copy Markdown
Contributor

Aron (2026-10-08): "get rid of those duplicate helpers for sure."

intoFirstLayer lived as a copy in template (@template/db/lens), its Kingdom and Tribe ports, and Zealot (@zealot/db, PR #2715). Its job is a lens-layer op: put clamps where they may read the whole schema — the first narrowing over the base lens (LENS.md: only layer 1's clamps read any relation; a later layer's only what its parent shows). It now lives here as clampLens(lens, clamps) (verb clamp, added to docs/VERBS.md; test/verbs.test.ts requires every export there).

  • LensClamps = { root?: { where }, mapDefaults?: { [map]: { models: { [model]: { where?, sources? } } } } } — the copies' FirstLayerClamps, unchanged.
  • Behaviour identical to the copies, except a sources entry is told apart from a bare Condition by the engine's own normalizeSource (the copies used their own key test), so the merge reads an entry exactly as the engine does; {} now throws the engine's invalid_source early.
  • Tests: bare lens, AND with the first layer's where, later layers kept by reference, a clamp on a column a later layer hides validates only in layer 1, model-default wheres per map/model, source where AND + bare-Condition normalization + label/groupBy win, no-op.
  • Folded into unreleased 3.5.1; CHANGELOG names the consumers.

Consumers switch after the train publishes 3.5.1.

🤖 Generated with Claude Code

agreenspan and others added 2 commits October 8, 2026 15:47
The lens-layer op template, Kingdom, Tribe and Zealot each kept a copy of
(intoFirstLayer): AND a root where, and per-map model-default and source
wheres, into the first narrowing over the base lens, where clamps read the
whole schema; later layers kept. Source entries normalize through the
engine's own normalizeSource. Folded into the unreleased 3.5.1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@agreenspan
agreenspan merged commit 15bfc82 into main Oct 8, 2026
1 check passed
@agreenspan
agreenspan deleted the feat/clamp-lens branch October 8, 2026 19:03
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.

1 participant