Repository navigation
make_game: hash untracked rpf9-explorer files into the decoder digest - #6073
fishingpvalues wants to merge 2 commits into
Conversation
|
Tested on Windows Server 2022, CPython 3.13.12: partial
|
DoubleD17
left a comment
There was a problem hiding this comment.
An ignored C# source can change the build without changing the digest
At bc3593b1f0dc9367c49e0add259ea4498a4f3fcb, the new git ls-files --others --exclude-standard -z also honours core.excludesFile and .git/info/exclude. The pinned Core/RpfPreview.Core.csproj uses the .NET SDK's default Compile glob. A developer can put Core/LocalDecoder.cs in a local ignore rule and still compile it. In that case, adding or editing the file changes the decoder while the submodule HEAD, tracked diff and new enumeration remain identical, so decoder.sha256 can still reuse a stale export.
I built a minimal synthetic .NET 8 project twice on Windows with SDK 8.0.428. After adding Core/LocalDecoder.cs matched by a fixture core.excludesFile, the compiled program detected the new type, while the exact ls-files command returned zero paths in both runs. I inspected the pinned project and the PR diff statically. Could the digest include ignored compile inputs while still excluding build outputs such as bin/ and obj/?
No game files. AI-assisted.
|
Tested bc3593b on Windows 11, Git 2.52.0.windows.1, Python 3.12 (CPU only): concern, from the stacked #6058, not from this PR's own change
AI-assisted (Claude Code). |
bc3593b to
5303d56
Compare
|
Thanks @Atomic258 and @Jadiac5: rebased onto #6058 at @DoubleD17's point is implemented: the digest now also hashes ignored compiled inputs — macOS 27.2, Python 3.12.8: |
test_the_digest_follows_an_uncommitted_submodule_edit committed "-m x" in a temporary Git repository. A contributor whose global config sets core.hooksPath (a Conventional Commits commit-msg hook, e.g. a lint setup) had that hook reject the message, so the file failed on their machine while CI stayed green. Commit e1cc07c fixed the same problem in tests/test_make_game_submodule.py; this applies the same isolation to the two fixtures that still lacked it. The new test poisons the global config with a rejecting commit-msg hook, checks the control commit is rejected, and runs the fixture test in a subprocess under that config. It fails on main and passes with the fix.
5303d56 to
08965cb
Compare
|
Head is now |
5a4a01b to
4295086
Compare
…decoder digest compute_decoder_digest() hashed the submodule's HEAD and `git diff HEAD`, so a decoder source file the submodule does not track at all (added but not `git add`ed) left decoder.sha256 unchanged and the assets stage kept an export the new file would change. The same holds for a compiled input the .NET SDK builds but git ignores (Core/LocalDecoder.cs, a .resx, an imported .props), which a reviewer of this change showed with a synthetic .NET project. Both are hashed now: every untracked file, and of the ignored ones the compiled or imported inputs (.cs, .csproj, .props, .targets, .resx, .json) outside bin/ and obj/, so a build inside the submodule cannot churn the digest. The tests cover an untracked file, an ignored source and resource, and ignored bin/ and obj/ output.
4295086 to
9337339
Compare
|
One follow-up on @DoubleD17's point: the ignored set is now |
|
Windows confirmation for the stacked base: @nullmarsh tested #6058 at |
Claimed in #5781 (claim).
Depends on: #6058 (this branch builds on it; the digest test uses that PR's Git fixture isolation).
What changed and why
compute_decoder_digest()decides whether the assets stage re-exports: it hashed thethird_party/rpf9-explorersubmodule'sHEADand itsgit diff HEAD, then thetools/rpf9dumpsources. A decoder source file the submodule does not track at all — added but notgit added — is in neither:git diff HEADnever shows untracked files, sodecoder.sha256stayed the same andassets()kept an export the new file would change. The comment there called this a shortcut; this closes it.make_game.pycompute_decoder_digest(): after the tracked diff, hash the paths and exact bytes of every untracked file (git ls-files --others --exclude-standard -z) and of the ignored files a build would still compile (git ls-files --others --ignored --exclude-standard -z, filtered to.cs,.csproj,.props,.targets,.resxand.jsonoutsidebin/andobj/). That is @DoubleD17's review: the SDK compilesCore/**/*.cseven when the file is ignored through.gitignore,.git/info/excludeorcore.excludesFile, whilebin/andobj/are build output that must not churn the digest. Unreadable entries are hashed as a marker, not raised.tests/test_make_game_assets_decoder.py:test_the_digest_follows_an_untracked_file_in_the_submoduleaddsNewDecoder.cswithout adding it to the index;test_the_digest_follows_an_ignored_compiled_sourceadds an ignoredLocalDecoder.csandStrings.resxthrough.git/info/exclude, then ignoredbin/Generated.csandobj/notes.json. Both fail on the base and pass here; the ignored-output case must leave the digest unchanged. The fixtures' repeated isolation is oneisolated_git_env()helper (from tests: keep fixture commits out of the contributor's global Git hooks #6058's change, moved rather than copied).Tests run
macOS 27.2 (26B123), Python 3.12.8, CPU only, no game files, no GPU:
python -I tests/test_make_game_assets_decoder.py— OK, 8 tests (6 with tests: keep fixture commits out of the contributor's global Git hooks #6058 alone)python -m pytest tests -q -k "make_game or decoder"— 428 passed, 4 skippede2939175, withCore/LocalDecoder.csignored through itsinfo/exclude: the digest changes; withbin/Generated.csadded it does notpython -m compileall -q make_game.py tests/test_make_game_assets_decoder.py— clean1d86ef7d7: its synthetic global config writeshooksPaththroughgit config --fileand reads it back, so Git does the escaping itself (a hand-writtenC:\...was the error both Windows testers saw) and the test fails if the value does not round-trip. The Windows check of the hook fixture should be repeated here.AI-assisted.