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 internal project structure and updated build configuration files to align with current development setup.
    • Updated package version to alpha.8 with corresponding dependency references.
    • Updated UI application naming and configuration for consistency with updated project layout.

✏️ 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

This pull request reorganizes the repository structure by relocating Rust workspace components from packages/ to crates/ directories and renaming the Svelte test application from svelte-test to packages/ui. The changes update all configuration files, CI/CD workflows, build scripts, and documentation to reflect this new directory hierarchy.

Changes

Cohort / File(s) Summary
Workspace Configuration
Cargo.toml, .vscode/settings.json
Updated workspace member paths from packages/sqlite-web-core and packages/sqlite-web to crates/sqlite-web-core and crates/sqlite-web; updated VSCode rust-analyzer linked projects accordingly.
CI/CD Workflows
.github/workflows/npm-release.yaml, .github/workflows/test-ui.yaml
Updated working directories for Playwright installation and UI tasks from svelte-test to packages/ui; updated version bump and commit steps to reference Rust crate Cargo.toml files in crates/ instead of packages/.
Build Automation
scripts/local-bundle.sh, flake.nix
Updated all workspace references, build paths, and embedded worker paths to use crates/ structure; adjusted test-ui workflow navigation and build/packaging steps to reflect new directory hierarchy.
Project Structure & Ignore Rules
.gitignore, CLAUDE.md
Updated generated file paths and all directory references from packages/ to crates/ for core components; renamed Svelte test section to UI app and updated related command paths; reorganized component documentation to reflect new structure.
Package Configuration
packages/ui/package.json, pkg/package.json
Updated package name from svelte-test to ui; bumped @rainlanguage/sqlite-web dependency version from 0.0.1-alpha.7 to 0.0.1-alpha.8; minor formatting fix to pkg/package.json.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • scripts/local-bundle.sh — Complex build automation script with multiple path transformations, package metadata updates, and version syncing logic; verify all path references and build output stages remain functional.
  • .github/workflows/npm-release.yaml — Critical CI/CD workflow affecting release process; ensure version bumping and commit staging correctly target new crate paths.
  • packages/ui/package.json — Dependency version change alongside directory rename; confirm version alignment with published artifacts and path correctness for ../../pkg.

Possibly related PRs

Suggested reviewers

  • hardyjosh
  • 0xgleb

Pre-merge checks and finishing touches

✅ 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 primary structural changes in the pull request: 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.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-12-22-directory-renaming

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

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

