Skip to content

Conversation

@findolor
Copy link
Collaborator

@findolor findolor commented Dec 22, 2025

Motivation

See issues:

The current directory structure does not align with our standard repository conventions. In our other Rust workspace repositories, we use crates/ for Rust workspace crates and packages/ for non-Rust packages (like frontend applications). This PR brings sqlite-web in line with that convention.

Solution

Restructure the repository directories:

  • Rename packages/ to crates/ (contains Rust workspace crates: sqlite-web-core, sqlite-web)
  • Move svelte-test/ to packages/ui/ and rename the package from "svelte-test" to "ui"

Updated all path references in:

  • Cargo.toml (workspace members)
  • Build scripts (scripts/local-bundle.sh, flake.nix)
  • GitHub workflows (npm-release.yaml, test-ui.yaml)
  • IDE config (.vscode/settings.json)
  • .gitignore
  • Documentation (CLAUDE.md)

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Chores
    • Reorganized project layout to a crates-first structure and updated build/test workflows accordingly.
    • Renamed the Svelte test app to "ui" for clarity and updated related configuration.
    • Updated packaging and bundling to align with the new layout and bumped the bundled UI dependency to the next alpha release.

✏️ Tip: You can customize this high-level summary in your review settings.

- Rename packages/ to crates/ for Rust workspace crates
- Move svelte-test/ to packages/ui/
- Rename UI package from "svelte-test" to "ui"
- Update all path references in build scripts and configs
@findolor findolor requested review from 0xgleb and hardyjosh December 22, 2025 08:45
@findolor findolor self-assigned this Dec 22, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 22, 2025

Walkthrough

Repository layout updated: Rust workspace members moved from packages/... to crates/..., the Svelte test app renamed/moved to packages/ui (formerly svelte-test), and CI, build scripts, docs, and ignore rules updated to reflect these path and package-name changes. (47 words)

Changes

