Skip to content

feat(core): wire worldscript_project_validate Tauri command (Wave 2 PR B) - #426

Merged
qnbs merged 2 commits into
mainfrom
feat/tauri-project-core-command
Aug 20, 2026
Merged

feat(core): wire worldscript_project_validate Tauri command (Wave 2 PR B)#426
qnbs merged 2 commits into
mainfrom
feat/tauri-project-core-command

Conversation

@qnbs

@qnbs qnbs commented Aug 20, 2026

Copy link
Copy Markdown
Owner

User description

Summary

  • Wave 2's optional PR B (from the approved plan): wires one real Tauri command, worldscript_project_validate, to the renderer-neutral worldscript-project Rust Core crate (docs/native/CORE-MIGRATION-LEDGER.md).
  • New src-tauri/src/commands/project_core.rs runs parse → migrate-to-latest → validate via the crate, returning a structured ProjectValidationResult — never Err, matching commands::task_supervisor's honest-failure convention.
  • worldscript-project added as a path dependency in src-tauri/Cargo.toml, even though it's a member of the separate crates/ Cargo workspace. Confirmed this cross-workspace path dependency compiles/links cleanly (cargo check/test/clippy all pass) without unifying the two workspaces — keeps the original Wave 2 PR 1 decision (crates/ stays independent from src-tauri/) intact.

Explicitly out of scope

  • No frontend call site — services/desktopPlatform.ts, services/fs/projectFsStore.ts, and services/storageService.ts's dispatch are untouched. This PR only proves the Tauri ↔ Rust Core command boundary compiles and runs correctly.

Test plan

  • cargo test --lib in src-tauri/ — 23/23 pass (4 new: valid-schema-v2 passes, v1-migrates-then-validates, corrupt-JSON structured failure, duplicate-character-id validation failure)
  • cargo clippy --lib -- -D warnings — clean
  • cargo fmt --check — clean
  • CI green (core-rust + Tauri Rust Gate jobs)

Summary by Sourcery

Wire project validation from the Tauri command boundary to the worldscript-project core crate.

New Features:

  • Expose project validation through the desktop Tauri command surface, including parsing, schema migration, and validation with structured results.

Enhancements:

  • Report parse, migration, and validation failures as honest structured responses rather than command errors.
  • Integrate the renderer-neutral worldscript-project core crate as a path dependency while preserving the independent workspace boundary.

Build:

  • Add the worldscript-project Rust core crate as a src-tauri path dependency and update the lockfile.

Tests:

  • Add coverage for current-schema validation, legacy-schema migration, malformed JSON, and duplicate character IDs.

CodeAnt-AI Description

Expose project validation through the desktop application

What Changed

  • Adds a desktop command that parses project JSON, upgrades older projects to the current schema, and validates the result
  • Returns a structured success or failure response, including the schema version and a readable error instead of failing unexpectedly
  • Detects invalid JSON and project problems such as duplicate character IDs

Impact

✅ Reliable project validation results
✅ Automatic validation of older project formats
✅ Clearer project data errors

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features

    • Added project validation for project-envelope JSON.
    • Automatically migrates supported v1 projects during validation.
    • Reports validation status, schema version, and clear errors for malformed or invalid projects.
    • Detects issues such as duplicate character IDs without crashing the application.
    • Made validation results available to the application interface for reliable project checks.
  • Tests

    • Added coverage for valid projects, migrations, malformed data, and duplicate character IDs.

…R B)

Strangler proof point per docs/native/CORE-MIGRATION-LEDGER.md's Wave
2 plan: a new src-tauri/src/commands/project_core.rs exposes
worldscript_project_validate, delegating to the renderer-neutral
worldscript-project crate (parse -> migrate to current schema ->
validate) instead of any Tauri-local logic.

worldscript-project is added as a path dependency in src-tauri's
Cargo.toml, referencing a crate that is itself a member of the
separate crates/ Cargo workspace - confirmed this cross-workspace
path dependency compiles and links cleanly (cargo check/test/clippy
all pass) without requiring the two workspaces to be unified, keeping
the Wave 2 PR 1 decision to keep them independent intact.

Backend-only: no frontend call site, no changes to
services/desktopPlatform.ts or services/fs/projectFsStore.ts /
services/storageService.ts's dispatch. This only proves the Tauri <->
Rust Core command boundary compiles and runs correctly; wiring an
actual frontend caller is separate, later work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@codeant-ai

codeant-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 6cf61a3 Aug 20, 2026 · 11:01 11:06

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @qnbs, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@codeant-ai

codeant-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldscript-studio Ready Ready Preview Aug 20, 2026 11:08am

@sourcery-ai

sourcery-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

Wires a new Tauri command into the existing Rust backend that delegates project JSON parse/migrate/validate to the worldscript-project core crate, adds the crate as a path dependency, and exposes the command to the Tauri runtime with structured success/failure results and tests covering main validation paths.

Sequence diagram for worldscript_project_validate Tauri command pipeline

