[PR #2454] [MERGED] Fix prompt regex coverage #5611

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2454
Author: @Promansis
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Promansis

Base: refactor ← Head: fix/2449-prompt-regex-messages


📝 Commits (1)

  • 8f92a90 Fix prompt regex coverage

📊 Changes

3 files changed (+132 additions, -5 deletions)

View changed files

📝 src/engine/generation-core/regex/regex-application.ts (+0 -1)
📝 src/engine/generation/prompt-assembly.test.ts (+128 -0)
📝 src/engine/generation/prompt-assembly.ts (+4 -4)

📄 Description

Linked issue

Closes Pasta-Devs/Marinara-Engine#2449

Why this change

Prompt-only regex scripts were applied after macro context existed, but refactor skipped messages marked as prompt or injection context. Group turn prompt messages were also appended after the regex pass, so they could not be transformed before provider send.

What changed

  • Apply prompt-only regex scripts to every assembled prompt message, including prompt and injection context messages.
  • Append group turn prompt messages before the prompt regex pass.
  • Add focused prompt assembly coverage for prompt/injection messages and group turn prompt messages.

Refactor impact

Primary owner:

engine generation / prompt assembly

Impact areas reviewed:

  • Chat mode provider-ready prompt assembly
  • Roleplay mode provider-ready prompt assembly
  • Game mode shared prompt regex pass
  • Runtime prompt regex helper behavior

Boundary notes:

  • Engine-only change. No React, shared API, Tauri/Rust, or remote-runtime boundary changes.
  • Non-prompt runtime user input and AI output regex paths are unchanged.

Pressure points touched:

  • Prompt assembly ordering around depth injections, group turn prompt messages, and regex application.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm exec vitest run src/engine/generation/immersive-html-agent.test.ts src/engine/generation/prompt-assembly.test.ts passed: 2 files, 12 tests.
  • pnpm typecheck passed.
  • pnpm check passed, including line endings, scratch, architecture, frontend typecheck, Rust check, docs, discovery, launcher safety, and unused-code report.

Durable test rationale: issue 2449 is a known provider-ready prompt regression; prompt regex ordering and context filtering are easy to break silently; the new coverage is narrow and lives beside existing prompt assembly tests.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

Bugfix for existing prompt regex behavior; no new user-discoverable feature or setting.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

No visible UI changes.


🔄 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/2454 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/6/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/2449-prompt-regex-messages` --- ### 📝 Commits (1) - [`8f92a90`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8f92a909aaf715397cfd94927b17a5e8b77d3861) Fix prompt regex coverage ### 📊 Changes **3 files changed** (+132 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation-core/regex/regex-application.ts` (+0 -1) 📝 `src/engine/generation/prompt-assembly.test.ts` (+128 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+4 -4) </details> ### 📄 Description ## Linked issue Closes Pasta-Devs/Marinara-Engine#2449 ## Why this change Prompt-only regex scripts were applied after macro context existed, but refactor skipped messages marked as prompt or injection context. Group turn prompt messages were also appended after the regex pass, so they could not be transformed before provider send. ## What changed - Apply prompt-only regex scripts to every assembled prompt message, including prompt and injection context messages. - Append group turn prompt messages before the prompt regex pass. - Add focused prompt assembly coverage for prompt/injection messages and group turn prompt messages. ## Refactor impact Primary owner: engine generation / prompt assembly Impact areas reviewed: - Chat mode provider-ready prompt assembly - Roleplay mode provider-ready prompt assembly - Game mode shared prompt regex pass - Runtime prompt regex helper behavior Boundary notes: - Engine-only change. No React, shared API, Tauri/Rust, or remote-runtime boundary changes. - Non-prompt runtime user input and AI output regex paths are unchanged. Pressure points touched: - Prompt assembly ordering around depth injections, group turn prompt messages, and regex application. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm exec vitest run src/engine/generation/immersive-html-agent.test.ts src/engine/generation/prompt-assembly.test.ts` passed: 2 files, 12 tests. - `pnpm typecheck` passed. - `pnpm check` passed, including line endings, scratch, architecture, frontend typecheck, Rust check, docs, discovery, launcher safety, and unused-code report. Durable test rationale: issue 2449 is a known provider-ready prompt regression; prompt regex ordering and context filtering are easy to break silently; the new coverage is narrow and lives beside existing prompt assembly tests. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: Bugfix for existing prompt regex behavior; no new user-discoverable feature or setting. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence No visible UI changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:49 +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#5611
No description provided.