[PR #1589] [MERGED] [codex] Restore upload size constant wiring #5129

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1589
Author: @Xelvanis
Created: 5/29/2026
Status: ✅ Merged
Merged: 5/29/2026
Merged by: @Xelvanis

Base: refactor ← Head: restore/knip-upload-size-constants


📝 Commits (3)

  • c2cec58 Restore upload size constant wiring
  • 6486b25 Tie upload size messages to constants
  • c974f7e Clarify shared image upload limit constant

📊 Changes

3 files changed (+19 additions, -2 deletions)

View changed files

📝 src/engine/contracts/constants/defaults.ts (+1 -0)
📝 src/shared/api/file-payload.test.ts (+9 -0)
📝 src/shared/api/file-payload.ts (+9 -2)

📄 Description

Linked issue

Refs #1566

Why this change

Restore the orphaned upload-size constant wiring from the Knip follow-up queue so frontend image upload validation is driven by the shared engine constants instead of duplicated literals.

This keeps the user-facing error message and the actual upload limit tied together, while avoiding a hidden coupling between generic image uploads and the background-specific size key.

What changed

  • Added a dedicated MAX_FILE_SIZES.IMAGE_UPLOAD constant for shared image upload validation.
  • Re-exported MAX_IMAGE_UPLOAD_BYTES from the shared API file-payload adapter using that constant.
  • Derived IMAGE_UPLOAD_SIZE_ERROR from the same byte limit instead of hardcoding 20 MB in the message.
  • Added a focused test that locks the limit and message to the shared constant.

Refactor impact

Primary owner:

Shared API wrapper / engine contracts.

Impact areas reviewed:

  • Shared API file payload conversion.
  • Settings background image upload callers.
  • Gallery/image-generation upload callers.
  • Shared ImageUploadDropzone usage.
  • Rust-side image upload enforcement for matching current limits.

Boundary notes:

  • Engine stays React-free; the shared API imports only the engine contract constants.
  • No feature layer imports from engine internals were added.
  • No Rust command or remote-runtime route changed.

Pressure points touched:

None; this is limited to engine constants and shared API upload payload handling.

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

AI-run validation:

  • pnpm test -- src/shared/api/file-payload.test.ts
  • pnpm typecheck
  • pnpm lint:eslint
  • pnpm check:architecture
  • pnpm check:unused
  • pnpm build
  • git diff --check

No browser or Tauri manual pass was run because this slice only restores shared validation constants and unit-level coverage.

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 changes needed: this is internal shared validation wiring, not a workflow, architecture, or user-facing documentation change.

UI evidence

No UI evidence added; no visible UI layout or flow changed.

Summary by CodeRabbit

  • Tests

    • Added validation tests to ensure image upload size constants remain consistent across the application.
  • Chores

    • Consolidated image upload size configuration to a centralized source for improved code maintainability and consistency.

Review Change Stack


🔄 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/1589 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `restore/knip-upload-size-constants` --- ### 📝 Commits (3) - [`c2cec58`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c2cec58e18c4639dac284431a9258e49a2b1793e) Restore upload size constant wiring - [`6486b25`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6486b256108c0547d6bf9ada51d0c2098c6863af) Tie upload size messages to constants - [`c974f7e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c974f7eb05ad2b0ffc1c1da10283790be1b0e1f2) Clarify shared image upload limit constant ### 📊 Changes **3 files changed** (+19 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/contracts/constants/defaults.ts` (+1 -0) 📝 `src/shared/api/file-payload.test.ts` (+9 -0) 📝 `src/shared/api/file-payload.ts` (+9 -2) </details> ### 📄 Description ## Linked issue Refs #1566 ## Why this change Restore the orphaned upload-size constant wiring from the Knip follow-up queue so frontend image upload validation is driven by the shared engine constants instead of duplicated literals. This keeps the user-facing error message and the actual upload limit tied together, while avoiding a hidden coupling between generic image uploads and the background-specific size key. ## What changed - Added a dedicated `MAX_FILE_SIZES.IMAGE_UPLOAD` constant for shared image upload validation. - Re-exported `MAX_IMAGE_UPLOAD_BYTES` from the shared API file-payload adapter using that constant. - Derived `IMAGE_UPLOAD_SIZE_ERROR` from the same byte limit instead of hardcoding `20 MB` in the message. - Added a focused test that locks the limit and message to the shared constant. ## Refactor impact Primary owner: Shared API wrapper / engine contracts. Impact areas reviewed: - Shared API file payload conversion. - Settings background image upload callers. - Gallery/image-generation upload callers. - Shared `ImageUploadDropzone` usage. - Rust-side image upload enforcement for matching current limits. Boundary notes: - Engine stays React-free; the shared API imports only the engine contract constants. - No feature layer imports from engine internals were added. - No Rust command or remote-runtime route changed. Pressure points touched: None; this is limited to engine constants and shared API upload payload handling. ## Validation - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `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 AI-run validation: - `pnpm test -- src/shared/api/file-payload.test.ts` - `pnpm typecheck` - `pnpm lint:eslint` - `pnpm check:architecture` - `pnpm check:unused` - `pnpm build` - `git diff --check` No browser or Tauri manual pass was run because this slice only restores shared validation constants and unit-level coverage. ## 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 No docs changes needed: this is internal shared validation wiring, not a workflow, architecture, or user-facing documentation change. ## UI evidence No UI evidence added; no visible UI layout or flow changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added validation tests to ensure image upload size constants remain consistent across the application. * **Chores** * Consolidated image upload size configuration to a centralized source for improved code maintainability and consistency. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1589?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:13:34 +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#5129
No description provided.