Skip to content

docs+feat: address pre-v0.1.0 release review findings#383

Merged
nao1215 merged 1 commit intomainfrom
docs/pre-release-review-fixes
Apr 17, 2026
Merged

docs+feat: address pre-v0.1.0 release review findings#383
nao1215 merged 1 commit intomainfrom
docs/pre-release-review-fixes

Conversation

@nao1215
Copy link
Copy Markdown
Owner

@nao1215 nao1215 commented Apr 17, 2026

Summary

Addresses six findings from the pre-v0.1.0 release review. All README-only fixes + one new opt-in config flag (strict_views). The parser IR refactor (finding #2) is intentionally deferred — tracked as #382 for post-release.

Changes

README

  • Fix runtime.prepare example: the function is 2-arg (placeholder dialect is baked into RawQuery), not 3-arg. README previously produced an immediate compile error on copy-paste.
  • Add a README snapshot test (test/codegen_test.gleam::readme_runtime_prepare_is_two_arg_test) that reads README.md and asserts the 2-arg call shape so the example cannot silently regress.
  • Elevate the opaque-types warning to a [!WARNING] callout at the top of "Custom type aliases". The detailed explanation stays underneath.
  • New top-level ## Limitations section with three subsections users hit in practice:
    • parameter type inference contract (INSERT values / comparison / IN / CAST only; everything else wants an explicit cast)
    • schema DDL scope (snapshot or add-only — never DROP / RENAME / ALTER COLUMN)
    • view resolution behaviour plus the new strict_views opt-in
    • link back to custom-type-alias requirement
  • Inline a short DDL-scope note next to the directory ingestion sentence so it's visible before users feed a migration directory in.

strict_views config option

  • New strict_views: Bool field on model.GleamOutput, default False so existing configs are unaffected.
  • Added to config.gleam gleam-node whitelist and parsed with the same optional-bool helper as vendor_runtime.
  • In generate.gleam's load_catalog, if strict_views: True and schema_parser produces any SchemaWarning, return SchemaParseError with a concatenated detail instead of printing to stderr and continuing. The legacy stderr-warn-and-continue path remains for strict_views: False.

Tests

  • test/generate_test.gleam: strict mode rejects unresolvable view columns (detail contains strict_views + the skipped column name); legacy mode still succeeds. New fixtures test/fixtures/strict_views_schema.sql + strict_views_query.sql.
  • test/config_test.gleam: strict_views defaults to False; YAML strict_views: true round-trips correctly. New fixture test/fixtures/strict_views_enabled.yaml.
  • Every existing GleamOutput constructor call-site in tests now passes strict_views: False — mechanical, no behaviour change.

Design Decisions

  • Opt-in, not strict-by-default. v0.1.0 is the first public release, so "not breaking users" does not strictly apply, but enabling strict views by default would immediately error on any schema with even one unresolvable view column. Opt-in keeps v0.1.0 safe and documents strict-by-default as the v0.2.0 plan. README says so.
  • Single Bool field, not a StrictMode record. Matches the existing omit_unused_models / vendor_runtime precedent. If more strict knobs appear later they can be grouped then.
  • Error surface at generate.gleam, not in schema_parser. schema_parser already distinguishes ParseError (fatal) from SchemaWarning (soft). Threading a flag into the parser would have rippled into every caller that consumes parse_files_with_engine; instead the decision stays at the generate layer where the config is naturally available.
  • Reuse existing SchemaParseError variant with a concatenated detail rather than introducing a new StrictViewsFailed error. Keeps error_to_string and CLI output untouched.
  • Codec hook for opaque domain types is deferred. The finding accepted either a codec hook or a prominent README warning; shipping a codec API half-baked would be worse than a clear README callout. The callout now leads "Custom type aliases" and mentions the follow-up.

Limitations

Verification

Local:

  • just all → 833 unit tests pass, 20 shellspec examples pass (gleam format check + gleam check + gleam build --warnings-as-errors)
  • sh integration_test/run.sh → all 7 integration cases pass

Closes #0 (pre-release review findings, no explicit issue)
Refs #382 (parser IR follow-up)

README
- Fix runtime.prepare example: the function is 2-arg (placeholder
  dialect is baked into RawQuery), not 3-arg. README snippet now
  matches src/sqlode/runtime.gleam:72. Add a README snapshot test
  that reads README.md and asserts the 2-arg call shape, so
  regressions are caught by `gleam test`.
- Elevate the opaque-types warning to a callout at the top of
  "Custom type aliases". The detail paragraph stays underneath.
- New top-level "Limitations" section with three subsections users
  are likely to hit before the CLI explains them:
    - parameter type inference (INSERT / comparison / IN / cast)
    - schema DDL scope (snapshot or add-only, never drop/rename)
    - view resolution + strict_views opt-in
- Inline a short DDL-scope note next to the existing directory
  ingestion sentence so readers see it before they feed a migration
  directory in.

strict_views config option

- Add `strict_views: Bool` to `model.GleamOutput`, default False
  so existing configs behave unchanged.
- Accept `strict_views` in `config.gleam`'s gleam-node whitelist
  and parse it with the same optional-bool helper as vendor_runtime.
- In generate.gleam's load_catalog, if strict_views is True and
  schema_parser emits any SchemaWarning, return SchemaParseError
  with a concatenated detail instead of printing to stderr and
  continuing. The legacy stderr path stays for strict_views: False.

Tests
- test/generate_test.gleam: strict_views True -> SchemaParseError
  whose detail mentions `strict_views` and the skipped column name;
  strict_views False -> generation still succeeds. Uses new fixtures
  `test/fixtures/strict_views_schema.sql` and `strict_views_query.sql`.
- test/config_test.gleam: strict_views defaults to False, and
  strict_views: true in YAML round-trips to the field. New fixture
  `test/fixtures/strict_views_enabled.yaml`.
- Thread strict_views: False through every existing GleamOutput
  construction site in tests (no behaviour change).

Post-release follow-up tracked separately as #382
(parser/analyzer tokenised-query IR refactor).
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

Warning

Rate limit exceeded

@nao1215 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 14 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 21 minutes and 14 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 446423bc-9f7f-4e32-8d24-c5b2d7bc2db1

📥 Commits

Reviewing files that changed from the base of the PR and between b42f57f and 9680b0f.

📒 Files selected for processing (10)
  • README.md
  • src/sqlode/config.gleam
  • src/sqlode/generate.gleam
  • src/sqlode/model.gleam
  • test/codegen_test.gleam
  • test/config_test.gleam
  • test/fixtures/strict_views_enabled.yaml
  • test/fixtures/strict_views_query.sql
  • test/fixtures/strict_views_schema.sql
  • test/generate_test.gleam
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/pre-release-review-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nao1215 nao1215 merged commit 5c0337e into main Apr 17, 2026
2 checks passed
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.

1 participant