[PR #4653] [MERGED] fix(noodle): tolerate sloppy stage profile drafts #6456

Closed
opened 2026-10-23 04:10:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4653
Author: @Gunterlie
Created: 8/5/2026
Status: ✅ Merged
Merged: 8/5/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/noodler-stage-profile-review


📝 Commits (3)

  • a29b4ae fix(noodle): tolerate sloppy stage profile drafts
  • 9f24f6c test(noodle): isolate stage draft validation cases
  • 42933c1 Merge remote-tracking branch 'origin/staging' into fix/noodler-stage-profile-review

📊 Changes

3 files changed (+39 additions, -3 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/noodle/noodle-stage-profile-draft.service.ts (+21 -2)
📝 scripts/regressions/noodle-prompt.regression.ts (+17 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4626

Why this change

NoodleR stage-profile generation can fail with a ZodError when a local model wraps a valid draft in a single-item array, returns a display-only disclosureMode value such as Always, adds extra keys, or decorates the handle with @. These model variations prevent an otherwise usable draft from reaching the editor.

What changed

  • Added a dedicated LLM-output parser that unwraps one-item arrays and rejects ambiguous multi-item arrays.
  • Removed the model-owned disclosureMode from validation because the requested mode is authoritative and is applied after parsing.
  • Stripped unknown model keys and normalized leading @ characters before schema validation.
  • Added regression coverage for the reported sloppy-output cases and a user-facing Unreleased changelog entry.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated verification notes

  • NODE_OPTIONS=--max-old-space-size=4096 pnpm check passed.
  • pnpm regression:prompt passed, including the new stage-profile parsing assertions.
  • pnpm guard:installer-artifacts passed.
  • pnpm install --frozen-lockfile completed successfully.

Manual verification notes

Manual browser/app verification and container validation remain for the human contributor/maintainer. This PR contains no UI changes, so no screenshots are applicable.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed: CHANGELOG.md updated for the bug fix.
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable; this is a server parser and regression-coverage change.

Summary by CodeRabbit

  • Bug Fixes
    • Improved NoodleR stage-profile draft handling for single-item array responses and loosely formatted model output.
    • Drafts now tolerate extra fields, decorated local-model handles, and invalid discarded disclosure modes.
    • Invalid handles and multiple-draft responses continue to be rejected.

🔄 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/4653 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 8/5/2026 **Status:** ✅ Merged **Merged:** 8/5/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/noodler-stage-profile-review` --- ### 📝 Commits (3) - [`a29b4ae`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a29b4ae16e295575df312d9163c272ea1ea95dd3) fix(noodle): tolerate sloppy stage profile drafts - [`9f24f6c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9f24f6c977004abe7898cab824281156010e7455) test(noodle): isolate stage draft validation cases - [`42933c1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/42933c1c993346fd803ce4fe692c9049618431c6) Merge remote-tracking branch 'origin/staging' into fix/noodler-stage-profile-review ### 📊 Changes **3 files changed** (+39 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/noodle/noodle-stage-profile-draft.service.ts` (+21 -2) 📝 `scripts/regressions/noodle-prompt.regression.ts` (+17 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #4626 ## Why this change NoodleR stage-profile generation can fail with a ZodError when a local model wraps a valid draft in a single-item array, returns a display-only `disclosureMode` value such as `Always`, adds extra keys, or decorates the handle with `@`. These model variations prevent an otherwise usable draft from reaching the editor. ## What changed - Added a dedicated LLM-output parser that unwraps one-item arrays and rejects ambiguous multi-item arrays. - Removed the model-owned `disclosureMode` from validation because the requested mode is authoritative and is applied after parsing. - Stripped unknown model keys and normalized leading `@` characters before schema validation. - Added regression coverage for the reported sloppy-output cases and a user-facing Unreleased changelog entry. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Automated verification notes - `NODE_OPTIONS=--max-old-space-size=4096 pnpm check` passed. - `pnpm regression:prompt` passed, including the new stage-profile parsing assertions. - `pnpm guard:installer-artifacts` passed. - `pnpm install --frozen-lockfile` completed successfully. ### Manual verification notes Manual browser/app verification and container validation remain for the human contributor/maintainer. This PR contains no UI changes, so no screenshots are applicable. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed: `CHANGELOG.md` updated for the bug fix. - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable; this is a server parser and regression-coverage change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved NoodleR stage-profile draft handling for single-item array responses and loosely formatted model output. * Drafts now tolerate extra fields, decorated local-model handles, and invalid discarded disclosure modes. * Invalid handles and multiple-draft responses continue to be rejected. <!-- 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-23 04:10:37 +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#6456
No description provided.