Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
119 changes: 119 additions & 0 deletions .github/workflows/npm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: NPM Packages Release
on:
Comment thread
findolor marked this conversation as resolved.
push:
branches:
- main

jobs:
release:
if: ${{ github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'NPM Package Release') }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
outputs:
version: ${{ env.NEW_VERSION }}
steps:
Comment thread
findolor marked this conversation as resolved.
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.PUBLISH_PRIVATE_KEY }}
submodules: recursive
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@main
with:
determinate: true
- uses: DeterminateSystems/flakehub-cache-action@main

- name: Install NodeJS v22
uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"

- run: nix develop -c build-submodules

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix trailing whitespace and ensure newline at EOF

YAMLlint reports trailing spaces on Line 35 and missing final newline. Trim the trailing spaces and end the file with a newline.

-      
+

Also ensure there is a newline at the very end of the file.

Also applies to: 119-119

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 35-35: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
.github/workflows/npm-release.yaml around lines 35 and 119: remove any trailing
whitespace characters at the end of lines 35 and 119 and ensure the file ends
with a single newline character (add a final empty line/line break at EOF) so
there is no trailing space and the file terminates with a newline.

- run: nix develop -c local-bundle
Comment thread
findolor marked this conversation as resolved.

- name: Test full integration
run: nix develop -c test-full-integration

- name: Git Config
run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
git config --global user.name "${{ secrets.CI_GIT_USER }}"

# get hash of latest published pkgs from npm and concat them
- name: Get Old Hash
run: |
OLD_HASH=$(npm view @rainlanguage/sqlite-web@latest dist.shasum 2>/dev/null || echo "none")
echo "OLD_HASH=$OLD_HASH" >> $GITHUB_ENV
echo "old hash: $OLD_HASH"

Comment on lines +47 to +52

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Optional: compare sha512 integrity instead of sha1 shasum

npm exposes dist.integrity (sha512). Using that provides a stronger integrity check and avoids reliance on local shasum formatting.

-          OLD_HASH="$(npm view @rainlanguage/sqlite-web@latest dist.shasum 2>/dev/null || echo "none")"
+          OLD_HASH="$(npm view @rainlanguage/sqlite-web@latest dist.integrity 2>/dev/null || echo "none")"

You’ll also need to compute a matching sha512 integrity string for NEW_HASH (e.g., using openssl base64 encoding of the sha512 digest in SRI format) if you adopt this.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint (1.7.7)

48-48: shellcheck reported issue in this script: SC2086:info:2:30: Double quote to prevent globbing and word splitting

(shellcheck)

🤖 Prompt for AI Agents
.github/workflows/npm-release.yaml around lines 47 to 52: the workflow currently
fetches the package's shasum (sha1) via npm view and compares it to a locally
computed OLD_HASH; replace this with npm view ... dist.integrity to use the
package's sha512 SRI integrity string, and compute NEW_HASH in matching SRI
format for the local artifact by computing the raw sha512 digest,
base64-encoding it and prefixing with "sha512-" so the two values can be
compared directly; update the environment assignment and any print/log to use
the integrity string instead of the sha1 shasum.

