Skip to content

fix(infra): run queryRaw over stored JSON, not Encoded - #904

Merged
omegent-app[bot] merged 1 commit into
mainfrom
queryraw-undecoded-all
Sep 17, 2026
Merged

omegent-app[bot] merged 1 commit into
mainfrom
queryraw-undecoded-all

Conversation

@omegent-app

@omegent-app omegent-app Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Why

After Encoded Date/Map/Set, Memory and SQLite queryRaw still ran over Store.all, which JSON→Encoded-decodes every document. Repository.queryRaw then applies toCodecJson to the projector output, so wrapping a Date field as S.Unknown fails with Expected JSON value at [0]. That is the Mako rehearsal crash: orderRepo.queryRaw(S.Unknown, makeRawRowsQuery(ids)).

What

Memory, SQLite, and Postgres queryRaw now project stored JSON (allStored / parseRow) instead of decoded all. Cosmos already queried JSON and is unchanged. all / find still decode Encoded.

How

  • Memory: queryRaw uses existing allStored (JSON in the Ref).
  • SQL (shared + per-namespace SQLite) and Postgres: queryRaw maps parseRow without makeStoredDecode.
  • Pin with a Date-field queryRaw(S.Unknown, { id, raw }) test on Memory and SQLite.
  • query.sql / adapter-specific SQL is a follow-up, not this PR.

Remarks

Design angles: assumed goal is queryRaw JSON contract so jitM/raw loaders see stored documents — peers Memory.filter (allStored then decode) and SQL parseRow (undecoded row mapper); Cosmos queryRaw already JSON. Follow those. Follow-up: query.sql default + pg/sqlite SQL later.

After merge: Version PR → release → scanner + configurator consume the new versions → Mako rehearsal → then decide whether Mako should stay on makeRawMigrationStore or others can go back to typed-repo queryRaw.

opened by patroza 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.

Memory, SQLite, and Postgres queryRaw used Store.all, which JSON→Encoded
decodes Date/Map/Set. Repository.queryRaw then applies toCodecJson and
fails with Expected JSON value. Feed parseRow/allStored JSON instead.
Cosmos already queried JSON and is unchanged.

Co-authored-by: Patrick Roza <42661+patroza@users.noreply.github.com>
@omegent-app
omegent-app Bot marked this pull request as ready for review September 17, 2026 12:03
@pkg-pr-new

pkg-pr-new Bot commented Sep 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@effect-app/cli

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

effect-app

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

@effect-app/eslint-codegen-model

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

@effect-app/eslint-shared-config

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

@effect-app/infra

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

@effect-app/vue

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

@effect-app/vue-components

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

commit: d0510b2

@omegent-app
omegent-app Bot merged commit 48d9f36 into main Sep 17, 2026
6 checks passed
@omegent-app
omegent-app Bot deleted the queryraw-undecoded-all branch September 17, 2026 12:07
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