Skip to content

fix: convert UUID to GUID blob in GetRawUnit for v1 MPRs#711

Merged
ako merged 1 commit into
mendixlabs:mainfrom
densmoe:fix/705-get-raw-unit-v1-blob
Jun 30, 2026
Merged

fix: convert UUID to GUID blob in GetRawUnit for v1 MPRs#711
ako merged 1 commit into
mendixlabs:mainfrom
densmoe:fix/705-get-raw-unit-v1-blob

Conversation

@densmoe

@densmoe densmoe commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Closes #705

What does it do?

GetRawUnit() in sdk/mpr/reader_documents.go passed the UUID string directly to SQLite on v1 MPR files (Mendix < 10.18), but UnitID is stored as a 16-byte GUID blob. The query never matched, silently returning "no rows" for every unit lookup.

The fix adds types.UUIDToBlob() before the query, consistent with getUnitByIDV1() in reader_units.go and GetRawUnitBytes() in writer_security.go which already have the correct implementation.

Testing

  • go build ./sdk/mpr/ — passes
  • go vet ./sdk/mpr/ — passes
  • go test ./sdk/mpr/ — all tests pass (including new regression test)
  • Regression test (TestGetRawUnit_V1) uses a trimmed Mendix 9.24 v1 MPR fixture and verifies all unit IDs returned by ListAllUnitIDs() can be retrieved via GetRawUnit()
  • Manually verified on real v1 MPR files (Mendix 9.24 / 10.18 / 10.24, 11MB–111MB)
  • Confirmed v2 MPR projects continue working unchanged (v2 path is unaffected)

Mendix validation

N/A — this is a read-only code path, no BSON serialization changes.

Agentic Code Testing

N/A — this is a library-level bug fix, not an MDL command.

🤖 Generated with Claude Code

…ixlabs#705)

GetRawUnit passed the UUID string directly to SQLite for v1 MPR files,
but UnitID is stored as a 16-byte GUID blob. The query never matched,
returning "no rows" for every lookup on v1 projects (Mendix < 10.18).

Apply types.UUIDToBlob() before querying, consistent with
getUnitByIDV1() and GetRawUnitBytes() which already do this correctly.

Includes regression test with a trimmed Mendix 9.24 v1 MPR fixture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Jun 29, 2026

@ako ako left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve — correct, minimal, well-tested fix. Verified the regression test fails without the fix and passes with it; full sdk/mpr package tests pass. The blob conversion is consistent with getUnitByIDV1() and GetRawUnitBytes().

@ako ako merged commit 52af4ba into mendixlabs:main Jun 30, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Jul 1, 2026
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.

GetRawUnit fails on v1 MPR files (UUID not converted to GUID blob)

2 participants