# Build the package and calc hash
- name: Build and Get New Hash
run: |
nix develop -c local-bundle
NEW_HASH=$(cd pkg && npm pack --silent | xargs shasum | cut -c1-40)
echo "NEW_HASH=$NEW_HASH" >> $GITHUB_ENV
echo "new hash: $NEW_HASH"
rm -f pkg/*.tgz

Comment on lines +56 to +61

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Quote $GITHUB_ENV; keep single pack artifact; add pipefail

Prevents word-splitting and early exit on failures within the pipe.

-        run: |
-          nix develop -c local-bundle
-          NEW_HASH=$(cd pkg && npm pack --silent | xargs shasum | cut -c1-40)
-          echo "NEW_HASH=$NEW_HASH" >> $GITHUB_ENV
-          echo "new hash: $NEW_HASH"
-          rm -f pkg/*.tgz
+        run: |
+          set -Eeuo pipefail
+          nix develop -c local-bundle
+          NEW_HASH="$(cd pkg && npm pack --silent | xargs shasum | cut -c1-40)"
+          echo "NEW_HASH=$NEW_HASH" >> "$GITHUB_ENV"
+          echo "new hash: $NEW_HASH"
+          rm -f pkg/*.tgz
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nix develop -c local-bundle
NEW_HASH=$(cd pkg && npm pack --silent | xargs shasum | cut -c1-40)
echo "NEW_HASH=$NEW_HASH" >> $GITHUB_ENV
echo "new hash: $NEW_HASH"
rm -f pkg/*.tgz
run: |
set -Eeuo pipefail
nix develop -c local-bundle
NEW_HASH="$(cd pkg && npm pack --silent | xargs shasum | cut -c1-40)"
echo "NEW_HASH=$NEW_HASH" >> "$GITHUB_ENV"
echo "new hash: $NEW_HASH"
rm -f pkg/*.tgz
🤖 Prompt for AI Agents
.github/workflows/npm-release.yaml around lines 56-61: the script currently runs
npm pack and computes a hash without quoting $GITHUB_ENV, may leave multiple
.tgz artifacts, and doesn't enable pipefail; update the block to enable pipefail
(set -o pipefail), capture the pack output filename into a variable (e.g.,
PACKED="$(cd pkg && npm pack --silent)") then compute the NEW_HASH against that
specific file, write the env line using a quoted redirect (echo
"NEW_HASH=$NEW_HASH" >> "$GITHUB_ENV"), and remove any other .tgz files while
preserving the single packed artifact (e.g., delete all pkg/*.tgz except
"$PACKED" or explicitly clean then keep the captured file). Ensure all variable
expansions are quoted to avoid word-splitting.

# from here on, we'll skip if OLD_HASH and NEW_HASH are the same (ie no publish)
# this means we need to skip every step by using an if statement.
# set npm version in pkg directory
- name: Set Version
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
NEW_VERSION=$(npm version prerelease --preid alpha --no-git-tag-version)
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV

Comment on lines +65 to +70

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Run npm version in pkg/; current command mutates the wrong package.json

The comment says “set npm version in pkg directory” but the command runs at repo root. If the root has a package.json, it will be version-bumped incorrectly; if not, the command fails. Execute in pkg and keep writing to the job env.

-      - name: Set Version
+      - name: Set Version
         if: ${{ env.OLD_HASH != env.NEW_HASH }}
-        run: |
-          NEW_VERSION=$(npm version prerelease --preid alpha --no-git-tag-version)
-          echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
+        working-directory: pkg
+        run: |
+          set -Eeuo pipefail
+          NEW_VERSION="$(npm version prerelease --preid alpha --no-git-tag-version)"
+          echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Set Version
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
NEW_VERSION=$(npm version prerelease --preid alpha --no-git-tag-version)
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Set Version
if: ${{ env.OLD_HASH != env.NEW_HASH }}
working-directory: pkg
run: |
set -Eeuo pipefail
NEW_VERSION="$(npm version prerelease --preid alpha --no-git-tag-version)"
echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV"
🧰 Tools
🪛 actionlint (1.7.7)

67-67: shellcheck reported issue in this script: SC2086:info:2:36: Double quote to prevent globbing and word splitting

(shellcheck)

🤖 Prompt for AI Agents
.github/workflows/npm-release.yaml around lines 65 to 70: the workflow runs npm
version at the repository root which mutates the wrong package.json (or fails if
none); change the step to run npm version inside the pkg/ directory (e.g., cd
pkg && npm version prerelease --preid alpha --no-git-tag-version) and continue
to echo the resulting NEW_VERSION to GITHUB_ENV so the job env is preserved.

# Commit changes and tag
- name: Commit And Tag
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git add "pkg/package.json"
git commit -m "NPM Package Release v${{ env.NEW_VERSION }}"
git tag npm-v${{ env.NEW_VERSION }}

# Push the commit to remote
- name: Push Changes To Remote
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
git push origin
git push -u origin npm-v${{ env.NEW_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create sqlite-web npm package tarball
- name: Create sqlite-web NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: |
cd pkg
echo "NPM_PACKAGE=$(npm pack --silent)" >> $GITHUB_ENV

- name: Rename sqlite-web NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: mv pkg/${{ env.NPM_PACKAGE }} sqlite_web_npm_package_${{ env.NEW_VERSION }}.tgz
Comment on lines +92 to +97

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Quote $GITHUB_ENV and harden shell

Prevents word-splitting when exporting NPM_PACKAGE; fail early on errors.

-        run: |
-          cd pkg
-          echo "NPM_PACKAGE=$(npm pack --silent)" >> $GITHUB_ENV
+        run: |
+          set -Eeuo pipefail
+          cd pkg
+          echo "NPM_PACKAGE=$(npm pack --silent)" >> "$GITHUB_ENV"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd pkg
echo "NPM_PACKAGE=$(npm pack --silent)" >> $GITHUB_ENV
- name: Rename sqlite-web NPM Package Tarball
if: ${{ env.OLD_HASH != env.NEW_HASH }}
run: mv pkg/${{ env.NPM_PACKAGE }} sqlite_web_npm_package_${{ env.NEW_VERSION }}.tgz
run: |
set -Eeuo pipefail
cd pkg
echo "NPM_PACKAGE=$(npm pack --silent)" >> "$GITHUB_ENV"
🤖 Prompt for AI Agents
In .github/workflows/npm-release.yaml around lines 92-97, the run block should
harden the shell and quote environment file and paths: enable strict shell flags
(e.g., add set -euo pipefail at the start of the run block) so the step fails
early on errors, write the NPM_PACKAGE export using a quoted GITHUB_ENV (echo
"NPM_PACKAGE=$(npm pack --silent)" >> "$GITHUB_ENV"), and quote the mv arguments
(mv "pkg/${{ env.NPM_PACKAGE }}" "sqlite_web_npm_package_${{ env.NEW_VERSION
}}.tgz") to prevent word-splitting.


# publish sqlite-web pkg to npm
- name: Publish sqlite-web pkg To NPM
if: ${{ env.OLD_HASH != env.NEW_HASH }}
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: sqlite_web_npm_package_${{ env.NEW_VERSION }}.tgz

# Create gitHub release with tarballs
- name: Create GitHub Release with sqlite-web pkg
if: ${{ env.OLD_HASH != env.NEW_HASH }}
id: gh_release
uses: softprops/action-gh-release@v2
with:
tag_name: npm-v${{ env.NEW_VERSION }}
name: NPM Package Release v${{ env.NEW_VERSION }}
files: |
sqlite_web_npm_package_${{ env.NEW_VERSION }}.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/test-ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test SDK UI Logic
on: [push]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Run on pull_request as well.

Add PR trigger to ensure UI tests run for proposed changes.

Apply this diff:

-on: [push]
+on:
+  push:
+  pull_request:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on: [push]
on:
push:
pull_request:
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 2-2: truthy value should be one of [false, true]

(truthy)

🤖 Prompt for AI Agents
In .github/workflows/test-ui.yaml around lines 2-2 the workflow is only
triggered on push; add the pull_request trigger so UI tests run for PRs as
well—update the on: line to include pull_request (e.g., on: [push, pull_request]
or use a mapping with both push and pull_request) and commit the change.


concurrency:
group: ${{ github.ref }}-ui
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
Comment on lines +5 to +6

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Align concurrency key and behavior with WASM workflow.

Use a workflow-scoped group and unconditional cancellation to avoid overlapping runs on branches.

Apply this diff:

 concurrency:
-  group: ${{ github.ref }}-ui
-  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
+  group: ${{ github.workflow }}-${{ github.ref }}-ui
+  cancel-in-progress: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
group: ${{ github.ref }}-ui
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ui
cancel-in-progress: true
🤖 Prompt for AI Agents
In .github/workflows/test-ui.yaml around lines 5 to 6, the concurrency block
currently uses a ref-scoped group and conditional cancellation; change it to use
a workflow-scoped group and unconditional cancellation to prevent overlapping
runs: set the group to use the workflow name (e.g., ${{ github.workflow }}-ui)
and set cancel-in-progress to true so any in-progress runs for this workflow are
always cancelled when a new run starts.


jobs:
test:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
env:
COMMIT_SHA: ${{ github.sha }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
Comment on lines +17 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Upgrade checkout action to v4.

Same rationale as the WASM workflow.

Apply this diff:

-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v4
         with:
           submodules: recursive
           fetch-depth: 0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
🧰 Tools
🪛 actionlint (1.7.7)

17-17: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
.github/workflows/test-ui.yaml lines 17-20: the workflow uses
actions/checkout@v2; update the checkout action to actions/checkout@v4 by
changing the version tag to @v4 and keep the existing inputs (submodules:
recursive and fetch-depth: 0) so submodules are cloned and full history is
fetched; ensure the rest of the workflow still works with v4 and run the CI to
validate.


- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: nix develop -c build-submodules

- run: nix develop -c local-bundle

- name: Install Playwright browsers with dependencies
run: |
cd svelte-test
npx playwright install --with-deps

- run: nix develop -c test-ui

- name: Frontend linting and formatting
run: |
cd svelte-test
npm run lint-format-check
Comment on lines +51 to +53

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add trailing newline.

Keep YAML tidy and tools happy.

Apply this diff:

       - name: Frontend linting and formatting
         run: |
           cd svelte-test
           npm run lint-format-check
+

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 53-53: no new line character at the end of file

(new-line-at-end-of-file)

🤖 Prompt for AI Agents
.github/workflows/test-ui.yaml around lines 51 to 53: the file is missing a
trailing newline which some tools and linters expect; add a single newline
character at the end of the file (i.e., ensure the last line ends with a
newline) and commit the change.

45 changes: 45 additions & 0 deletions .github/workflows/test-wasm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test WASM
on: [push]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Run on pull_request too to validate PRs.

Limiting to push misses PR validation from forks/branches.

Apply this diff:

-on: [push]
+on:
+  push:
+  pull_request:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on: [push]
on:
push:
pull_request:
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 2-2: truthy value should be one of [false, true]

(truthy)

🤖 Prompt for AI Agents
In .github/workflows/test-wasm.yaml around line 2, the workflow only triggers on
push which skips CI for pull requests; update the triggers to include
pull_request (e.g., change the on: key to include both push and pull_request or
use on: [push, pull_request]) so PRs (including from forks/branches) run the
workflow for validation.


concurrency:
group: ${{ github.ref }}-wasm
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
test:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
env:
COMMIT_SHA: ${{ github.sha }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
Comment on lines +17 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Upgrade checkout action to v4.

actions/checkout@v2 is deprecated and flagged by actionlint. Use v4.

Apply this diff:

-      - uses: actions/checkout@v2
+      - uses: actions/checkout@v4
         with:
           submodules: recursive
           fetch-depth: 0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
🧰 Tools
🪛 actionlint (1.7.7)

17-17: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
.github/workflows/test-wasm.yaml lines 17-20: the workflow uses the deprecated
actions/checkout@v2; update the action reference to actions/checkout@v4 and keep
the existing inputs (submodules: recursive and fetch-depth: 0) intact — replace
the uses line with actions/checkout@v4 so actionlint no longer flags the
workflow.


- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G

- run: nix develop -c build-submodules

- run: nix develop -c local-bundle

- run: nix develop -c rainix-rs-static

- run: nix develop -c test-wasm

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add trailing newline.

Missing newline at EOF trips YAML linters and some tooling.

Apply this diff:

-      - run: nix develop -c test-wasm
+      - run: nix develop -c test-wasm
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- run: nix develop -c test-wasm
- run: nix develop -c test-wasm
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 45-45: no new line character at the end of file

(new-line-at-end-of-file)

🤖 Prompt for AI Agents
In .github/workflows/test-wasm.yaml around line 45, the file is missing a
trailing newline which trips YAML linters; add a single newline character at
end-of-file so the last line ("- run: nix develop -c test-wasm") is terminated
with a newline (update the file and commit the change).

7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/target
/pkg
# Generated files from bundle.sh
packages/sqlite-worker/src/embedded_worker.js
pkg/sqlite_worker_bg.wasm.b64
packages/sqlite-web/src/embedded_worker.js
pkg/sqlite_web_bg.wasm.b64

Comment on lines +4 to +6

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Redundant ignore under /pkg; simplify.
Since “/pkg” is already ignored (Line 2), “pkg/sqlite_web_bg.wasm.b64” is redundant.

 packages/sqlite-web/src/embedded_worker.js
-pkg/sqlite_web_bg.wasm.b64
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
packages/sqlite-web/src/embedded_worker.js
pkg/sqlite_web_bg.wasm.b64
packages/sqlite-web/src/embedded_worker.js
🤖 Prompt for AI Agents
In .gitignore around lines 4 to 6, the entry "pkg/sqlite_web_bg.wasm.b64" is
redundant because "/pkg" is already ignored on line 2; remove the specific
"pkg/sqlite_web_bg.wasm.b64" line and keep the more general "/pkg" ignore (leave
"packages/sqlite-web/src/embedded_worker.js" intact) so the ignore file is
simplified and has no duplicate rules.

# macOS
.DS_Store
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
"rust-analyzer.linkedProjects": [
"./Cargo.toml",
"./packages/sqlite-worker-core/Cargo.toml",
"./packages/sqlite-worker/Cargo.toml",
"./packages/sqlite-web-core/Cargo.toml",
"./packages/sqlite-web/Cargo.toml",
"./lib/rain.math.float/Cargo.toml"
],
Comment on lines 5 to 11

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify RA target + linked projects resolve for wasm builds.

With rust-analyzer.cargo.target set to wasm32-unknown-unknown, any non-wasm-friendly dependency in the workspace could degrade IDE diagnostics for those crates. Please verify RA indexing succeeds for all three linked projects.

Run this script to confirm crate discovery and that each linked Cargo.toml builds metadata for the wasm target:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Linked projects in .vscode/settings.json:"
jq -r '.["rust-analyzer.linkedProjects"][]' .vscode/settings.json

echo -e "\nEnsure the listed Cargo.toml files exist:"
jq -r '.["rust-analyzer.linkedProjects"][]' .vscode/settings.json | while read -r p; do
  if [[ -f "$p" ]]; then echo "OK  - $p"; else echo "MISS- $p"; fi
done

echo -e "\nCargo metadata (wasm32) per linked project:"
jq -r '.["rust-analyzer.linkedProjects"][]' .vscode/settings.json | while read -r p; do
  echo -e "\n>>> $p"
  (cd "$(dirname "$p")" && cargo metadata --format-version=1 --no-deps --filter-platform wasm32-unknown-unknown >/dev/null && echo "metadata: OK") || echo "metadata: FAIL"
done

Length of output: 3306


Fix the missing linked project path in .vscode/settings.json

The linkedProjects array includes ./lib/rain.math.float/Cargo.toml, but that file does not exist in the repo. Update or remove the invalid entry, then verify Rust Analyzer can index all your workspace crates for the wasm32-unknown-unknown target.

• In .vscode/settings.json (remove or correct) the line:

    "./lib/rain.math.float/Cargo.toml"

• After fixing the path(s), ensure you have a default Rust toolchain configured (e.g. rustup default stable), then run in each crate directory:

cargo metadata --no-deps --filter-platform wasm32-unknown-unknown

and confirm it succeeds.
• Finally, reopen your editor and verify that Rust Analyzer diagnostics and indexing work correctly for all linked projects under the wasm target.

🤖 Prompt for AI Agents
.vscode/settings.json around lines 5-11: the rust-analyzer.linkedProjects array
contains a non-existent entry "./lib/rain.math.float/Cargo.toml"; remove that
entry or replace it with the correct relative path to the crate's Cargo.toml (or
add the missing crate) so every path in linkedProjects points to an existing
Cargo.toml, then ensure a default Rust toolchain is set (e.g. run rustup default
stable) and in each workspace crate run cargo metadata --no-deps
--filter-platform wasm32-unknown-unknown to verify metadata succeeds for the
wasm target, finally reopen the editor and confirm Rust Analyzer indexes all
linked projects without errors.

"[rust]": {
Expand Down
22 changes: 11 additions & 11 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

### Main Build Process
- `./bundle.sh` - Complete build pipeline that:
1. Builds `sqlite-worker-core` with `wasm-pack build --target web`
1. Builds `sqlite-web-core` with `wasm-pack build --target web`
2. Embeds WASM into JavaScript worker template
3. Builds `sqlite-worker` package with embedded core
3. Builds `sqlite-web` package with embedded core
4. Packages with `npm pack` and updates Svelte test integration

Comment on lines 7 to 13

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix list/heading spacing to satisfy markdownlint (MD022/MD032) and minor grammar.

Several headings/lists need surrounding blank lines; also tighten phrasing in the main pipeline steps for clarity.

Apply minimal formatting fixes:

-### Main Build Process
-- `./bundle.sh` - Complete build pipeline that:
-  1. Builds `sqlite-web-core` with `wasm-pack build --target web`
-  2. Embeds WASM into JavaScript worker template
-  3. Builds `sqlite-web` package with embedded core
-  4. Packages with `npm pack` and updates Svelte test integration
+### Main Build Process
+
+- `./bundle.sh` — complete build pipeline:
+  1. Build `sqlite-web-core` with `wasm-pack build --target web`
+  2. Embed the WASM into the JavaScript worker template
+  3. Build the `sqlite-web` package with the embedded core
+  4. Package with `npm pack` and update the Svelte test integration
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Main Build Process
- `./bundle.sh` - Complete build pipeline that:
1. Builds `sqlite-worker-core` with `wasm-pack build --target web`
1. Builds `sqlite-web-core` with `wasm-pack build --target web`
2. Embeds WASM into JavaScript worker template
3. Builds `sqlite-worker` package with embedded core
3. Builds `sqlite-web` package with embedded core
4. Packages with `npm pack` and updates Svelte test integration
### Main Build Process
- `./bundle.sh` — complete build pipeline:
1. Build `sqlite-web-core` with `wasm-pack build --target web`
2. Embed the WASM into the JavaScript worker template
3. Build the `sqlite-web` package with the embedded core
4. Package with `npm pack` and update the Svelte test integration
🧰 Tools
🪛 LanguageTool

[grammar] ~7-~7: Use correct spacing
Context: ...# Build Commands ### Main Build Process - ./bundle.sh - Complete build pipeline that: 1. Bui...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~8-~8: There might be a mistake here.
Context: ...ndle.sh- Complete build pipeline that: 1. Buildssqlite-web-corewithwasm-pack...

(QB_NEW_EN)


[grammar] ~9-~9: Use correct spacing
Context: ...hat: 1. Builds sqlite-web-core with wasm-pack build --target web 2. Embeds WASM into JavaScript worker templ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~10-~10: There might be a mistake here.
Context: ...eds WASM into JavaScript worker template 3. Builds sqlite-web package with embedde...

(QB_NEW_EN)


[grammar] ~11-~11: There might be a mistake here.
Context: ... sqlite-web package with embedded core 4. Packages with npm pack and updates Sve...

(QB_NEW_EN)


[grammar] ~12-~12: Use correct spacing
Context: ...ackand updates Svelte test integration ### Individual Package Builds -cd packages...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 markdownlint-cli2 (0.17.2)

7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


8-8: Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

🤖 Prompt for AI Agents
In CLAUDE.md around lines 7 to 13, the markdown headings and list items lack
required surrounding blank lines and a few step descriptions are wordy; add a
blank line before the "### Main Build Process" heading and ensure there is a
blank line between the heading and the following list, and between the list and
surrounding content to satisfy MD022/MD032; also tighten the four pipeline step
lines to concise phrasing (e.g., "Build sqlite-web-core with wasm-pack build
--target web", "Embed WASM into JS worker template", "Build sqlite-web package
with embedded core", "Package with npm pack and update Svelte test integration")
and fix minor grammar while keeping content unchanged.

### Individual Package Builds
- `cd packages/sqlite-worker-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-worker && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`

### Testing
- `./test.sh` - Run all Rust WASM tests (both packages)
- `cd packages/sqlite-worker-core && wasm-pack test --headless --chrome` - Test core package only
- `cd packages/sqlite-worker && wasm-pack test --headless --chrome` - Test worker package only
- `cd packages/sqlite-web-core && wasm-pack test --headless --chrome` - Test core package only
- `cd packages/sqlite-web && wasm-pack test --headless --chrome` - Test worker package only

Comment on lines 14 to 22

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Add blank lines around headings and lists in “Individual Package Builds” and “Testing”.

This removes MD022/MD032 warnings and improves readability.

-### Individual Package Builds
-- `cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
-- `cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`
+### Individual Package Builds
+
+- `cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
+- `cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`
 
-### Testing
-- `./test.sh` - Run all Rust WASM tests (both packages)
-- `cd packages/sqlite-web-core && wasm-pack test --headless --chrome` - Test core package only
-- `cd packages/sqlite-web && wasm-pack test --headless --chrome` - Test worker package only
+### Testing
+
+- `./test.sh` — run all Rust WASM tests (both packages)
+- `cd packages/sqlite-web-core && wasm-pack test --headless --chrome` — test core package only
+- `cd packages/sqlite-web && wasm-pack test --headless --chrome` — test worker package only
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Individual Package Builds
- `cd packages/sqlite-worker-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-worker && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`
### Testing
- `./test.sh` - Run all Rust WASM tests (both packages)
- `cd packages/sqlite-worker-core && wasm-pack test --headless --chrome` - Test core package only
- `cd packages/sqlite-worker && wasm-pack test --headless --chrome` - Test worker package only
- `cd packages/sqlite-web-core && wasm-pack test --headless --chrome` - Test core package only
- `cd packages/sqlite-web && wasm-pack test --headless --chrome` - Test worker package only
### Individual Package Builds
- `cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg`
- `cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg`
### Testing
- `./test.sh` — run all Rust WASM tests (both packages)
- `cd packages/sqlite-web-core && wasm-pack test --headless --chrome` — test core package only
- `cd packages/sqlite-web && wasm-pack test --headless --chrome` — test worker package only
🧰 Tools
🪛 LanguageTool

[grammar] ~14-~14: Use correct spacing
Context: ...tegration ### Individual Package Builds - cd packages/sqlite-web-core && wasm-pack build --target web --out-dir ../../pkg - cd packages/sqlite-web && wasm-pack build --target web --out-dir ../../pkg ### Testing - ./test.sh - Run all Rust WAS...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~18-~18: Use correct spacing
Context: ...et web --out-dir ../../pkg ### Testing -./test.sh` - Run all Rust WASM tests (both packages...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~19-~19: Use hyphens correctly
Context: ... Run all Rust WASM tests (both packages) - cd packages/sqlite-web-core && wasm-pack test --headless --chrome - Test core package only - `cd packages/...

(QB_NEW_EN_OTHER_ERROR_IDS_29)


[grammar] ~20-~20: Use hyphens correctly
Context: ...dless --chrome- Test core package only -cd packages/sqlite-web && wasm-pack test --headless --chrome` - Test worker package only ### Svelte T...

(QB_NEW_EN_OTHER_ERROR_IDS_29)


[grammar] ~21-~21: There might be a mistake here.
Context: ...ess --chrome- Test worker package only ### Svelte Test App -cd svelte-test && bun...

(QB_NEW_EN_OTHER)

🪛 markdownlint-cli2 (0.17.2)

14-14: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


15-15: Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


18-18: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


19-19: Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

🤖 Prompt for AI Agents
In CLAUDE.md around lines 14 to 22, the headings and their following lists lack
blank lines causing MD022/MD032 warnings; add a single blank line before each
heading and a blank line after each list (i.e., ensure there is an empty line
between the preceding paragraph and "### Individual Package Builds", between
that heading and its list, after that list, and likewise for "### Testing" and
its list) so headings and lists are separated by blank lines to satisfy markdown
linting and improve readability.

### Svelte Test App
- `cd svelte-test && bun dev` - Start development server
Expand All @@ -31,7 +31,7 @@ This is a **Rust WebAssembly SQLite Worker** project with a workspace architectu

### Core Components

#### 1. `packages/sqlite-worker-core/`
#### 1. `packages/sqlite-web-core/`
- **Purpose**: Core SQLite functionality and worker implementation
- **Key modules**:
- `worker.rs` - Main worker entry point called by `worker_main()`
Expand All @@ -42,7 +42,7 @@ This is a **Rust WebAssembly SQLite Worker** project with a workspace architectu
- **Dependencies**: sqlite-wasm-rs, alloy (Ethereum tooling), rain-math-float
- **Output**: WASM module with JS glue code

#### 2. `packages/sqlite-worker/`
#### 2. `packages/sqlite-web/`
- **Purpose**: Public API that creates self-contained workers with embedded core
- **Key files**:
- `lib.rs` - `SQLiteWasmDatabase` struct with async query interface
Expand All @@ -59,13 +59,13 @@ This is a **Rust WebAssembly SQLite Worker** project with a workspace architectu
#### 4. `svelte-test/`
- **Purpose**: Integration test and example usage
- **Technology**: SvelteKit + TypeScript + Vite
- **Pattern**: Imports `sqlite-worker` package from local tarball
- **Pattern**: Imports `sqlite-web` package from local tarball

### Build Process Flow

1. **Core Build**: `sqlite-worker-core` compiled to WASM + JS glue
1. **Core Build**: `sqlite-web-core` compiled to WASM + JS glue
2. **Embedding**: WASM converted to base64 and embedded into JavaScript template
3. **Wrapper Build**: `sqlite-worker` compiled with embedded worker generator
3. **Wrapper Build**: `sqlite-web` compiled with embedded worker generator
4. **Packaging**: NPM package created and integrated into Svelte test
Comment on lines +62 to 69

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Normalize spacing in “Build Process Flow” and add blank lines around the numbered list.

-### Build Process Flow
-
-1. **Core Build**: `sqlite-web-core` compiled to WASM + JS glue
-2. **Embedding**: WASM converted to base64 and embedded into JavaScript template
-3. **Wrapper Build**: `sqlite-web` compiled with embedded worker generator
-4. **Packaging**: NPM package created and integrated into Svelte test
+### Build Process Flow
+
+1. **Core Build**: `sqlite-web-core` compiled to WASM + JS glue
+2. **Embedding**: WASM converted to base64 and embedded into a JavaScript template
+3. **Wrapper Build**: `sqlite-web` compiled with the embedded worker generator
+4. **Packaging**: NPM package created and integrated into the Svelte test app
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Pattern**: Imports `sqlite-web` package from local tarball
### Build Process Flow
1. **Core Build**: `sqlite-worker-core` compiled to WASM + JS glue
1. **Core Build**: `sqlite-web-core` compiled to WASM + JS glue
2. **Embedding**: WASM converted to base64 and embedded into JavaScript template
3. **Wrapper Build**: `sqlite-worker` compiled with embedded worker generator
3. **Wrapper Build**: `sqlite-web` compiled with embedded worker generator
4. **Packaging**: NPM package created and integrated into Svelte test
- **Pattern**: Imports `sqlite-web` package from local tarball
### Build Process Flow
1. **Core Build**: `sqlite-web-core` compiled to WASM + JS glue
2. **Embedding**: WASM converted to base64 and embedded into a JavaScript template
3. **Wrapper Build**: `sqlite-web` compiled with the embedded worker generator
4. **Packaging**: NPM package created and integrated into the Svelte test app
🧰 Tools
🪛 LanguageTool

[grammar] ~62-~62: Use correct spacing
Context: ... sqlite-web package from local tarball ### Build Process Flow 1. Core Build: `...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~64-~64: Use correct spacing
Context: ...om local tarball ### Build Process Flow 1. Core Build: sqlite-web-core compiled...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~66-~66: There might be a mistake here.
Context: ...ite-web-core` compiled to WASM + JS glue 2. Embedding: WASM converted to base64 an...

(QB_NEW_EN)


[grammar] ~67-~67: There might be a mistake here.
Context: ...64 and embedded into JavaScript template 3. Wrapper Build: sqlite-web compiled w...

(QB_NEW_EN)


[grammar] ~68-~68: There might be a mistake here.
Context: ... compiled with embedded worker generator 4. Packaging: NPM package created and int...

(QB_NEW_EN)


[grammar] ~69-~69: Use correct spacing
Context: ... created and integrated into Svelte test ### Key Design Patterns - **Self-contained ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🤖 Prompt for AI Agents
In CLAUDE.md around lines 62 to 69, the "Build Process Flow" section needs
normalized spacing: ensure consistent blank lines before and after the heading
and add a blank line before the numbered list and one after the list ends; also
standardize line breaks within the list so each numbered step is separated by a
single blank line and indentation is consistent.


### Key Design Patterns
Expand Down
Loading