Add dart_node_sql_js as a publishable package (sql.js bindings)#60
Merged
Conversation
Promote dart_node_sql_js from a publish_to:none stub to a full tier-2 publishable package for the 0.13.0-beta release. - Rewrite database/statement interop with typed extension types (no nullable casts), passing austerity analyze. - Fix a correctness bug: sql.js export() frees all live prepared statements, so the old auto-save-after-every-write broke statement reuse and transactions. Persist on close()/save() instead and add an explicit save() to the Database API. - Add 32 integration tests (100% line coverage), README, CHANGELOG, LICENSE, analysis_options, dart_test.yaml, package.json. - Wire into tooling: tools/lib/packages.dart (tier 2, node), test.sh (NODE_PACKAGES + TIER2), coverage-thresholds.json (100.0), publish-tier1 changelog validation, publish-tier2 publish list, release skill.
MelbourneDeveloper
added a commit
that referenced
this pull request
Jun 9, 2026
## TLDR Promote `dart_node_sql_js` from a `publish_to: none` stub into a full tier-2 publishable package (typed sql.js / SQLite-on-WASM bindings) for the 0.13.0-beta release. ## What Was Added? - **`packages/dart_node_sql_js`** as a real publishable package: `README.md`, `CHANGELOG.md` (`## 0.13.0-beta`), `LICENSE`, `analysis_options.yaml` (austerity), `dart_test.yaml`, `package.json` (`sql.js ^1.14.1`). - **32 integration tests** in `test/database_test.dart` covering open/prepare/exec/run/get/all/save/close/pragma, data types, transactions and constraints — **100% line coverage** (71/71). - Wiring: `tools/lib/packages.dart` (tier 2, node), `tools/test.sh` (`NODE_PACKAGES` + `TIER2`), `coverage-thresholds.json` (`dart_node_sql_js: 100.0`), `publish-tier1.yml` changelog validation, `publish-tier2.yml` publish list, release skill. ## What Was Changed or Deleted? - Rewrote `lib/src/database.dart` and `lib/src/statement.dart` to use **typed `dart:js_interop` extension types** instead of nullable `as` casts, so the package passes `dart analyze` under austerity. - **Bug fix:** sql.js `export()` frees every live prepared statement, so the previous "auto-save after each write" design broke prepared-statement reuse (`Statement closed`) and rolled-back transactions silently committed. Persistence now happens on `close()` / explicit `save()` only. Added `save()` to the `Database` API. Removed `publish_to: none`; set version `0.13.0-beta`. ## How Do The Automated Tests Prove It Works? - `Statement.run inserts multiple rows with incrementing rowid`, `updates rows and returns changes count`, `deletes rows and returns changes count` — these **failed before the fix** (only the first write survived because `export()` closed the reused statement) and pass now. - `Transactions rolls back transaction` asserts the balance is restored to 100 — previously reported 200 because the mid-transaction export persisted uncommitted state. - `save persists changes that survive reopen` and `loads an existing database file` prove the new persistence model round-trips to disk. - `openDatabase returns error when the path cannot be read` and `Database.close returns error when the save target directory is missing` cover the `Result` error paths. Full suite: 32/32 passing, 100% coverage (enforced by the ratchet in `tools/test.sh`). ## Spec / Doc Changes - New package `README.md` documents the async `initializeSqlJs()` + `save`/`close` persistence model. Release skill (`SKILL.md`) tier-2 lists updated to include `dart_node_sql_js`. ## Breaking Changes - [x] None (new package; first publish at 0.13.0-beta)
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.
TLDR
Promote
dart_node_sql_jsfrom apublish_to: nonestub into a full tier-2 publishable package (typed sql.js / SQLite-on-WASM bindings) for the 0.13.0-beta release.What Was Added?
packages/dart_node_sql_jsas a real publishable package:README.md,CHANGELOG.md(## 0.13.0-beta),LICENSE,analysis_options.yaml(austerity),dart_test.yaml,package.json(sql.js ^1.14.1).test/database_test.dartcovering open/prepare/exec/run/get/all/save/close/pragma, data types, transactions and constraints — 100% line coverage (71/71).tools/lib/packages.dart(tier 2, node),tools/test.sh(NODE_PACKAGES+TIER2),coverage-thresholds.json(dart_node_sql_js: 100.0),publish-tier1.ymlchangelog validation,publish-tier2.ymlpublish list, release skill.What Was Changed or Deleted?
lib/src/database.dartandlib/src/statement.dartto use typeddart:js_interopextension types instead of nullableascasts, so the package passesdart analyzeunder austerity.export()frees every live prepared statement, so the previous "auto-save after each write" design broke prepared-statement reuse (Statement closed) and rolled-back transactions silently committed. Persistence now happens onclose()/ explicitsave()only. Addedsave()to theDatabaseAPI. Removedpublish_to: none; set version0.13.0-beta.How Do The Automated Tests Prove It Works?
Statement.run inserts multiple rows with incrementing rowid,updates rows and returns changes count,deletes rows and returns changes count— these failed before the fix (only the first write survived becauseexport()closed the reused statement) and pass now.Transactions rolls back transactionasserts the balance is restored to 100 — previously reported 200 because the mid-transaction export persisted uncommitted state.save persists changes that survive reopenandloads an existing database fileprove the new persistence model round-trips to disk.openDatabase returns error when the path cannot be readandDatabase.close returns error when the save target directory is missingcover theResulterror paths. Full suite: 32/32 passing, 100% coverage (enforced by the ratchet intools/test.sh).Spec / Doc Changes
README.mddocuments the asyncinitializeSqlJs()+save/closepersistence model. Release skill (SKILL.md) tier-2 lists updated to includedart_node_sql_js.Breaking Changes