Skip to content

fix(shared): preserve empty legacy image payloads - #426

Merged
Flow-Fly merged 2 commits into
mainfrom
dev-425-empty-legacy-image-payloads
Jul 28, 2026
Merged

fix(shared): preserve empty legacy image payloads#426
Flow-Fly merged 2 commits into
mainfrom
dev-425-empty-legacy-image-payloads

Conversation

@Flow-Fly

@Flow-Fly Flow-Fly commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • normalize empty and whitespace-only legacy image strings to empty byte arrays
  • preserve empty payloads from syntactically valid exact-base64 data URLs
  • add public decodeProjectFile coverage for representative legacy layer and cel payloads
  • keep malformed and unsupported non-empty legacy payloads rejected

Linked task issues

Closes #425

Regression evidence

Before the production change, npx vitest run tests/shared/project-contract.test.ts failed both new cases with TypeError: Legacy project image data is empty at shared/src/project-data.ts:71; the other 11 contract tests passed.

After the fix, npm run shared:build && npx vitest run tests/shared/project-contract.test.ts tests/serialization/project-data.test.ts passes all 30 tests.

Verification

  • npm run shared:check (21 tests, including Node ESM import)
  • npx tsc --noEmit
  • npm run lint (passes with 5 pre-existing warnings, 0 errors)
  • npm run test:run (112 files, 707 tests, plus Node ESM import)
  • npm run build
  • npm run fallow:audit
  • git diff --check

No project format version, migration, or persisted schema changes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of empty or whitespace-only project image data.
    • Empty image payloads now decode safely as empty image data instead of producing an error.
    • Supports empty payloads across legacy project layers and cels, including empty base64 image data URLs.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ef4759b-5de7-4167-ab4b-f5e00383ab80

📥 Commits

Reviewing files that changed from the base of the PR and between 230611d and e1aa218.

📒 Files selected for processing (3)
  • shared/src/project-data.ts
  • tests/serialization/project-data.test.ts
  • tests/shared/project-contract.test.ts

📝 Walkthrough

Walkthrough

Legacy image decoding now normalizes empty and whitespace-only payloads, including exact empty Base64 data URLs, to empty byte arrays. Tests cover normalization and decoding of empty layer and cel image data.

Changes

Legacy image compatibility

Layer / File(s) Summary
Empty payload decoding and regression coverage
shared/src/project-data.ts, tests/serialization/project-data.test.ts, tests/shared/project-contract.test.ts
decodeLegacyBase64ImageData trims inputs and returns empty byte arrays for empty payloads; normalization and legacy project decoding tests cover plain, whitespace-only, and empty Base64 data URL inputs.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: preserving empty legacy image payloads.
Linked Issues check ✅ Passed The fix and tests satisfy #425 by restoring empty payload support while keeping malformed non-empty inputs rejected.
Out of Scope Changes check ✅ Passed The PR stays within the compatibility fix and test coverage scope, with no unrelated feature or schema changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-425-empty-legacy-image-payloads

Comment @coderabbitai help to get the list of available commands.

@Flow-Fly
Flow-Fly marked this pull request as ready for review July 28, 2026 12:56
@Flow-Fly

Copy link
Copy Markdown
Owner Author

Hotfix ready for owner merge at exact head e1aa2185abc1ef2494c74838d30ce11b844eefcc.

  • Regression test failed on parent 230611d and passes on this head.
  • Full local gate and required GitHub checks are green.
  • CodeRabbit reported no findings.
  • Automatic Codex Review completed clean with 👍.
  • Independent Terra exact-head review: APPROVE, no findings.

After merge, draft reconciliation PR #424 will be regenerated from corrected main. No merge was performed here.

@Flow-Fly
Flow-Fly merged commit cd62f5c into main Jul 28, 2026
3 checks passed
@Flow-Fly
Flow-Fly deleted the dev-425-empty-legacy-image-payloads branch July 28, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve empty legacy image payloads when opening projects

1 participant