[PR #1981] [MERGED] Fix persona token sort summary fields #5374

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1965-persona-token-sort


📝 Commits (2)

  • e9e9f49 Fix persona token sort summary fields
  • 77cba4d Refresh persona token sort PR checks

📊 Changes

3 files changed (+38 additions, -17 deletions)

View changed files

➕ src/features/catalog/personas/hooks/use-personas.test.ts (+11 -0)
📝 src/features/catalog/personas/hooks/use-personas.ts (+6 -17)
➕ src/features/catalog/personas/lib/persona-summary-fields.ts (+21 -0)

📄 Description

Linked issue

Closes #1965

Why this change

  • The refactor Personas panel sorts by token estimate using description, personality, scenario, backstory, and appearance, but usePersonaSummaries() only requested description from that set. Personas with most text in the other fields could sort too low by Tokens.

What changed

  • Added the long persona text fields to the persona summary projection used by catalog consumers.
  • Moved the summary projection field list into a small shared persona lib module so the hook and regression test use the same source of truth.
  • Added a focused regression test proving the summary projection includes the fields used by token sorting.

Refactor impact

Primary owner:

  • Catalog resources

Impact areas reviewed:

  • Personas panel summary loading and token sort input path.
  • Existing token estimator in personas-panel-model.ts already counted the long fields once present.

Boundary notes:

  • Feature/catalog-only change. No engine, shared API wrapper contract, Rust storage, remote runtime, schema, dependency, auth, prompt, or release boundary changes.

Pressure points touched:

  • None.

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

  • Codex repro before fix: pnpm exec vitest run src/features/catalog/personas/hooks/use-personas.test.ts failed because PERSONA_SUMMARY_FIELDS lacked personality, scenario, backstory, and appearance.
  • Codex verification after fix: pnpm exec vitest run src/features/catalog/personas/hooks/use-personas.test.ts passed.
  • Codex lane check: pnpm typecheck passed.
  • Codex PR gate: pnpm check passed, including line endings, architecture, frontend, Rust, docs, discovery, and unused-code checks.
  • Proof gate: node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch/bugfix-verification.json passed locally.
  • Bunny review: pass before PR open; issue match, scope, proof, and boundaries reviewed.

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 Personas panel sort behavior; no new discoverable feature or workflow.

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

N/A. The reported regression is the static persona summary projection feeding token sort. The before/after proof is the focused projection test plus pnpm check; there is no browser-only visual state needed to prove the core claim.

Summary by CodeRabbit

  • New Features

    • Expanded persona profiles with additional optional fields: personality, scenario, backstory, and appearance.
  • Tests

    • Added test suite to verify persona summary field definitions.
  • Refactor

    • Centralized persona field management for improved consistency.

🔄 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/1981 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1965-persona-token-sort` --- ### 📝 Commits (2) - [`e9e9f49`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e9e9f49d56ca97d38063737acdf3e9d622a77b81) Fix persona token sort summary fields - [`77cba4d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/77cba4d0230861358bd8b49744bd95c41ec028c3) Refresh persona token sort PR checks ### 📊 Changes **3 files changed** (+38 additions, -17 deletions) <details> <summary>View changed files</summary> ➕ `src/features/catalog/personas/hooks/use-personas.test.ts` (+11 -0) 📝 `src/features/catalog/personas/hooks/use-personas.ts` (+6 -17) ➕ `src/features/catalog/personas/lib/persona-summary-fields.ts` (+21 -0) </details> ### 📄 Description ## Linked issue Closes #1965 ## Why this change - The refactor Personas panel sorts by token estimate using description, personality, scenario, backstory, and appearance, but `usePersonaSummaries()` only requested description from that set. Personas with most text in the other fields could sort too low by Tokens. ## What changed - Added the long persona text fields to the persona summary projection used by catalog consumers. - Moved the summary projection field list into a small shared persona lib module so the hook and regression test use the same source of truth. - Added a focused regression test proving the summary projection includes the fields used by token sorting. ## Refactor impact Primary owner: - Catalog resources Impact areas reviewed: - Personas panel summary loading and token sort input path. - Existing token estimator in `personas-panel-model.ts` already counted the long fields once present. Boundary notes: - Feature/catalog-only change. No engine, shared API wrapper contract, Rust storage, remote runtime, schema, dependency, auth, prompt, or release boundary changes. Pressure points touched: - None. ## 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 - Codex repro before fix: `pnpm exec vitest run src/features/catalog/personas/hooks/use-personas.test.ts` failed because `PERSONA_SUMMARY_FIELDS` lacked `personality`, `scenario`, `backstory`, and `appearance`. - Codex verification after fix: `pnpm exec vitest run src/features/catalog/personas/hooks/use-personas.test.ts` passed. - Codex lane check: `pnpm typecheck` passed. - Codex PR gate: `pnpm check` passed, including line endings, architecture, frontend, Rust, docs, discovery, and unused-code checks. - Proof gate: `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch/bugfix-verification.json` passed locally. - Bunny review: pass before PR open; issue match, scope, proof, and boundaries reviewed. ## 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 Personas panel sort behavior; no new discoverable feature or workflow. ## 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 N/A. The reported regression is the static persona summary projection feeding token sort. The before/after proof is the focused projection test plus `pnpm check`; there is no browser-only visual state needed to prove the core claim. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Expanded persona profiles with additional optional fields: personality, scenario, backstory, and appearance. * **Tests** * Added test suite to verify persona summary field definitions. * **Refactor** * Centralized persona field management for improved consistency. <!-- 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:15:42 +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#5374
No description provided.