sequenceDiagram
    participant TauriRuntime
    participant project_core as worldscript_project_validate
    participant CoreCrate as worldscript_project

    TauriRuntime->>project_core: worldscript_project_validate(project_json)
    project_core->>CoreCrate: parse_envelope(project_json)
    alt [parse_envelope Ok]
        CoreCrate-->>project_core: envelope
        project_core->>CoreCrate: migrate_to_latest(envelope)
        alt [migrate_to_latest Ok]
            CoreCrate-->>project_core: migrated
            project_core->>CoreCrate: validate(migrated.project)
            alt [validate Ok]
                CoreCrate-->>project_core: ()
                project_core-->>TauriRuntime: ProjectValidationResult{ valid: true, schema_version: Some(migrated.schema_version), error: None }
            else [validate Err]
                CoreCrate-->>project_core: error
                project_core-->>TauriRuntime: ProjectValidationResult{ valid: false, schema_version: Some(migrated.schema_version), error: Some(error) }
            end
        else [migrate_to_latest Err]
            CoreCrate-->>project_core: error
            project_core-->>TauriRuntime: ProjectValidationResult{ valid: false, schema_version: None, error: Some(error) }
        end
    else [parse_envelope Err]
        CoreCrate-->>project_core: error
        project_core-->>TauriRuntime: ProjectValidationResult{ valid: false, schema_version: None, error: Some(error) }
    end
Loading

File-Level Changes

Change Details Files
Add worldscript-project core crate as a path dependency of the src-tauri backend.
  • Declare worldscript-project as a path dependency pointing at ../crates/worldscript-project in Cargo.toml
  • Update Cargo.lock to include the new dependency entries
src-tauri/Cargo.toml
src-tauri/Cargo.lock
Introduce a renderer-neutral project validation command implemented via the worldscript-project crate and expose it through Tauri.
  • Create commands::project_core module and export it from commands::mod.rs
  • Define ProjectValidationResult DTO with camelCase serialization and optional schema_version/error fields
  • Implement worldscript_project_validate Tauri command that parses, migrates, and validates project envelopes via parse_envelope, migrate_to_latest, and validate, always returning a ProjectValidationResult instead of Err
  • Register the new worldscript_project_validate command in the Tauri builder so it is callable from the frontend
src-tauri/src/commands/mod.rs
src-tauri/src/commands/project_core.rs
src-tauri/src/lib.rs
Add focused unit tests to verify the command’s behavior across happy-path, migration, and failure scenarios.
  • Test validation of already-current schema (v2) envelopes
  • Test migration from v1 to v2 before validation
  • Test corrupt JSON handling as a structured failure without panicking
  • Test validation failure on duplicate character IDs with schema_version preserved in the result
src-tauri/src/commands/project_core.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 20, 2026

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR successfully implements the Wave 2 PR B milestone by wiring the worldscript_project_validate Tauri command to the worldscript-project Rust Core crate. The implementation follows best practices with proper error handling, comprehensive test coverage (4 tests covering valid schema, migration, corrupt JSON, and validation failures), and adheres to the honest-failure convention established in the codebase.

Key strengths:

  • Structured error handling returns results instead of panicking
  • Cross-workspace path dependency is correctly configured
  • Tests verify parse → migrate → validate pipeline
  • Backend-only implementation aligns with stated scope

The code compiles cleanly and is ready for merge based on the test plan verification in the PR description.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 140c1afc-309f-46f6-89d2-99df41288346

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e5577a0-2e85-4f41-8fe3-b72bb43bf5c2

📥 Commits

Reviewing files that changed from the base of the PR and between 6cf61a3 and ebfbcd1.

📒 Files selected for processing (1)
  • src-tauri/src/commands/project_core.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src-tauri/src/commands/project_core.rs

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


📝 Walkthrough

Walkthrough

The PR adds the local worldscript-project crate and exposes project JSON parsing, migration, and validation through a Tauri command. The command returns structured results and includes tests for success and failure cases.

Changes

Project validation command

Layer / File(s) Summary
Command wiring
src-tauri/Cargo.toml, src-tauri/src/commands/mod.rs, src-tauri/src/lib.rs
The backend adds the local worldscript-project dependency, declares the command module, and registers worldscript_project_validate with Tauri.
Validation flow and response
src-tauri/src/commands/project_core.rs
The command parses, migrates, and validates project JSON. It returns ProjectValidationResult for successful input and structured failures. Tests cover current-schema projects, v1 migration, malformed JSON, and duplicate character IDs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ebfbc

This PR adds a localized project-validation command and its Rust dependency wiring; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Frontend
  participant Tauri
  participant worldscript_project
  Frontend->>Tauri: invoke worldscript_project_validate(project_json)
  Tauri->>worldscript_project: parse and migrate project JSON
  worldscript_project-->>Tauri: migrated project or failure
  Tauri->>worldscript_project: validate migrated project
  worldscript_project-->>Tauri: validation result
  Tauri-->>Frontend: ProjectValidationResult
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: wiring the worldscript_project_validate Tauri command.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tauri-project-core-command

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

@codeant-ai

codeant-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: ebfbcd1c
Scan Time: 2026-08-20 11:09:57 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED Rating S: No issues

View Full Results

Comment thread src-tauri/src/commands/project_core.rs
CodeAnt correctly flagged that a real Redux-persisted project (using
EntityState normalization for characters/worlds) would fail parse_envelope
today. This is deliberate, existing scope from PR #409's schema.rs -
not a regression introduced here - but that context lived only in
schema.rs, not in this command's own docs. Add a pointer so a future
reader of project_core.rs alone sees the limitation without having to
already know schema.rs's history.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@qnbs

qnbs commented Aug 20, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@qnbs
qnbs merged commit c4007d3 into main Aug 20, 2026
32 checks passed
@qnbs
qnbs deleted the feat/tauri-project-core-command branch August 20, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant