mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2011] 1. Contracts and schemas #985
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#985
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Xelvanis on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2011
Originally assigned to: @Xelvanis on GitHub.
Target 1: Contracts And Schemas
Scope
Included:
Not checked:
Surface Inventory Additions
{ value }envelope and key/value storage shape.packages/shared/src/schemas/app-settings.schema.ts;packages/server/src/db/schema/app-settings.ts;packages/server/src/services/storage/app-settings.storage.tssrc/engine/contracts/schemas/app-settings.schema.ts;src-tauri/src/commands/storage/contracts.rspackages/shared/src/schemas/chat-preset.schema.ts;packages/server/src/services/storage/chat-presets.storage.tssrc/engine/contracts/schemas/chat-preset.schema.ts;src-tauri/src/commands/storage/contracts.rspackages/shared/src/schemas/prompt.schema.ts; legacy generate route utilitiessrc/engine/contracts/schemas/prompt.schema.ts;src/engine/generation/generate-route-utils.ts;src/engine/generation/provider-visible-parameters.tspackages/shared/src/schemas/chat.schema.ts; legacy generate routessrc/engine/contracts/schemas/chat.schema.ts;src/engine/generation/start-generation.tspackages/shared/src/schemas/agent.schema.ts;packages/server/src/services/storage/agents.storage.ts;packages/shared/src/types/agent.tssrc/engine/contracts/schemas/agent.schema.ts;src/engine/contracts/types/agent.ts;src/engine/generation/agent-runner.ts0.3.src/engine/agents-runtime/executor/agent-executor.ts;docs/REFACTOR_PARITY_PIPELINE.mdpackages/shared/src/schemas/custom-tool.schema.ts; legacy tool execution routessrc/engine/contracts/schemas/custom-tool.schema.ts;src-tauri/src/commands/storage/custom_tools.rs;src/engine/generation/tools-runtime.tspackages/server/src/db/file-backed-store.ts; legacy file-backed table docssrc-tauri/src/commands/storage/contracts.rs;src/engine/capabilities/storage.tsStorageGatewayaccepts non-generic entities that are not Rust generic collections.src-tauri/src/commands/storage/contracts.rs;src-tauri/src/commands/storage/shared.rs;src-tauri/src/commands/storage/profile.rs;src-tauri/src/state.rsCoverage Matrix
maxParallelJobsruntime contractscript/scriptBodydivergencevisual_novelchat mode normalizationroleplaydefaulttoisDefaultnormalizationdefaultand normalizes toisDefault{ value }envelope{ value }envelope, maps legacykeyrows to storageid, keeps blank-key rows from becomingui, and accepts a wider opaque JSON value than legacy's serialized string blobxhigh, service tier, stop sequences, verbosity, and provider-visible fields through schema/UI/runtime transportGENERATION_GUIDE_SOURCESincludesamend,game_turn, andgame_retry, andgenerateRequestSchemaaccepts those runtime/replay guide sources0.3; refactor leaves unset agent temperature to the resolved connection/provider defaultStorageEntitynow includesbackground-metadata/sprites/game-state-snapshotsand no longer advertises non-genericbackgrounds/game-assets/game-stateRescan Evidence
54a9ffd3; legacy checked at7c6190aa.origin/refactorwas four commits ahead; the only batch-adjacent changed file wassrc-tauri/src/commands/storage/shared.rs, and the diff was nested projection logic, not chat-preset defaults/normalization.origin/refactorwas four commits ahead; no batch-2 files changed between localHEADandorigin/refactor.origin/refactorwas four commits ahead; no batch-3 source files changed between localHEADandorigin/refactor.origin/refactorwas four commits ahead; onlysrc-tauri/src/commands/storage/shared.rschanged in the batch-4 file set, and the upstream diff was #2008 nested projection proof/logic rather than collection registry or allowlist semantics.app_settings.keyplus stringvalue(packages/shared/src/schemas/app-settings.schema.ts,packages/server/src/db/schema/app-settings.ts,packages/server/src/services/storage/app-settings.storage.ts,packages/server/src/routes/app-settings.routes.ts,packages/client/src/hooks/use-settings-sync.ts), while refactor keeps the{ value }envelope with opaque JSON and genericapp-settingsstorage (src/engine/contracts/schemas/app-settings.schema.ts,src/engine/capabilities/storage.ts,src/shared/api/mari-api.ts,src-tauri/src/commands/storage/contracts.rs,src-tauri/src/seed_defaults.rs).connectionId,promptPresetId,metadata; strict object; default{}), while refactor additionally accepts legacydefault/activealiases in storage/types and protects default preset mutations in embedded/remote storage paths.DEFAULT_GENERATION_PARAMS), and legacy-supportedserviceTier,stopSequences, verbosity, custom parameters, and role-formatting fields remain present in refactor. Refactor broadens the public schema/UI/provider-visible path to includereasoningEffort: "xhigh", matching current native provider transport support and legacy's deeper game/provider xhigh handling.generateRequestSchemaacceptednarrator,guide, andgame_startguide sources. The original refactor scan preserved those and addedgame_turn/game_retry, but omittedamend; #2013 has since closed and the post-fix rescan confirms current schema parity.agentType/agent_type,chatId/chat_id,agentConfigId/agent_config_id, andcreatedAt/created_at. Refactor additionally addscreditdefaults and normalizes custom activation settings.agentTemperaturereturnsundefinedfor unset settings so the connection/provider default wins instead of legacy's implicit0.3.createCustomToolSchema,src/engine/generation/tools-runtime.ts,src/shared/api/custom-tool-api.ts,src-tauri/src/commands/storage/custom_tools.rs, and remotehttp_dispatch.rs. Legacy script tools remain the intentional #1907 divergence.enabled: trueas disabled for newly saved tools (#2015), and refactor webhook execution did not preserve legacy local-URL opt-in and success-body size guards (#2016). Both issues have since closed and the post-fix rescan confirms current static/webhook parity.src/engine/contracts/schemas/agent.schema.tsand runtime use insrc/engine/agents-runtime/activation.ts.maxParallelJobsinsrc/engine/contracts/schemas/connection.schema.ts, resolution insrc/engine/generation/agent-runner.ts, and batching split logic insrc/engine/agents-runtime/pipeline/agent-pipeline.ts.src-tauri/src/commands/storage/contracts.rs, command use insrc-tauri/src/commands/storage/commands/entities.rs, profile/startup repair use insrc-tauri/src/commands/storage/profile.rsandsrc-tauri/src/state.rs, and remote dispatch coverage insrc-tauri/src/http_dispatch.rs.docs/REFACTOR_PARITY_PIPELINE.mdand enforced insrc-tauri/src/commands/storage/custom_tools.rs.FILE_BACKED_TABLES/CASCADESinpackages/server/src/db/file-backed-store.tsagainst refactorStorageCollectionContractrows insrc-tauri/src/commands/storage/contracts.rs. Legacy table names map to refactor collections, folded fields, or focused asset/notes/memory paths:prompt_presetstoprompts,choice_blockstoprompt-variables,api_connectionstoconnections,chat_imagestogallery,character_imagestocharacter-gallery,message_swipesto nested message swipes (#1923 remains target 2), lorebook link tables tolorebooks.characterIds/personaIds, and connected notes/OOC/memory chunks to chat notes/memories.contracts::collection_contract, whileprofile_collectionsandstartup_json_repair_collectionsare registry-derived. Native profile collection import/export and legacy profile table import also route through the registry and legacy table mapping helpers.src/engine/capabilities/storage.tsincluded non-genericbackgrounds,game-assets, andgame-stateinStorageEntitywhile omitting genericbackground-metadataandsprites. #2017 has since closed and the post-fix rescan confirms the frontend generic storage entity list now matches the generic Rust collection contract.create_default_fieldsanddelete_cleanupmetadata should become executable source of truth instead of branch-dispatched helper behavior.refactorat50b9d03con 2026-06-03. It confirmed #2013, #2015, #2016, and #2017 are closed and their target-1 contract surfaces now pass focused static/test proof.generateRequestSchemaimportsGENERATION_GUIDE_SOURCES, and the shared guide-source list includesamend,game_turn, andgame_retry(src/engine/contracts/schemas/chat.schema.ts,src/engine/shared/text/generation-guide.ts). Legacy acceptednarrator,guide, andgame_start; refactor now covers those plus current runtime/replay sources.isCustomToolSelectableaccepts boolean, numeric, and string enabled flags and keeps static/webhook positive-shape requirements (src/features/catalog/agents/hooks/use-custom-tools.ts). Legacy only accepted string"true"/"1"because legacy rows used string flags (packages/client/src/hooks/use-custom-tools.ts).WEBHOOK_LOCAL_URLS_ENABLED, reject local/private/reserved targets without opt-in, validate redirects per hop, and cap successful response bodies at 512 KiB (src-tauri/src/commands/storage/custom_tools.rs,src-tauri/crates/security/src/lib.rs). Legacy custom-tool webhooks usedsafeFetchwithWEBHOOK_LOCAL_URLS_ENABLEDandmaxResponseBytes: 512 * 1024(packages/server/src/services/tools/tool-executor.ts).background-metadata,sprites, andgame-state-snapshotsare included, while non-generic asset/runtime routes remain outsideStorageEntity.Focused proof run:
All focused Rust tests listed above passed on 2026-06-03. The original batch-2 local Vite SSR probe imported
generationParametersSchema,generateRequestSchema, andproviderVisibleLlmParameters; it passed while exposing the original gap withamend: false, plusgenerationXhigh: true,gameTurn: true,gameRetry: true, and an OpenRouter visible parameter object containingservice_tier: "priority"andstop: ["</END>"].The original batch-3 Vite SSR probe imported
createAgentConfigSchema,createCustomToolSchema,BUILT_IN_AGENTS,getDefaultBuiltInAgentSettings, andisCustomToolSelectable; it passed while exposing the original selector gap withselectable.booleanEnabled: false, plusbuiltInCount: 28,hasKnowledgeRouter: true, valid static/webhook schema parses, rejected script schema parse,staticToolEnabled: true, andselectable.stringEnabled: true.Post-fix focused proof run on
refactor50b9d03c:All post-fix focused commands passed on 2026-06-03. The local Vitest scratch probe confirmed
generateRequestSchemaacceptsamend,game_turn, andgame_retry; boolean-enabled static/webhook custom tools are selectable; disabled boolean tools stay hidden; and frontend generic storage entities includebackground-metadata/sprites/game-state-snapshotswhile excluding non-genericbackgrounds/game-assets/game-state.Residual Risk
defaultalias proof covered update/default lookup paths, not every create/profile-import path.scriptBodyimport/profile preservation was not fully audited here because target 1 classifies script execution as intentional divergence./api/invokewalkthrough, or live asset operations. It proved registry/allowlist/profile contract behavior with Rust tests and static trace only.Follow-Ups
maxParallelJobsruntime behavior.generateRequestSchemawith the current/amendgeneration guide source.StorageEntitywith generic Rust storage collection contracts.Published Artifacts
script/scriptBodycontract divergence.amendguide source.enabledare hidden from selectors.StorageEntitylists non-generic entities that storage commands reject.refactor50b9d03cconfirmed closed follow-ups #2013, #2015, #2016, and #2017 no longer block target 1.Rescan Criteria
refactor50b9d03c. Target 1 ison_par; #2006 remains non-blocking registry execution debt.