Skip to content

PAINTROID-761-4: Integrate legacy image parser to app and handle fallback cases#174

Draft
Amit-Matth wants to merge 6 commits into
Catrobat:developfrom
Amit-Matth:PAINTROID-761-parser-fixes
Draft

PAINTROID-761-4: Integrate legacy image parser to app and handle fallback cases#174
Amit-Matth wants to merge 6 commits into
Catrobat:developfrom
Amit-Matth:PAINTROID-761-parser-fixes

Conversation

@Amit-Matth

@Amit-Matth Amit-Matth commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This Pull Request corresponds to Stage 4 of our backward compatibility integration. It focuses on connecting the legacy model parsing engine to the application's file loader and ensuring robust fallback recovery for corrupted or truncated files.

PAINTROID-761

New Features and Enhancements

  • App File Loader Integration: Refactored LoadImageFromFileManager to explicitly support .catrobat and .bin (legacy catrobat-image) file extensions, routing them directly through the CatrobatImage.fromBytes parsing engine.
  • Truncated File Safeguard: Added a !reader.hasRemaining safeguard in legacy_model_parser.dart to prevent app crashes when loading .catrobat-image files that were corrupted or cut off early by the legacy Android app. The parser now gracefully stops and recovers whatever strokes were successfully saved before the EOF.
  • Fixed Collection Size Decoding: Fixed a byte misalignment issue where Kryo used 1-byte VarInts for generic object sizes, but Paintroid wrote explicit 4-byte Int32s for path actions and colors. Updated the parser to properly consume absolute 4-byte integers for these collections.

Refactorings and Bug Fixes

  • Added missing trailing commas in legacy parsing files to match standard Flutter formatting guidelines.
  • Added new fallback unit tests in catrobat_image_serializer_test.dart to verify that truncated binary files safely decode without throwing IndexOutOfBound exceptions.

Checklist

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Add the link to the ticket in Jira in the description of the PR
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines (Wiki)
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Add new information to the Wiki

@Amit-Matth
Amit-Matth marked this pull request as draft July 9, 2026 01:26
@Amit-Matth
Amit-Matth force-pushed the PAINTROID-761-parser-fixes branch 2 times, most recently from 8cbfa8d to 0fb3258 Compare July 13, 2026 15:34
@Amit-Matth
Amit-Matth marked this pull request as ready for review July 13, 2026 15:57
@Amit-Matth
Amit-Matth force-pushed the PAINTROID-761-parser-fixes branch from b6bdca6 to 9e08bfd Compare July 19, 2026 15:18
@Amit-Matth
Amit-Matth marked this pull request as draft July 21, 2026 05:41
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.

1 participant