You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Projections can rename (origin.passthrough), aggregate over a relationship (origin.aggregate), and nest (origin.collection) — but can't express a per-row computed value. Real cases: a cost column = tokens × price (price @via-joined from a models table), and various rate/ratio columns that adopters hand-roll in SQL (the verify "hand-rolled aggregate" advisories that are arithmetic, not pure SUM/AVG).
Proposal (sketch)
A fourth origin, origin.expression, with @expr (a per-row expression over own + @via-joined fields) and optional @via. Rendered into the generated view SELECT via a closed, per-dialect mini-grammar (arithmetic + comparison + boolean + CASE + a small function allow-list) — not raw SQL (portable + no injection surface). Field refs resolve against the symbol table (a dangling ref fails the load), like origin.aggregate.@of. Cross-port (a DB-projection concern, so it lives where view/query codegen lives).
Post-1.0 additive per ADR-0037's framework. Phasing: (1) own-column expressions (no join) — unblocks the arithmetic advisories; (2) @via-joined expressions (reuse the reference-hop).
A downstream adopter will prototype the metadata shape against a real computed-cost case to validate the syntax before upstream implementation. Full design sketch available.
Retired by #195: the reserved origin.expression subtype is superseded by origin.computed (shipped in #195), which carries a structured attr.expression tree (a closed node grammar: field/value refs, comparisons sharing the filter op vocabulary, isNull/isNotNull, and/or/not, coalesce) rather than a SQL string. This issue's future arithmetic (+ - * /), case/if, string functions, and @via-joined field refs become additive node kinds in that grammar — no second expression language. The grammar was designed for exactly this extension (see docs/superpowers/specs/2026-07-15-issue-195-projection-readmodel-origins-design.md §4bis).
Status check 2026-10-02: origin.computed shipped in 0.17.0 with comparisons and coalesce. The remaining scope (arithmetic, case/when, @via) is FR-037 R5's fn growth, now tracked in #393.
Activity
feat(metamodel): origin.passthrough is type-preserving unless @convert (
dmealing commentedon Jul 16, 2026
Retired by #195: the reserved
origin.expressionsubtype is superseded byorigin.computed(shipped in #195), which carries a structuredattr.expressiontree (a closed node grammar: field/value refs, comparisons sharing the filter op vocabulary, isNull/isNotNull, and/or/not, coalesce) rather than a SQL string. This issue's future arithmetic (+ - * /),case/if, string functions, and@via-joined field refs become additive node kinds in that grammar — no second expression language. The grammar was designed for exactly this extension (seedocs/superpowers/specs/2026-07-15-issue-195-projection-readmodel-origins-design.md§4bis).dmealing commentedon Oct 2, 2026
Status check 2026-10-02:
origin.computedshipped in 0.17.0 with comparisons andcoalesce. The remaining scope (arithmetic, case/when,@via) is FR-037 R5'sfngrowth, now tracked in #393.docs(roadmap): move feature status and target releases to GitHub issues