Files
makelore/.project-docs/30-worklog/tasks/20260817-project-cover-upload-a6a98e56.md
T

4.3 KiB

Task: Add project cover upload to review dialog

Identity

  • Task ID: 20260817-project-cover-upload-a6a98e56
  • Mode: Feature
  • Branch: codex/20260817-project-cover-upload-a6a98e56-project-cover-upload
  • Worktree: D:\Datas\OthersProjects\makelore-project-cover-upload-a6a98e56
  • Base commit: 7e8d9e3811
  • Owner: codex
  • Status: Ready for integration

Scope

  • Add a required project-cover picker and preview to the first-submission information dialog.
  • Validate and encode PNG/JPEG/WebP input in Renderer, then pass the existing bounded cover DTO through the Main-owned publish route.
  • Update Electron Main to call the new Works Square atomic metadata-plus-cover create contract before version upload.
  • Preserve version-only behavior and existing metadata/cover for draft and published Works projects.

Intent And Constraints

  • Renderer may handle only the user-selected cover bytes and safe metadata; Works credentials, local project paths, archives, build output, and idempotency stay in Electron Main.
  • First submission requires one valid cover and must fail before source upload if the atomic create contract rejects it.
  • Do not restore a standalone publish/upload page or cloud-deploy workbench.
  • Do not use the old standalone cover-upload-plus-JSON-create sequence, which can leave orphaned objects or lose a 404-to-409 race.
  • Feature mode updates only this task record in canonical project memory; README stays synchronized with the user-visible behavior.

Outcome

  • The first-submission information dialog now requires a PNG, JPEG, or WebP cover no larger than 10 MiB and shows its preview, file name, and a reselect action.
  • Renderer validates MIME type, non-empty size, byte limit, and file signature before passing the existing bounded cover DTO to Electron Main.
  • Electron Main now sends metadata JSON and cover in one POST /api/projects/with-cover multipart request, retaining ownership of credentials, paths, archives, and version upload.
  • A create conflict stops before version upload; existing draft and published projects continue through the version-only path without replacing their cover.
  • README now describes the required first-submission cover and the multipart create flow.
  • The shared Electron E2E now covers opening the first-submission dialog, the missing-cover error, a valid PNG preview, the selected file name, and the reselect action.

Verification

  • Focused Vitest run for project-publish-action, works-routes, and works-square — 3 files, 76 tests passed.
  • tsc --noEmit — passed.
  • Focused ESLint on all changed TypeScript/TSX files — passed.
  • Vite production build — passed; only pre-existing dynamic-import and chunk-size warnings were emitted.
  • Focused Playwright run for tests/e2e/project-configuration-skills.spec.ts — 1 passed.
  • git diff --check — passed with only the repository's Windows LF-to-CRLF notices.

Follow-ups

  • Integrate and deploy the matching Works Square server task 20260817-project-cover-upload-0cc3cb72 before distributing a client that calls the new route.
  • Non-blocking hardening: add direct Renderer/Main unit cases for empty or signature-mismatched files, and assess explicit Host JSON-body and cover-file-name length limits with the broader Host API boundary.

Promotion Candidates

  • Target canonical docs: .project-docs/40-domain/business-rules.md, .project-docs/10-overview/current-state.md, and .project-docs/20-product/success-criteria.md
    • Proposal: Replace the documented coverless-first-create limitation with the required cover picker and atomic metadata-plus-cover create flow; keep existing-project submissions version-only.
    • Evidence: ProjectPublishAction.tsx, electron/api/routes/works.ts, 76 focused unit tests, the focused Electron E2E, and the synchronized README contract description.
    • Future impact: Changes to the publish dialog or Electron Works route must retain the first-create cover validation and prevent version upload when metadata creation fails.
    • Semantic conflicts: Supersedes the current project-memory statements that first submissions are intentionally coverless; it does not restore the removed standalone publish page.
    • Human confirmation: Confirmed by the user's explicit request to add project-cover upload to the one-click review dialog.