8000 feat!: name the project file's loosening flags allow_, off by default by colinhacks · Pull Request #187 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

feat!: name the project file's loosening flags allow_, off by default - #187

Open
colinhacks wants to merge 2 commits into
mainfrom
allow-flags
Open

colinhacks wants to merge 2 commits into
mainfrom
allow-flags

Conversation

@colinhacks
@colinhacks colinhacks commented Nov 5, 2026 •
Copy link
Copy Markdown
Owner

The project file's two switches that loosen what Reylo accepts now read the same way: each is named allow_ and is false by default.

# a parameter whose type cannot be inferred is an error (the default)
allow_untyped_params: false
# a Postgres array column holds one dimension (the default)
allow_nested_arrays: false

allow_untyped_params replaces strict_params and reads the other way round: allow_untyped_params: true is what strict_params: false was. There is no alias. strict_params and strict are unknown keys, and the error for each says what to write instead.

allow_nested_arrays is new. Since #181, a Postgres array column is typed with one dimension and .run() throws on a value of more, since Postgres doesn't track an array's dimensions. With this set:

  • the column is typed at any depth, as NestedArray<T>, which reylo now exports
  • .run() and the Standard Query decoder skip the dimension check
  • the query's output JSON Schema lets the array nest
  • reylo play shows the same types as the type check

The run-time refusal now names the key as its other way out.

Also

  • The type of a nested array of nullable elements renders as (number | null)[][], not ((number | null)[])[].

Verified

  • cargo build --workspace --all-targets with no warning; core's and the reylo crate's tests.
  • nub run typecheck, and nub run test against Postgres 18 and MySQL 8.4 on the release binary: 368 passed, none skipped.
  • nub run build in site/.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 06:26
@vercel
vercel Bot commented Nov 5, 2026 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Nov 6, 2026 6:39am UTC

Request Review

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues. Two rough edges worth a look.

Reviewed changes

The whole PR at 5ac4ff0: the strict_params → allow_untyped_params rename and the new allow_nested_arrays flag, followed through the core config, the CLI, the type check, the build step, the run time and the docs.

  • allow_untyped_params: replaces strict_params and reads the other way round. strict and strict_params are unknown keys with no alias, and each error says what to write instead (engine/core/src/config.rs).
  • allow_nested_arrays: analysisWithNestedArrays marks each any_depth array column after analysisWithBases. The mapper renders it as NestedArray<T>, the loader emits nestedArrays: true (Postgres only) along with a nesting output schema, and .run() and the Standard Query decoder skip withinDimensions. coerce already recurses into nested arrays, so values decode at any depth.
  • Cache identity: the flag is part of both the mapper's configIdentity and the build session's key, so editing it reaches a running type check or watch process.
  • Rendering: an array of arrays now reads (number | null)[][].

I ran tsc --noEmit --runExternalCode and it passes. tests/nested-arrays.test.ts and the array test in tests/standard-query.test.ts also pass. The live tests did not run here because there is no engine binary in this environment.

ℹ️ reylo play doesn't read allow_nested_arrays

reylo play takes strictParams from the project but not the new flag. With allow_nested_arrays: true, its result pane still shows (number | null)[] for an array column while the type check shows NestedArray<number | null>. The PR body says allow_nested_arrays types the column at any depth, so reylo play disagrees with the editor for the same project.

Technical details
# `reylo play` ignores `allow_nested_arrays`

## Affected sites
- src/play.ts:167 — `playResult(..., { strictParams: project.strictParams, width, ms })` passes no nested-arrays option
- src/play-result.ts:33,41 — `options` has no such field, and `moduleTypes(sql, outcome.analysis, dialect, outcome.lexed, options.strictParams ?? true)` omits the 7th argument

## Required outcome
- On a Postgres project with `allow_nested_arrays: true`, `reylo play` renders array columns as the type check does (`NestedArray<T>`), the same way it already follows `allow_untyped_params`.

## Suggested approach
- Add `allowNestedArrays?: boolean` to `playResult`'s options, pass `project.allowNestedArrays && dialect === "postgres"` from src/play.ts, and forward it to `moduleTypes`, as src/mapper-server.ts:151 does.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread src/module-types.ts Resolved
@colinhacks
Copy link
Copy Markdown
Owner Author

On the review's reylo play point: fixed in 04c7daf. playResult takes allowNestedArrays, reylo play passes project.allowNestedArrays && dialect === "postgres" as the type check does, and tests/nested-arrays.test.ts holds that its result pane shows NestedArray<number | null> under the flag and (number | null)[] without it.

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. Both points from the last review are fixed.

Reviewed changes

This run covers 04c7daf, the only commit since the last review at 5ac4ff0.

  • reylo play follows allow_nested_arrays: playResult takes a new allowNestedArrays option and passes it to moduleTypes. src/play.ts supplies project.allowNestedArrays && dialect === "postgres", the same expression as src/mapper-server.ts:151, so the play pane and the type check now show the same types. A new test in tests/nested-arrays.test.ts covers this.
  • Corrected doc comment: the parenthetical in src/module-types.ts:102 now says the error is the default. Before, it read as if allow_untyped_params defaulted to true.

I ran tests/nested-arrays.test.ts (3 passed) and tsc --noEmit --runExternalCode (clean).

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks force-pushed the allow-flags branch 4 times, most recently from e0cfbdb to 7d1e2a6 Compare November 6, 2026 06:29
@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. The rebase onto js.codecs (#193) brings both features together correctly.

Reviewed changes

The diff since e0cfbdb is the branch rebased onto main at d15b515. It moves allow_nested_arrays onto the code that #193 added for js.codecs.

  • moduleTypes signature: codecs now comes before allowNestedArrays. Every caller was updated: src/mapper-server.ts, src/play-result.ts (which passes undefined, undefined, flag) and tests/nested-arrays.test.ts.
  • Mapper project state: Project and configIdentity hold both codecs and allowNestedArrays. A change to either one still reaches a running type check.
  • Loader: the module now carries the codecs plan and nestedArrays: true together. querySchemas gets the marked analysis along with the project's codecs.
  • Run time: in src/standard-query.ts, the codec plan wraps the postgresDecoder that knows about nesting. In src/execute.ts, withCodecs wraps the path that skips the dimension check. decodePlan and encodePlan already handle arrays of any depth, so a codec still applies to the elements of a NestedArray<T> column.
  • Render and schema: the array branches now pass codecs through and still check nestsAnyDeep.
  • Docs and skill: the postgres.mdx limits table and the SKILL.md data-types bullet now include #193's wording alongside the allow_nested_arrays note.

tsc --noEmit --runExternalCode passes, and so do tests/nested-arrays.test.ts, decode, standard-query and render. Some codecs and SQLite-driver tests fail here, but only because of this environment: Node 24 has no global Temporal, and with no engine binary, js.codecs resolves to {}.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

This branch has not been deployed

No deployments
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.

2 participants

0