feat(query): tag-aware ProjectableFromDomain for projectComputed - #845
Merged
Conversation
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>
@effect-app/cli
effect-app
@effect-app/eslint-codegen-model
@effect-app/eslint-shared-config
@effect-app/infra
@effect-app/vue
@effect-app/vue-components
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ifprojectComputedtypechecks projection Encoded against domain Encoded per tagged state.What
ProjectableFromDomainand fixProjectableGuardto distribute over tagged-union Encoded (old guard used non-distributive key intersection)._tagmember (with compatible type), or be computed keys.Class+_tag: Literalsmodels fall back to the full Encoded shape.projectComputedschema arguments.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
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.