[PR #1163] [MERGED] Fix Professor Mari action contract #4946

Closed
opened 2026-10-22 04:11:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1163
Author: @cha1latte
Created: 5/24/2026
Status: ✅ Merged
Merged: 5/24/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/refactor-issue-36


📝 Commits (1)

  • c0ce7cb Fix Professor Mari action contract

📊 Changes

3 files changed (+112 additions, -4 deletions)

View changed files

📝 src-tauri/src/commands/storage/mari.rs (+9 -0)
📝 src/engine/mari/mari-entry.ts (+101 -2)
📝 src/shared/api/mari-api.ts (+2 -2)

📄 Description

What?

Adds an explicit Professor Mari action contract on the refactor branch. The response from professor_mari_prompt now includes an action field, and the TypeScript runProfessorMariEntry boundary normalizes that field before the shell UI consumes the response.

Why?

Refs the old refactor issue: https://github.com/Pasta-Devs/Marinara-Engine-Refactor/issues/36

The previous path was implicitly read-only but only returned content and createdAt, so the UI boundary could not tell whether record create/edit support was intentionally absent or just missing from the response contract.

How?

  • Added MariEntryAction as a discriminated contract with a current read_only no-op action and guarded future create_record / edit_record shapes.
  • Added runtime normalization for the Tauri gateway response so missing or malformed action values fall back to the read-only contract.
  • Added the Rust response-side action field for Professor Mari with the same read-only reason.

Testing?

Machine/Codex verification:

  • node scratch\issue-36-contract-proof.mjs before reproduced the missing contract before the fix.
  • node scratch\issue-36-contract-proof.mjs after passed after the fix and confirmed:
    • TypeScript response contract includes action.
    • The gateway normalizes the runtime action payload.
    • Action entities are validated before accepting create/edit actions.
    • Rust emits the read-only action field.
    • Rust does not register a create/edit mutation tool for Professor Mari.
  • $env:CARGO_TARGET_DIR='C:\tmp\me-refactor-issue-36-cargo-target'; pnpm check passed:
    • pnpm check:architecture
    • pnpm check:frontend
    • pnpm check:rust
    • pnpm check:docs
  • node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed.
  • Bunny review pass completed for the current diff.

Manual verification needed:

  • None. This is a code contract change verified by the focused harness and full branch baseline.

Screenshots

N/A. This is a non-UI contract fix.

Anything Else?

The first direct cargo check against src-tauri\target hit Windows access-denied errors from stale/locked build output. Rerunning with a fresh CARGO_TARGET_DIR completed successfully, and the full pnpm check baseline passed with that target dir.

Summary by CodeRabbit

  • New Features

    • Professor Mari responses now explicitly indicate action capabilities, declaring whether operations are read-only, can create, or can edit content.
  • Improvements

    • Improved response validation and normalization with automatic fallback to read-only mode for unsupported or malformed action payloads, ensuring robust handling.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1163 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/24/2026 **Status:** ✅ Merged **Merged:** 5/24/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-issue-36` --- ### 📝 Commits (1) - [`c0ce7cb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c0ce7cb33e9d699a1d5dd72877ff3607f96dd40c) Fix Professor Mari action contract ### 📊 Changes **3 files changed** (+112 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/mari.rs` (+9 -0) 📝 `src/engine/mari/mari-entry.ts` (+101 -2) 📝 `src/shared/api/mari-api.ts` (+2 -2) </details> ### 📄 Description ## What? Adds an explicit Professor Mari action contract on the refactor branch. The response from `professor_mari_prompt` now includes an `action` field, and the TypeScript `runProfessorMariEntry` boundary normalizes that field before the shell UI consumes the response. ## Why? Refs the old refactor issue: https://github.com/Pasta-Devs/Marinara-Engine-Refactor/issues/36 The previous path was implicitly read-only but only returned `content` and `createdAt`, so the UI boundary could not tell whether record create/edit support was intentionally absent or just missing from the response contract. ## How? - Added `MariEntryAction` as a discriminated contract with a current `read_only` no-op action and guarded future `create_record` / `edit_record` shapes. - Added runtime normalization for the Tauri gateway response so missing or malformed `action` values fall back to the read-only contract. - Added the Rust response-side `action` field for Professor Mari with the same read-only reason. ## Testing? Machine/Codex verification: - `node scratch\issue-36-contract-proof.mjs before` reproduced the missing contract before the fix. - `node scratch\issue-36-contract-proof.mjs after` passed after the fix and confirmed: - TypeScript response contract includes `action`. - The gateway normalizes the runtime action payload. - Action entities are validated before accepting create/edit actions. - Rust emits the read-only action field. - Rust does not register a create/edit mutation tool for Professor Mari. - `$env:CARGO_TARGET_DIR='C:\tmp\me-refactor-issue-36-cargo-target'; pnpm check` passed: - `pnpm check:architecture` - `pnpm check:frontend` - `pnpm check:rust` - `pnpm check:docs` - `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed. - Bunny review pass completed for the current diff. Manual verification needed: - None. This is a code contract change verified by the focused harness and full branch baseline. ## Screenshots N/A. This is a non-UI contract fix. ## Anything Else? The first direct `cargo check` against `src-tauri\target` hit Windows access-denied errors from stale/locked build output. Rerunning with a fresh `CARGO_TARGET_DIR` completed successfully, and the full `pnpm check` baseline passed with that target dir. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Professor Mari responses now explicitly indicate action capabilities, declaring whether operations are read-only, can create, or can edit content. * **Improvements** * Improved response validation and normalization with automatic fallback to read-only mode for unsupported or malformed action payloads, ensuring robust handling. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1163?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4946
No description provided.