[PR #1300] [MERGED] Fix generated image metadata provenance #5021

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/refactor-issue-1234-image-metadata


📝 Commits (2)

  • 085b8bb Fix generated image metadata provenance
  • ec045a3 Merge branch 'refactor' into fix/refactor-issue-1234-image-metadata

📊 Changes

2 files changed (+65 additions, -2 deletions)

View changed files

📝 src-tauri/src/commands/storage/images.rs (+7 -2)
📝 src-tauri/src/commands/storage/images/providers.rs (+58 -0)

📄 Description

Linked issue

Closes #1234

Why this change

  • Generated chat-gallery images from the connected command/selfie path could lose provenance because the native image_generate command returned image data without the actual image source or model. The TypeScript save path already preserved those fields when present, but fell back to image_generation and null when the native command omitted them.

What changed

  • Added provider/source and model metadata to the native image_generate JSON response while preserving the existing base64, mimeType, and image fields.
  • Added a shared image model resolver next to the existing image source resolver so recorded model metadata matches the provider path that actually consumes a model.
  • Avoided inventing model provenance for Pollinations, because the current Pollinations request path does not send a model field.

Refactor impact

Primary owner:

Rust storage / image generation command contract.

Impact areas reviewed:

  • src-tauri/src/commands/storage/images.rs
  • src-tauri/src/commands/storage/images/providers.rs
  • src/engine/generation/connected-commands.ts save path behavior, via scratch repro

Boundary notes:

  • The fix stays in the Rust command contract. Existing TypeScript callers keep the same response fields and can now consume optional provider and model.
  • No schema, storage layout, prompt assembly, dependency, auth, release metadata, or UI boundary changes.

Pressure points touched:

  • Native image_generate response payload only; no command registration or UI surface changes.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex reproduced the bug with pnpm exec vitest run --config scratch/vitest.issue-1234.config.ts: before the fix, the native response shape lacked provider/model, and the connected selfie gallery save produced provider: "image_generation" and model: null.
  • Codex reran the same scratch repro after the fix; it passed with provider: "openrouter" and model: "google/gemini-2.5-flash-image" reaching the saved gallery row.
  • Codex ran pnpm check on the final diff. The first Rust rerun hit a sandbox/build-target permission issue after clearing src-tauri/target; rerunning pnpm check:rust outside the sandbox succeeded, and the final full pnpm check passed.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch/bugfix-verification.json; the proof gate passed.
  • No human-only verification is blocking this metadata contract fix.

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

No docs or release metadata changes are needed for this narrow response-contract fix.

UI evidence

N/A. This is not a visual/UI issue; proof is the scratch connected-command repro and final pnpm check.


🔄 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/1300 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/26/2026 **Status:** ✅ Merged **Merged:** 5/26/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-issue-1234-image-metadata` --- ### 📝 Commits (2) - [`085b8bb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/085b8bb373028dbb5649a081ae7eb6c91c83ec89) Fix generated image metadata provenance - [`ec045a3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ec045a39fcac01c54f2a6bb008c8085f4b344838) Merge branch 'refactor' into fix/refactor-issue-1234-image-metadata ### 📊 Changes **2 files changed** (+65 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/images.rs` (+7 -2) 📝 `src-tauri/src/commands/storage/images/providers.rs` (+58 -0) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue <!-- Every user-facing PR should reference a feature request or issue report when practical. --> Closes #1234 ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Generated chat-gallery images from the connected command/selfie path could lose provenance because the native `image_generate` command returned image data without the actual image source or model. The TypeScript save path already preserved those fields when present, but fell back to `image_generation` and `null` when the native command omitted them. ## What changed <!-- List the key changes in this PR. --> - Added provider/source and model metadata to the native `image_generate` JSON response while preserving the existing `base64`, `mimeType`, and `image` fields. - Added a shared image model resolver next to the existing image source resolver so recorded model metadata matches the provider path that actually consumes a model. - Avoided inventing model provenance for Pollinations, because the current Pollinations request path does not send a model field. ## Refactor impact Primary owner: <!-- Examples: app shell, catalog, chat mode, roleplay mode, game mode, runtime generation, world-state, shared API, engine generation, Rust storage, imports, remote runtime. --> Rust storage / image generation command contract. Impact areas reviewed: - `src-tauri/src/commands/storage/images.rs` - `src-tauri/src/commands/storage/images/providers.rs` - `src/engine/generation/connected-commands.ts` save path behavior, via scratch repro Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - The fix stays in the Rust command contract. Existing TypeScript callers keep the same response fields and can now consume optional `provider` and `model`. - No schema, storage layout, prompt assembly, dependency, auth, release metadata, or UI boundary changes. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - Native `image_generate` response payload only; no command registration or UI surface changes. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app/runtime, step by step. If an AI agent filled this out, verify it yourself before ticking boxes. --> - Codex reproduced the bug with `pnpm exec vitest run --config scratch/vitest.issue-1234.config.ts`: before the fix, the native response shape lacked `provider/model`, and the connected selfie gallery save produced `provider: "image_generation"` and `model: null`. - Codex reran the same scratch repro after the fix; it passed with `provider: "openrouter"` and `model: "google/gemini-2.5-flash-image"` reaching the saved gallery row. - Codex ran `pnpm check` on the final diff. The first Rust rerun hit a sandbox/build-target permission issue after clearing `src-tauri/target`; rerunning `pnpm check:rust` outside the sandbox succeeded, and the final full `pnpm check` passed. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch/bugfix-verification.json`; the proof gate passed. - No human-only verification is blocking this metadata contract fix. ## 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 No docs or release metadata changes are needed for this narrow response-contract fix. ## UI evidence <!-- Add before/after screenshots or recordings for visible UI changes. --> N/A. This is not a visual/UI issue; proof is the scratch connected-command repro and final `pnpm check`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:33 +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#5021
No description provided.