Skip to content

feat(query): tag-aware ProjectableFromDomain for projectComputed - #845

Merged
omegent-app[bot] merged 2 commits into
mainfrom
feat/projectable-from-domain
Aug 4, 2026
Merged

feat(query): tag-aware ProjectableFromDomain for projectComputed#845
omegent-app[bot] merged 2 commits into
mainfrom
feat/projectable-from-domain

Conversation

@omegent-app

@omegent-app omegent-app Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Why

Scanner Empasa prod hit SchemaError: Missing key … activeRequest (MACS-SCANNER-API-KS) when MultiPick Overview.List projected cancel notes. Domain cancel states omit pack/print ownership; the overview projection required the field on every branch. That class of bug is only preventable if projectComputed typechecks projection Encoded against domain Encoded per tagged state.

What

  • Export ProjectableFromDomain and fix ProjectableGuard to distribute over tagged-union Encoded (old guard used non-distributive key intersection).
  • Tag-specific source membership: keys must exist on the matching domain _tag member (with compatible type), or be computed keys.
  • Flat Class + _tag: Literals models fall back to the full Encoded shape.
  • Wire the guard into projectComputed schema arguments.
  • Type-level + call-site regression tests for the activeRequest-on-cancelled case.

How

App fix ships separately (scope overview views). This PR makes the compiler reject the broken projection shape once scanners pick up the release.

Co-authored-by: @patroza

opened by Sentry in chat thread Discord · Discord · T3


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

omegent-app Bot and others added 2 commits August 4, 2026 10:03
Projection Encoded fields must come from the matching domain tagged state
(or from computed keys). Distributes over union Encoded so a cancel branch
cannot require pack-only fields like activeRequest (MACS-SCANNER-API-KS class).
Flat Class+_tag Literals models fall back to the full Encoded shape.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
- Constrain the computed-map argument so M is concrete before ExtraKeys apply
  (Record<string> would otherwise allow every field as "computed").
- Untagged project() DTOs keep KeysOfUnion domain keys; tagged projections
  use per-state keys.
- Key presence only (not Encoded value types) so package view narrowing works.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@effect-app/cli

npm i https://pkg.pr.new/effect-app/libs/@effect-app/cli@845

effect-app

npm i https://pkg.pr.new/effect-app/libs/effect-app@845

@effect-app/eslint-codegen-model

npm i https://pkg.pr.new/effect-app/libs/@effect-app/eslint-codegen-model@845

@effect-app/eslint-shared-config

npm i https://pkg.pr.new/effect-app/libs/@effect-app/eslint-shared-config@845

@effect-app/infra

npm i https://pkg.pr.new/effect-app/libs/@effect-app/infra@845

@effect-app/vue

npm i https://pkg.pr.new/effect-app/libs/@effect-app/vue@845

@effect-app/vue-components

npm i https://pkg.pr.new/effect-app/libs/@effect-app/vue-components@845

commit: ea7e9dc

@omegent-app
omegent-app Bot merged commit 0fe925d into main Aug 4, 2026
6 checks passed
@omegent-app
omegent-app Bot deleted the feat/projectable-from-domain branch August 4, 2026 10:12
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.

0 participants