Skip to content

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

Open
densmoe wants to merge 1 commit into
mendixlabs:mainfrom
densmoe:fix/705-get-raw-unit-v1-blob
Open

fix: convert UUID to GUID blob in GetRawUnit for v1 MPRs#711
densmoe wants to merge 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

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>
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)

1 participant