fix(web): validate release archive layout against release revision #12788
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12788"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by voidlakhan on 2026-10-29T09:07:19Z.
What
Follow-up hardening after #12783.
PR #12783 fixed the immediate GitHub Pages deployment failure by allowing older release archives to omit files added to the current
WEB_FILESlist.This PR strengthens that validation by checking downloaded web release archives against the exact
WEB_FILESdefinition from the release revision recorded inweb-release.json, using:git show <revision>:tools/package_release.pyThis provides stricter validation than #12783 in one direction and better historical compatibility in another:
WEB_FILESdefinition do not incorrectly invalidate archives that were valid when their release was built.tools/build_web.py --releaserequires the recorded release revision to exist in the local Git history. The GitHub Pages deployment workflow (.github/workflows/pages.yml) usesfetch-depth: 0to provide the full history.WEB_FILESdefinitions and fails with concise diagnostics without modifying the existing published site.Tested
python tools/build_web.py --build build-wasm --releasesuccessfully published v0.1.3 using its historical file layout.python -m unittest tools/tests/test_build_web.py tools/tests/test_web_release.py— 68 tests passed.python tools/check_conventions.py --base upstream/main— passed.git diff --check upstream/main..HEAD— clean.Relationship to #12783
This PR builds on the immediate deployment fix delivered by #12783. It does not reimplement the original issue fix. Instead, it makes archive validation reflect the file set that was actually defined at the time each release was produced.
Checklist
main; no other open PR implements the same functionalityNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file.mdfiles, or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T11:28:33Z.
Review: APPROVED
Reviewed — approved
The rebased change validates a web release archive against the
WEB_FILESof the revision recorded in itsweb-release.json. It merges cleanly onto currentmain(which already has #12783), the two affected test suites pass, and a targeted negative control fails.What I ran
44c43e75a3239fce74b105a9dadace8907f34143main:ba5b5330b37724bca4b99f30faab504653635a04(contains #12783, merge89dce2838dfc7bd7c785ffd14e4e6aaf81bf8bc1)Results
maintools/build_web.pyandtools/tests/test_build_web.pyin the merged tree match the head commitgit diff --checkcheck_conventions.py --base origin/mainAll conventions checks passed.web_release,web_library_assetsunittestfor both filesRan 65 tests,OK, matching the descriptionrelease_web_files("3fd1cc393b…")against real historyfailure-report.mjsrelease_web_files(HEAD)WEB_FILESrelease_web_files("f" * 40)ValueError: Cannot resolve release revision: ffff…ctest
real-history probe
I checked the earlier review by oneandonlydean against the rebased head:
REQUIRED_WEB_FILESand theissuperset/issubsetcheck from #12783 are gone, and one duplicate-entry check remains.WebReleaseLayoutTestsnow patchrelease_web_files. The older-release case passes the reduced set.WEB_FILESdefinition that cannot be used now gets its own error,Invalid web release definition in revision.test_historical_release_missing_later_files_is_acceptednow patchesrelease_web_files, so it no longer depends on clone depth.Negative control
Restored
tools/build_web.pyfrommain: 3 failures and 46 errors. Most of these areAttributeErrors because the patchedrelease_web_filesdoes not exist, so this control is weak.Targeted control, kept the PR's code but changed one line:
expected_files = release_web_files(metadata["revision"])becameexpected_files = set(WEB_FILES). That is the behaviour this PR replaces. Result:FAILED (failures=2, errors=2). The failing tests are:test_release_lacking_a_newer_web_file_is_published_as_shippedtest_historical_release_missing_later_files_is_acceptedtest_unavailable_historical_revision_fails_cleanly_without_traceback_or_site_mutationtest_invalid_web_files_definition_fails_cleanly_without_traceback_or_site_mutationThis shows the tests depend on the revision lookup. After both controls I restored the merged files.
Findings
Blocking
None.
Non-blocking
A
TypeErrorescapes fromrelease_web_files. Intools/build_web.py:47-54,len(set(value))runs before theisinstance(item, str)check. A definition such asWEB_FILES = ([1],)therefore raisesTypeError: cannot use 'list' as a set element, which I reproduced.main()catches only(OSError, ValueError)attools/build_web.py:284-285, so the user gets a traceback instead of the clean error the description promises. The input comes from repository history, so the risk is low. Suggested fix: run theall(isinstance(item, str) …)check before theset()duplicate check, or addTypeErrorto theexceptclause.The import of
WEB_FILESis now unused in production code.tools/build_web.py:16imports it, but after this change only the tests read it, throughbuild_web.WEB_FILES. Suggested fix: have the tests import it frompackage_releaseand drop the import here.test_current_release_with_expected_files_is_accepteddepends on the git checkout. Attools/tests/test_build_web.py:472-480the test runs realgit rev-parse HEADandgit show HEAD:tools/package_release.py. It errors outside a git checkout. It also fails whileWEB_FILEShas uncommitted local edits, because the committedHEADcopy no longer matches the working tree. It does have a useful side effect: it fails as soon as a commit makesWEB_FILESsomethingast.literal_evalcannot read, such asBASE + (...), which would otherwise break the next release's Pages deploy. If that guard is the intent, a test that parses the working-treetools/package_release.pywith the same parser would keep it without needing git.The two CLI tests duplicate the release setup.
tools/tests/test_build_web.py:493-566rebuilds theresponses/releasedictionaries thatWebReleaseValidationTests.publishalready builds. A shared helper that returns them would cut about 50 lines.The description could be clearer about the change from #12783. As requested in the earlier review, it could name #12783 and spell out the trade-off:
WEB_FILESis now rejected.WEB_FILESno longer breaks an older release.The full-history requirement is already stated.
Not verified
build_web.py --releasepublication of v0.1.3, because the sandbox has no network..github/workflows/pages.ymlchecks out withfetch-depth: 0.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T12:43:52Z.
Review: APPROVED
Re-checked — approved
The new commit
c1801ba709fixes theTypeErrorI reported last time:release_web_filesnow checks entry types before the duplicate check, also catchesTypeError, and has a regression subtest for it. The merged tree passes the web tests, and the new subtest fails against the previous head.What changed since my last review
c1801ba7098ab5af55984daaf5e34f8ff95bca31, "fix(web): validate file path types before checking duplicates", on top of the previously reviewed44c43e75a3239fce74b105a9dadace8907f34143. No rebase.tools/build_web.py:47-56:len(value) == len(set(value))now runs after theall(isinstance(item, str) …)check, and theexceptclause is now(ValueError, SyntaxError, TypeError).tools/tests/test_build_web.py:587: adds a'WEB_FILES = ([1],)'case totest_historical_web_files_parser_rejects_invalid_or_duplicate_entries.What I ran
c1801ba7098ab5af55984daaf5e34f8ff95bca31main:5454cd2e455994d992aca39335ce60507eeda1ebResults
maingit diff --checkcheck_conventions.py --base origin/mainAll conventions checks passed.web_release,web_library_assetsunittestfor both filesRan 65 tests,OK(the new case is a subtest, so the count is unchanged)ctest
Negative control
Restored
tools/build_web.pyfrom the previous head44c43e75a3and kept the new test. The parser test fails on the new subtest, as expected:Kept the reorder and dropped
TypeErrorfrom theexceptclause: the test passes. The reorder alone fixes the reported case. The extraTypeErrorcatch still helps with inputs such asWEB_FILES = {[1]}, whereast.literal_evalitself raisesTypeError.I restored the merged files after both controls.
Previous findings
TypeErrorescapes fromrelease_web_files: Resolved. The negative control above shows the new subtest fails on the old code and passes now.WEB_FILES(tools/build_web.py:16): Still open. Non-blocking.test_current_release_with_expected_files_is_accepteddepends on the git checkout (tools/tests/test_build_web.py:472-480): Still open. Non-blocking.New findings
Blocking
None.
Non-blocking
None.
Not verified
build_web.py --releasepublication of v0.1.3, because the sandbox has no network.