Skip to content

List the binary file paths that cannot be preserved in the SDK patch - #183

Merged
petrikero merged 4 commits into
mainfrom
update-sdk-list-binary-files
Aug 25, 2026
Merged

List the binary file paths that cannot be preserved in the SDK patch#183
petrikero merged 4 commits into
mainfrom
update-sdk-list-binary-files

Conversation

@petrikero

@petrikeropetrikero commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

metaplay update sdk warns that binary files cannot be included in the patch, but it only reported a count. The paths were not reliably visible anywhere:

  • The general modified-files list marks binaries with (binary), but it is capped at 20 entries, so binaries beyond the cutoff are collapsed into ... and N more file(s).
  • Deleted entries are appended from a map iteration, so their ordering is nondeterministic between runs.
  • The generated patch file contains no trace of them: binaries are skipped silently during patch generation, with no Binary files differ marker.

So the files that need manual attention were exactly the ones the output could hide.

Change

  • Replace countBinaryFiles with binaryModifiedFiles, which returns the filtered slice instead of just a count. Callers use len() where they need the number.
  • Print every binary file under the warning, each with its modification type. No cap: giving visibility into what the patch cannot preserve is the point.
  • Phrase the backup step as a recommendation rather than an instruction. What to do about these files is the user's call.

The general list keeps its own cap of 20, so the binaries are always shown regardless of where they fall in that list.

Output now looks like:

WARNING: Binary files cannot be included in the patch and WILL BE OVERWRITTEN!
Back up these files if you want to keep your changes:
[modified] Assets/Plugins/foo.dll
[added] Assets/Art/logo.png
[deleted] Backend/lib/bar.so

Verification

go build ./..., go vet ./cmd/, go test ./cmd/ all pass. gofmt -l ./cmd clean, go mod tidy produces no changes.

Follow-ups (not in this PR)

  • The 20-entry cap on the general list is arbitrary (it arrived with the original command in Add 'metaplay update sdk' command to help with updating to newer SDK versions. #95 and was never revisited). Printing the full list with all actionable info below it is under discussion.
  • filepath.WalkDir in DetectSdkModificationsWithPatch does not skip .git, so a nested checkout or submodule under MetaplaySDK/ would report every object blob as an added binary file.
  • When every modification is binary, patchContent is empty and no patch file is written, yet the output still prints the patch path and patch -p1 < ... re-apply instructions.

The 'update sdk' warning only reported a count of binary files, and the
general modified-files list is capped at 20 entries, so the files that
must be restored by hand could be invisible in the output.
Replace countBinaryFiles with binaryModifiedFiles and print the paths
(up to 10, with an overflow line) directly under the warning.
Visibility into what the patch cannot preserve is the point, so drop the
10-entry cap and print every binary file. Whether to back them up is the
user's call, so recommend it rather than demanding it.
The message passed an argument to fmt.Sprintf with no formatting
directive, which go vet rejects and which would print an %!(EXTRA int=N)
suffix at runtime. The count is redundant now that every binary file is
listed, so drop the argument. Also fix an 'any' / 'and' typo and phrase
the backup step as the user's choice.
Only one line should introduce the list, so drop the forward reference
from the first line. Use 'cannot' rather than a contraction to match the
surrounding output, and say 'these files' and 'your changes' since the
modifications are detected, not hypothetical.
@petrikero
petrikero merged commit 5983430 into mainAug 25, 2026
2 checks passed
@petrikero
petrikero deleted the update-sdk-list-binary-files branch August 25, 2026 10:28
Sign up for freeto 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

@petrikero