Cohort / File(s) Summary
Workspace Manifest & Editor
Cargo.toml, .vscode/settings.json
Workspace members and rust-analyzer linkedProjects updated from packages/sqlite-web(-core) to crates/sqlite-web(-core).
CI Workflows
.github/workflows/npm-release.yaml, .github/workflows/test-ui.yaml
Working directories changed from svelte-test to packages/ui; npm-release version-bump/commit steps updated to stage crates/sqlite-web/Cargo.toml and crates/sqlite-web-core/Cargo.toml.
Build & Packaging Scripts
scripts/local-bundle.sh
All workspace references switched from packages/* to crates/*; packaging, embedded_worker generation, npm pack, version sync, and artifact paths adjusted to crates layout and updated npm metadata steps.
Nix / CI Task Specs
flake.nix
Test/build-wasm task paths updated to reference crates/...; test-ui workflow navigation adjusted to packages/ui path.
UI App Package
packages/ui/package.json
Package renamed from svelte-testui; @rainlanguage/sqlite-web dependency file path/version updated to file:../../pkg/rainlanguage-sqlite-web-0.0.1-alpha.10.tgz.
PKG metadata
pkg/package.json
Only trailing newline/formatting change (no functional edits).
Ignore Rules & Docs
.gitignore, CLAUDE.md
Ignored generated file path moved to crates/sqlite-web/src/embedded_worker.js; docs revised to reference crates/... and rename Svelte test app section to UI app.

Sequence Diagram(s)

(Skipped — changes are repository reorganization, not a new multi-component control flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • hardyjosh
  • 0xgleb
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: renaming packages/ to crates/ and svelte-test/ to packages/ui/.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom Pre-merge checks in the settings.


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

@findolor findolor changed the title Rename packages/ to crates/ and svelte-test/ to packages/ui/ Rename packages/ to crates/ and svelte-test/ to packages/ui/ Dec 22, 2025
@findolor findolor changed the title Rename packages/ to crates/ and svelte-test/ to packages/ui/ Rename packages/ to crates/ and svelte-test/ to packages/ui/ Dec 22, 2025
@findolor findolor linked an issue Dec 22, 2025 that may be closed by this pull request
Resolved version conflicts (0.0.1-alpha.10) in:
- Cargo.lock
- packages/ui/package.json
- packages/ui/package-lock.json
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/ui/package.json:
- Line 44: The dependency entry for "@rainlanguage/sqlite-web" is using the
wrong tarball name (missing the leading '@'); update the dependency value in
package.json to either reference the packed tarball with the correct name
"file:../../pkg/@rainlanguage-sqlite-web-0.0.1-alpha.10.tgz" or point to the
package directory "file:../../pkg/" so npm can resolve it; ensure the string for
the dependency key "@rainlanguage/sqlite-web" is preserved and run the build
(npm pack or the existing local-bundle.sh) to confirm the referenced tarball
name matches the file generated.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6a3191 and 7e0846b.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • packages/ui/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • crates/sqlite-web-core/Cargo.toml
  • crates/sqlite-web-core/src/coordination.rs
  • crates/sqlite-web-core/src/messages.rs
  • crates/sqlite-web-core/src/worker.rs
  • crates/sqlite-web/Cargo.toml
  • crates/sqlite-web/src/tests.rs
  • crates/sqlite-web/src/worker_template.rs
  • packages/ui/package.json
  • packages/ui/src/routes/sql/+page.svelte
  • pkg/package.json
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-17T06:55:20.178Z
Learnt from: CR
Repo: rainlanguage/sqlite-web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to svelte-test/package.json : In the Svelte test app, depend on the sqlite-web package via the locally packed tarball produced by npm pack

Applied to files:

  • packages/ui/package.json
📚 Learning: 2025-08-21T15:09:22.737Z
Learnt from: findolor
Repo: rainlanguage/sqlite-web PR: 2
File: flake.nix:59-68
Timestamp: 2025-08-21T15:09:22.737Z
Learning: In the sqlite-web project, the build-submodules task in flake.nix successfully builds the lib/rain.math.float submodule with `forge build` even if foundry.toml is not immediately visible in the expected location. The build process works as intended according to the project maintainer.

Applied to files:

  • packages/ui/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test
  • GitHub Check: test
🔇 Additional comments (2)
pkg/package.json (1)

15-15: LGTM! Formatting improvement.

This trailing newline addition follows standard JSON formatting conventions with no functional impact.

packages/ui/package.json (1)

2-2: LGTM! Package name updated correctly.

The package name change from "svelte-test" to "ui" aligns with the PR objectives and directory restructure.

"dependencies": {
"@rainlanguage/float": "^0.0.0-alpha.22",
"@rainlanguage/sqlite-web": "file:../pkg/rainlanguage-sqlite-web-0.0.1-alpha.9.tgz"
"@rainlanguage/sqlite-web": "file:../../pkg/rainlanguage-sqlite-web-0.0.1-alpha.10.tgz"
Copy link

@coderabbitai coderabbitai bot Jan 7, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the tarball exists at the expected location
echo "=== Checking for tarball ==="
if [ -f "pkg/rainlanguage-sqlite-web-0.0.1-alpha.10.tgz" ]; then
  echo "✓ Tarball exists at pkg/rainlanguage-sqlite-web-0.0.1-alpha.10.tgz"
  ls -lh "pkg/rainlanguage-sqlite-web-0.0.1-alpha.10.tgz"
else
  echo "✗ Tarball NOT found at pkg/rainlanguage-sqlite-web-0.0.1-alpha.10.tgz"
  echo "Available files in pkg/:"
  ls -la pkg/ 2>/dev/null || echo "pkg/ directory does not exist"
fi

# Search for any remaining references to "svelte-test" package name
echo -e "\n=== Checking for remaining 'svelte-test' references ==="
rg -n 'svelte-test' --type-list | head -20 2>/dev/null || echo "rg type list check"
rg -n 'svelte-test' -g '!CHANGELOG*' -g '!*.lock' -g '!node_modules' 2>/dev/null | head -50 || echo "No references found"

# Also check if svelte-test/package.json exists and what it depends on
echo -e "\n=== Checking svelte-test/package.json ==="
if [ -f "svelte-test/package.json" ]; then
  echo "Found svelte-test/package.json"
  grep -A2 -B2 "@rainlanguage/sqlite-web" svelte-test/package.json || echo "No @rainlanguage/sqlite-web dependency found"
else
  echo "svelte-test/package.json not found"
fi

# Check packages/ui/package.json to confirm the path
echo -e "\n=== Checking packages/ui/package.json ==="
if [ -f "packages/ui/package.json" ]; then
  grep -A2 -B2 "@rainlanguage/sqlite-web" packages/ui/package.json
fi

Repository: rainlanguage/sqlite-web

Length of output: 1106


🏁 Script executed:

#!/bin/bash
# Check what's in pkg/package.json
echo "=== Content of pkg/package.json ==="
cat pkg/package.json

# Search for any .tgz files in the repository
echo -e "\n=== Searching for .tgz files ==="
fd -e tgz -type f

# Check if there's a build output or dist directory
echo -e "\n=== Checking for build artifacts ==="
ls -la packages/ui/ 2>/dev/null | head -20
echo "---"
ls -la packages/ 2>/dev/null | grep -v node_modules

# Check git status or recent changes
echo -e "\n=== Checking what's in packages/ui ==="
fd . packages/ui -type f -name "*.json" -o -name "*.tgz" | head -20

Repository: rainlanguage/sqlite-web

Length of output: 2079


🏁 Script executed:

#!/bin/bash
# List all files in pkg/ directory recursively
echo "=== All files in pkg/ directory ==="
find pkg -type f -o -type d | sort

# Check if the built files exist
echo -e "\n=== Checking for built files in pkg/ ==="
ls -la pkg/*.wasm pkg/*.js pkg/*.d.ts 2>&1

# Look at the learning note - check if there are any scripts that should create the tarball
echo -e "\n=== Checking root and scripts ==="
head -50 package.json

# Check if there's a build or pack script
echo -e "\n=== Package scripts ==="
grep -A 10 '"scripts"' package.json

Repository: rainlanguage/sqlite-web

Length of output: 532


🏁 Script executed:

#!/bin/bash
# Find all package.json files to understand the structure
echo "=== All package.json files ==="
find . -name "package.json" -type f | sort

# Check if there's a top-level configuration
echo -e "\n=== Top-level files ==="
ls -la | head -20

# Look at packages/ui/package.json to see all dependencies
echo -e "\n=== packages/ui/package.json full content ==="
cat packages/ui/package.json

# Check packages/ui/.npmrc or other configs
echo -e "\n=== npm/workspace configs ==="
ls -la packages/ui/

Repository: rainlanguage/sqlite-web

Length of output: 3815


🏁 Script executed:

#!/bin/bash
# Check CLAUDE.md for context
echo "=== Content of CLAUDE.md ==="
cat CLAUDE.md

Repository: rainlanguage/sqlite-web

Length of output: 3822


🏁 Script executed:

#!/bin/bash
# Check if bundle.sh exists and what it does
echo "=== Content of bundle.sh ==="
cat bundle.sh 2>/dev/null || echo "bundle.sh not found"

# Also check for any other scripts
echo -e "\n=== Scripts directory ==="
ls -la scripts/

# Check git log to see if bundle.sh was recently changed
echo -e "\n=== Recent git changes to understand this PR ==="
git log --oneline -20

Repository: rainlanguage/sqlite-web

Length of output: 421


🏁 Script executed:

#!/bin/bash
# Check local-bundle.sh
echo "=== Content of local-bundle.sh ==="
cat scripts/local-bundle.sh

# Check git diff to see what changed in this PR
echo -e "\n=== Recent git changes ==="
git log --oneline -5
git show --stat HEAD

# Check if there's any reference to the tarball name
echo -e "\n=== Searching for tarball references ==="
rg "rainlanguage-sqlite-web-0.0.1-alpha.10.tgz" -g "!.git"

Repository: rainlanguage/sqlite-web

Length of output: 11452


🏁 Script executed:

#!/bin/bash
# Check how npm pack names scoped packages
# Look at pkg/package.json to see the actual name
echo "=== Package name in pkg/package.json ==="
jq '.name' pkg/package.json

# Simulate what npm pack would create
echo -e "\n=== Expected npm pack filename for scoped packages ==="
PKG_NAME=$(jq -r '.name' pkg/package.json)
PKG_VERSION=$(jq -r '.version' pkg/package.json)
echo "Package name: $PKG_NAME"
echo "Version: $PKG_VERSION"
echo "Expected npm pack filename: ${PKG_NAME#@}-${PKG_VERSION}.tgz"
echo "Which would be: @rainlanguage-sqlite-web-0.0.1-alpha.10.tgz"

# Check what's in git to see if bundle was run
echo -e "\n=== Check if pkg directory is tracked ==="
git ls-files pkg/ 2>/dev/null || echo "pkg/ not in git"

# See what's in git status
echo -e "\n=== Git status ==="
git status --short 2>/dev/null | head -20

Repository: rainlanguage/sqlite-web

Length of output: 153


🏁 Script executed:

#!/bin/bash
# Just check the package name in pkg/package.json
echo "=== Package name ==="
grep '"name"' pkg/package.json

# Check git info
echo -e "\n=== Git status of packages/ui/package.json ==="
git diff packages/ui/package.json | head -30

Repository: rainlanguage/sqlite-web

Length of output: 173


Fix incorrect tarball filename in dependency reference.

The dependency path references rainlanguage-sqlite-web-0.0.1-alpha.10.tgz, but this tarball does not exist and cannot be created with this filename. When npm pack runs on the scoped package @rainlanguage/sqlite-web, it generates @rainlanguage-sqlite-web-0.0.1-alpha.10.tgz (note the @ prefix). The current reference is missing the @ and will cause npm install to fail.

Either:

  1. Update the path to file:../../pkg/@rainlanguage-sqlite-web-0.0.1-alpha.10.tgz, or
  2. Reference the directory directly with file:../../pkg/ and let npm resolve the package.json

The local-bundle.sh script already handles this correctly by using npm pkg set dependencies."@rainlanguage/sqlite-web"="file:../../pkg/${PACK_FILE}" to dynamically set the correct filename. Run the build script to generate the tarball and update the reference properly.

🤖 Prompt for AI Agents
In @packages/ui/package.json at line 44, The dependency entry for
"@rainlanguage/sqlite-web" is using the wrong tarball name (missing the leading
'@'); update the dependency value in package.json to either reference the packed
tarball with the correct name
"file:../../pkg/@rainlanguage-sqlite-web-0.0.1-alpha.10.tgz" or point to the
package directory "file:../../pkg/" so npm can resolve it; ensure the string for
the dependency key "@rainlanguage/sqlite-web" is preserved and run the build
(npm pack or the existing local-bundle.sh) to confirm the referenced tarball
name matches the file generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a false positive. The tarball naming convention (without the @ prefix) has been this way since the project started and works correctly.

On main branch, the reference was:

"file:../pkg/rainlanguage-sqlite-web-0.0.1-alpha.9.tgz"

The only changes in this PR are:

  1. Path depth: ../pkg/../../pkg/ (due to svelte-test/packages/ui/ move)
  2. Version bump from the merge

The local-bundle.sh script produces rainlanguage-sqlite-web-*.tgz (without @), and npm install succeeds. No changes needed here.

Copy link

Choose a reason for hiding this comment

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

@findolor, thank you for the clarification! You're absolutely right—I apologize for the false positive.

The tarball naming convention without the @ prefix has been working correctly in your project, and the changes in this PR (path depth adjustment from ../pkg/ to ../../pkg/ and the version bump) are appropriate given the directory restructuring from svelte-test/ to packages/ui/.

Since local-bundle.sh produces rainlanguage-sqlite-web-*.tgz and npm install succeeds with this naming, no changes are needed here. Thanks for taking the time to explain the existing behavior!


🧠 Learnings used
Learnt from: CR
Repo: rainlanguage/sqlite-web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to svelte-test/package.json : In the Svelte test app, depend on the sqlite-web package via the locally packed tarball produced by npm pack

Learnt from: CR
Repo: rainlanguage/sqlite-web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web/embedded_worker.js : Do not manually edit embedded_worker.js; it is generated by the build and should be treated as read-only

Learnt from: CR
Repo: rainlanguage/sqlite-web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries

Learnt from: CR
Repo: rainlanguage/sqlite-web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-17T06:55:20.178Z
Learning: Applies to packages/sqlite-web/worker_template.rs : Ensure the worker JavaScript generated by worker_template.rs embeds the WASM (base64) and does not fetch external WASM files

Learnt from: findolor
Repo: rainlanguage/sqlite-web PR: 5
File: svelte-test/tests/database-functions/bigint-sum.test.ts:2-7
Timestamp: 2025-08-27T05:59:04.254Z
Learning: In the sqlite-web repository, the user prefers to keep .js extensions when importing TypeScript files in test files, even in Vitest environments. This is acceptable and should not be flagged as an issue.

Learnt from: findolor
Repo: rainlanguage/sqlite-web PR: 2
File: .github/workflows/npm-release.yaml:79-85
Timestamp: 2025-08-21T12:24:24.620Z
Learning: The rainlanguage organization uses workflows that commit pkg/package.json as part of their NPM release process across multiple repositories, and this pattern works fine for their setup.

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.

Move rust logic to /crates and typescript logic to /packages

2 participants