⛔ Files ignored due to path filters (4)
  • Cargo.lock is excluded by !**/*.lock
  • packages/ui/bun.lock is excluded by !**/*.lock
  • packages/ui/package-lock.json is excluded by !**/package-lock.json
  • packages/ui/src/lib/assets/favicon.svg is excluded by !**/*.svg
📒 Files selected for processing (66)
  • .github/workflows/npm-release.yaml
  • .github/workflows/test-ui.yaml
  • .gitignore
  • .vscode/settings.json
  • CLAUDE.md
  • Cargo.toml
  • crates/sqlite-web-core/Cargo.toml
  • crates/sqlite-web-core/src/coordination.rs
  • crates/sqlite-web-core/src/database.rs
  • crates/sqlite-web-core/src/database_functions/bigint_sum.rs
  • crates/sqlite-web-core/src/database_functions/float_is_zero.rs
  • crates/sqlite-web-core/src/database_functions/float_negate.rs
  • crates/sqlite-web-core/src/database_functions/float_sum.rs
  • crates/sqlite-web-core/src/database_functions/float_zero_hex.rs
  • crates/sqlite-web-core/src/database_functions/mod.rs
  • crates/sqlite-web-core/src/lib.rs
  • crates/sqlite-web-core/src/messages.rs
  • crates/sqlite-web-core/src/util.rs
  • crates/sqlite-web-core/src/worker.rs
  • crates/sqlite-web/Cargo.toml
  • crates/sqlite-web/src/db.rs
  • crates/sqlite-web/src/errors.rs
  • crates/sqlite-web/src/lib.rs
  • crates/sqlite-web/src/messages.rs
  • crates/sqlite-web/src/params.rs
  • crates/sqlite-web/src/ready.rs
  • crates/sqlite-web/src/tests.rs
  • crates/sqlite-web/src/utils.rs
  • crates/sqlite-web/src/worker.rs
  • crates/sqlite-web/src/worker_template.rs
  • flake.nix
  • packages/ui/.eslintignore
  • packages/ui/.gitignore
  • packages/ui/.npmrc
  • packages/ui/README.md
  • packages/ui/eslint.config.js
  • packages/ui/package.json
  • packages/ui/src/app.d.ts
  • packages/ui/src/app.html
  • packages/ui/src/lib/index.ts
  • packages/ui/src/routes/+layout.svelte
  • packages/ui/src/routes/+page.svelte
  • packages/ui/src/routes/sql/+page.svelte
  • packages/ui/static/robots.txt
  • packages/ui/svelte.config.js
  • packages/ui/tests/database-functions/bigint-sum.test.ts
  • packages/ui/tests/database-functions/float-is-zero.test.ts
  • packages/ui/tests/database-functions/float-negate.test.ts
  • packages/ui/tests/database-functions/float-sum.test.ts
  • packages/ui/tests/database-functions/float-zero-hex.test.ts
  • packages/ui/tests/fixtures/float-utils.ts
  • packages/ui/tests/fixtures/test-data.sql
  • packages/ui/tests/fixtures/test-helpers.ts
  • packages/ui/tests/global-setup.js
  • packages/ui/tests/integration/database-basic.test.ts
  • packages/ui/tests/integration/error-handling.test.ts
  • packages/ui/tests/integration/multi-sql-commands.test.ts
  • packages/ui/tests/integration/opfs-persistence.test.ts
  • packages/ui/tests/integration/parameter-binding.test.ts
  • packages/ui/tests/integration/worker-communication.test.ts
  • packages/ui/tests/test-setup.js
  • packages/ui/tsconfig.json
  • packages/ui/vite.config.ts
  • packages/ui/vitest.config.js
  • pkg/package.json
  • scripts/local-bundle.sh
🧰 Additional context used
🧠 Learnings (12)
📚 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 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

Applied to files:

  • .gitignore
  • flake.nix
  • CLAUDE.md
  • .github/workflows/npm-release.yaml
  • scripts/local-bundle.sh
📚 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 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

Applied to files:

  • .gitignore
  • .vscode/settings.json
  • Cargo.toml
  • flake.nix
  • CLAUDE.md
  • .github/workflows/npm-release.yaml
  • scripts/local-bundle.sh
📚 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 packages/sqlite-web-core/src/worker.rs : Keep worker.rs as the main worker entry point invoked by worker_main()

Applied to files:

  • .gitignore
  • .vscode/settings.json
  • Cargo.toml
  • flake.nix
  • CLAUDE.md
  • scripts/local-bundle.sh
📚 Learning: 2025-08-27T05:59:04.254Z
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.

Applied to files:

  • .gitignore
  • CLAUDE.md
📚 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:

  • .gitignore
  • .github/workflows/test-ui.yaml
  • flake.nix
  • packages/ui/package.json
  • CLAUDE.md
  • .github/workflows/npm-release.yaml
  • scripts/local-bundle.sh
📚 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 packages/sqlite-web-core/src/messages.rs : Use structured message types for worker communication as defined in messages.rs

Applied to files:

  • .gitignore
  • Cargo.toml
  • flake.nix
  • CLAUDE.md
  • scripts/local-bundle.sh
📚 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: Maintain self-contained workers with no external WASM file dependencies across the project

Applied to files:

  • .gitignore
  • CLAUDE.md
  • scripts/local-bundle.sh
📚 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:

  • flake.nix
  • packages/ui/package.json
  • CLAUDE.md
  • scripts/local-bundle.sh
📚 Learning: 2025-09-19T07:06:20.173Z
Learnt from: findolor
Repo: rainlanguage/sqlite-web PR: 14
File: svelte-test/tests/database-functions/float-is-zero.test.ts:39-57
Timestamp: 2025-09-19T07:06:20.173Z
Learning: PRAGMA function_list is not available in the WASM SQLite test environment used by svelte-test, so availability testing should rely on direct function calls rather than PRAGMA queries.

Applied to files:

  • flake.nix
  • CLAUDE.md
📚 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 packages/sqlite-web/lib.rs : Expose an async, promise-based query interface from the SQLiteWasmDatabase public API

Applied to files:

  • flake.nix
  • CLAUDE.md
📚 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 packages/sqlite-web-core/src/database_functions.rs : Integrate and expose rain.math.float-backed custom database functions for SQLite queries

Applied to files:

  • CLAUDE.md
📚 Learning: 2025-09-15T06:11:31.781Z
Learnt from: findolor
Repo: rainlanguage/sqlite-web PR: 9
File: packages/sqlite-web-core/src/coordination.rs:52-65
Timestamp: 2025-09-15T06:11:31.781Z
Learning: In packages/sqlite-web-core/src/coordination.rs, the pattern of using `db.borrow_mut().take()` followed by async database operations and then putting the database back with `*db.borrow_mut() = Some(database)` is safe in their use case and doesn't cause concurrent access issues or "Database not initialized" errors.

Applied to files:

  • CLAUDE.md
🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md

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

(MD022, blanks-around-headings)


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

(MD022, blanks-around-headings)


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

(MD022, blanks-around-headings)


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

(MD022, blanks-around-headings)


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

(MD022, blanks-around-headings)

⏰ 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 (27)
pkg/package.json (1)

15-15: LGTM!

The addition of a trailing newline is a minor formatting improvement that aligns with standard conventions for text files. The npm package declaration remains accurate and unchanged.

.gitignore (1)

6-6: LGTM!

The path update correctly reflects the relocation of the generated embedded_worker.js file from packages/sqlite-web/src/ to crates/sqlite-web/src/.

flake.nix (3)

18-23: LGTM!

The path updates in the test-wasm task correctly reflect the relocation from packages/ to crates/ for both sqlite-web-core and sqlite-web.


31-37: LGTM!

The path updates in the build-wasm task correctly reflect the relocation from packages/ to crates/ for both sqlite-web-core and sqlite-web.


53-55: LGTM!

The path update in the test-ui task correctly reflects the relocation from svelte-test/ to packages/ui/.

packages/ui/package.json (2)

2-2: LGTM!

The package name change from "svelte-test" to "ui" correctly aligns with the PR objective to rename the Svelte test app to a UI package.


44-44: Verify the version bump is intentional.

The dependency path update from file:../pkg/ to file:../../pkg/ correctly reflects the deeper directory nesting after moving from svelte-test/ to packages/ui/. However, the version was also bumped from alpha.7 to alpha.8. Please confirm this version change is intentional and not an unrelated modification that should be in a separate commit.

Cargo.toml (1)

3-4: LGTM!

The workspace member paths correctly reflect the relocation from packages/ to crates/ for both sqlite-web-core and sqlite-web.

.github/workflows/test-ui.yaml (2)

45-46: LGTM!

The working directory update correctly reflects the relocation from svelte-test to packages/ui for the Playwright browser installation step.


52-53: LGTM!

The working directory update correctly reflects the relocation from svelte-test to packages/ui for the frontend linting and formatting step.

.vscode/settings.json (1)

8-9: LGTM!

The rust-analyzer.linkedProjects paths correctly reflect the relocation from packages/ to crates/ for both sqlite-web-core and sqlite-web. This ensures the VSCode Rust analyzer can find the correct Cargo.toml files.

.github/workflows/npm-release.yaml (3)

39-40: LGTM!

The working directory update correctly reflects the relocation from svelte-test to packages/ui for the Playwright browser installation step.


75-78: LGTM!

The manifest loop correctly updates the paths from packages/ to crates/ for both sqlite-web/Cargo.toml and sqlite-web-core/Cargo.toml, ensuring version bumps are applied to the relocated files.


84-84: LGTM!

The git add command correctly stages the relocated Cargo.toml files at crates/sqlite-web/Cargo.toml and crates/sqlite-web-core/Cargo.toml.

CLAUDE.md (8)

15-16: LGTM!

The build command paths correctly reflect the relocation from packages/ to crates/ for both sqlite-web-core and sqlite-web.


20-21: LGTM!

The test command paths correctly reflect the relocation from packages/ to crates/ for both sqlite-web-core and sqlite-web.


23-26: LGTM!

The section title and command paths correctly reflect the renaming from "Svelte Test App" to "UI App" and the relocation from svelte-test to packages/ui.


30-30: LGTM!

The architecture description correctly updates the terminology from "two main packages" to "two main crates", aligning with Rust conventions and the directory restructuring.


34-43: LGTM!

The component heading and description correctly reflect the relocation from packages/sqlite-web-core/ to crates/sqlite-web-core/.


45-52: LGTM!

The component heading and description correctly reflect the relocation from packages/sqlite-web/ to crates/sqlite-web/.


59-62: LGTM!

The component heading, description, and purpose correctly reflect the relocation from svelte-test/ to packages/ui/ and the conceptual shift from "test" to "UI app".


69-69: LGTM!

The build process flow reference correctly updates from "Svelte test integration" to "UI app", aligning with the renaming.

scripts/local-bundle.sh (5)

12-17: LGTM! Core package paths correctly updated.

The path updates from packages/ to crates/ are consistent with the PR objectives. The directory navigation logic correctly returns to the repository root after building the core package.


32-103: LGTM! Embedded worker generation paths correctly updated.

All embedded worker template and assembly operations now correctly reference the crates/sqlite-web/src/ directory. The sed/awk pipeline that combines the template, JS glue, and base64-encoded WASM uses the updated paths consistently.

Based on learnings, this generated embedded_worker.js correctly maintains the self-contained worker with embedded WASM.


105-113: LGTM! Main package build paths correctly updated.

The main package build correctly navigates to crates/sqlite-web and the success message accurately reflects the new directory structure. The output directory (../../pkg) correctly resolves to the repository root.


125-125: LGTM! Version syncing path correctly updated.

The Cargo.toml path is correctly updated to crates/sqlite-web/Cargo.toml, ensuring version synchronization works with the new directory structure.


142-148: LGTM! UI integration paths correctly updated.

The paths have been properly updated to reflect the move from svelte-test/ to packages/ui/. The relative path calculation at line 145 (../../pkg/${PACK_FILE}) is correct: from packages/ui/, going up two levels reaches the repository root, then into pkg/. The return navigation (cd ../..) is also correct.

Based on learnings, this correctly maintains the dependency on the locally packed tarball.


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
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