diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c84c29f..2a165b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install --index-url https://download.pytorch.org/whl/cpu torch - python -m pip install -r requirements.txt pytest + python -m pip install -r requirements.txt numpy safetensors pytest - name: Compile Python run: python -m compileall -q . - name: Run tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 075f2fd..ef36211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 3.2.1 + +- Added T2VA, First/Last Frame, FL2VA and persistent two-image Reference conditioning to the production sampler. +- Added crash-safe raw AV Run Storage, automatic resume, deterministic Revisions and partial regeneration. +- Combined ordered upstream graph fingerprints with runtime MODEL/CLIP/VAE weight probes for fail-closed reuse. +- Added per-chunk SHA-256 verification and rejected Regenerate From when Run Storage is disabled. +- Added official MiniMax H3 Sigma Shift graph-contract support. +- Updated CI dependencies, Windows runtime verification and package metadata for V3.2.1. +- Kept sampling, Continuation, Spectrum Interop and external Core VAE decode semantics unchanged. + ## 2.1.7 - Added the compact static `H3 Continuum Sampler` facade over the unchanged V2 execution core. diff --git a/INSTALL_JA.txt b/INSTALL_JA.txt index d4726ce..4305811 100644 --- a/INSTALL_JA.txt +++ b/INSTALL_JA.txt @@ -1,11 +1,11 @@ -ComfyUI-H3-Continuum 2.1.7 — インストール +ComfyUI-H3-Continuum 3.2.1 — インストール 1. ComfyUIを終了します。 2. ZIPを展開します。 3. `ComfyUI-H3-Continuum` フォルダーを ComfyUI/custom_nodes/ に配置します。 4. 旧 `ComfyUI-H3-Continuum-Join` が残っている場合は退避します。 5. ComfyUIを再起動します。 -6. 旧V2.1.6 UIが残る場合はブラウザをハードリロードします。 +6. 旧UIが残る場合はブラウザをハードリロードします。 StabilityMatrix標準例: D:\StabilityMatrix\Data\Packages\ComfyUI_W\custom_nodes\ComfyUI-H3-Continuum\ @@ -17,5 +17,6 @@ install_windows.bat - chunks: 2 または 3 - chunk_seconds: 5.0 - continuity: Balanced — 22 frames -- Seam Correction: Off(Native Continuity比較時)/ Auto(通常利用) +- Audio Seam: Off(標準)/ Auto(音声境界補正を試す場合) - Sequence Prompt: Text (Multiline)を接続 +- 最終Video/Audio VAE DecodeはComfyUI Coreノードへ接続 diff --git a/MANIFEST.sha256 b/MANIFEST.sha256 index 75653b8..bfc5112 100644 --- a/MANIFEST.sha256 +++ b/MANIFEST.sha256 @@ -1,76 +1,99 @@ -0005be4e1e56a88d5b2168dc3fe203d5f87944922aa400d87e8c840805d2a4e1 AGENTS.md -041289556cc621ea1857cbb8931ae41d817f69e084b2e8a7622e184a3197b61b tests/test_compatibility.py -06ae7327e491a324c7eec4d26b2ae053c96cfa489dc018c07e33eb63facde30c tests/test_temporal.py -0dbe8a5f71c92f3523942343b40787104c8b96781461ba3ba82934a6bdbe5834 THIRD_PARTY_NOTICES.md -0e59ea821081cb93165aa3f88c6949736dd225837fe1cdcf1173aa5cd54c6d29 examples/v2_prompt_timeline_example.txt -11877692d4aadea79ff35d4d5035457c26ac2ace7443889ed3fd7ee51e99a103 continuation.py -12cfcc0c71ca087fe39a5ce2922959a62b2bb311bfe664f05c4480affce03708 v2/seeds.py -13213e7709fd02bb810af3c18e4cd7d010f8cdfb121a4b99866a9f2333331089 v2/session_io.py -179fa62fcdac08439ae7fe0cd954a46b9bf03fd45418f503c3cb7c80ad1b9352 README.md -1d9ca37c408eaa73acc84e6c23fbae36723f57ad7ffcf0eea6d4150537c55e9a PACKAGE_INFO_JA.txt -23357af6f53e2a7283726d16c12043d8c01066167ecdbdbe74374942886b9816 constants.py -23bddc5a41d2e997f4fbf789c7128e32f4f197f1405b2aef1c76794f57482446 install_windows.bat -2854ff803998d70e08121813b225d8187cf693855d75d0af84ba8a52eaa5fce9 CHANGELOG.md -2c13aefd137db92a3dbf5576e9442d58012b1f0de1240c07d039ceeb702e7c1f docs/V2_1_4_UI_SIMPLIFICATION.md -34bb5b023c504e6ebcaaa52f37a5dd3e7ab592696848f38b44322095bff0cb84 tests/test_v2_registration.py -396fc6f02d6bc57758557ba0c84eb35ea067f8962ba633628c79dff975adad67 tests/test_model_patch.py -3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986 LICENSE -3a072882839c690b25006a318c99bedb2819ff75f7637c504541d7c110488acc nodes.py -3a359a0467725cc292ccb4c86cf0c3d30bb6a114d01f5345792b09ea3d45441d state.py -3d3f7cbad1070f14ad9b80f086eee5dfec4cf1e6b427287b457ae4793ca3b792 tests/test_v2_seam.py -3eeed61b7ee519631825e5f89e9a441644c66e552fce4207927cb8536867c8b1 tests/conftest.py -4080f1875b958b316e8e76852c4be5527a6de5c71d604e7642d3098478eb4a36 v2/sampling.py -43ec4023dc06c941e5d7a04db4b8a89fb58d744ceb986f6eb9bf534d4fdcb87b temporal.py -45e8839cd82fd955df344b3bc6efa20092b8870ea378b0c898b073665d3e47d7 tests/test_nodes_logic.py -467edb2c188d024c2392aafe7423b3f835e16b10f570da76e2f7dda8a962c1c5 requirements.txt -5543ec570f18f1d97327ffcf07f9eeaf078e7c7d3b3d722559d65a19d11dcb84 v2/h3_builder.py -58438c3ed814adf40cefde098a37cae00ddcb703b7e5548bbbb295e54bed5a6d tests/test_v2_widget_migration.py -5a26408c770381cdb259cb710de7dab12d7ddecca262bdbf35ba1566056050f5 examples/recommended_settings_v2.json -5fd282429f4c69f0678c9b7d64c26ebc06a2b1c64ef0bc7b3c6826420d4177ad PACKAGE_VALIDATION.txt -6056de6c0a5322a8a51ba5a114538dca2ef67788cd1afba10fedd483b95f6afa state_io.py -64a74d2e3d6e97cf31ad01bd73393e1f2ce90f3c81c26bda4ee86df6ecbd07a5 version.py -6771c9905d35666121c4892d2ec26202505f96d244ce814ad9a87a02878952cd examples/H3_CONTINUUM_V1_WIRING.md -68e1a724d3b99458b86b8f643dcb916183e7e8dd12d7b4b3850991feb8077694 examples/recommended_settings_v1.json -6b43294ebf00fde03acc3f2ac52f841f3c4323085c21643aa075a347cf4a432c layout_adapter.py -74e623120a963cb96b68651b44f47a836ea8449d30ce89d749c71ffad4766d4e tests/test_v2_seeds_motion.py -7660570840229b6fcbe62f0fbb52966d0099d64d7e6f01a739fbf9899293c8e4 docs/FUTURE_ROADMAP.md -7cbf23aee03b82f9081a81c77d66c25bcb1b4b562aebb2a9e7b9ccecfb51addc v2/seam_types.py -7dbbc8ce1018d6ac07c53eaa40f2d8d144babf9c6fe6bd94b7ec1d08adffa215 compatibility.py -7e27310301b13d3b8265b5e54359595ec0081ad55198435ae13932fdd2ad8164 v2/seam_guard.py -7f2dcb47992b5b3cfe32c9cf48b9e123daab505c04830656d7e8f70a0f54bc12 INSTALL_JA.txt -8127fdb840040ec85bb531226d3aa09f42b2b9cd44e93e761cc665d06f92b5af v2/prompts.py -85eada29c12706d55b78e4d8100899d1dadde4d9867406b8bac4eec22b81c6b6 .gitignore -873b2d42bef37e7d8c90616bef4cab2c29c0eb69393ba0bfd88d22e6aed4d382 pyproject.toml -9078617c14b1a7af17f6fa278cf3423c7b6f35373611600a3f52f268fa0cccae metadata.ini -912661d91c7f11f5fcaf0bd14d7d3ecf5c74c33b1507272f0ae72af6e5bffa6f tests/test_v2_decoder.py -94fda0afbc974125fa227757f0fdd2b22948c79761b271f481c404c2386afb5d .github/workflows/tests.yml -94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini -98a33c75b33ff0c10a68e04bd856e4e43b3e70b6ae1ea458a2b21b4e4d74f46d tests/test_state.py -9946efb1ae119b877098526d5ed1d769e92561fd98e806dc36470d4315aead41 tests/test_v217_stable_facade.py -9bcbf75309c340e29e7e46a99f4084c329f40677953e8f2264070bd98948a927 v2/nodes.py -a032738b0bc5acb136e92d8bf7694643a5f518b9c7fc0fc878d66d81ba8b1b04 docs/V2_1_6_UNIFIED_UI.md -a6e200c21036521383a838070f2fd6e822e1928d06c0fab52b52cc01f64951bb tests/test_v2_session.py -a9a4c10770a4a1b50db421d79d58f7aca8efa46232030ea9bd9495199f6e0cf8 tests/test_public_api.py -aea01a48a8c03a25ed97ea05e5b137f89e388832d1be7d38f2da2be3d1b9830b v2/motion.py -af89216e549f0a549340645a401b5dccc6aefb73e9f4cbc5e02285117ae46b3a v2/session.py -b08022df068576c759c8bf80ac6b6519693f3c65c917f1822aeb06ea359aa5b1 docs/V2_1_5_UI_SERIALIZATION_STABILITY.md -b3c1d1107706af437f8bca2e5053f54b6d357adc71417eeb6bb0074747e5e454 model_patch.py -b3de69a70bf0ccd291269651addca775d0295c30d53158b9eedd9818976d6ffe v2/sequence.py -b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py -b8275c8cecde12aee0418cea456d1e7f4b875cbb1bce32f1f3d9e06a44dd0be1 examples/v2_prompt_list_example.txt -c3cefcdf50df9d6609f583a008453b587c011a0fb41e290d5f1196ce62f58877 examples/H3_CONTINUUM_V2_WIRING_JA.md -c93a3e52e4deabe5ef0db7f34a7605856a543089574ba17227e697e9a2c0139a docs/ARCHITECTURE.md -cb473f21310c12c33007b218ad36eaccc0bfb2f1269f5d1036affc3e3f3027b5 tests/test_v2_sequence_orchestration.py -cde27db19b677e318cc4dfb4235be7a11429c19945f4083052a91fe117e74c82 v2/decoder.py -d3e213005670e94dee33a240349a4d245cf9a3b6602099f11ed30cf5a32e2c21 media.py -d406a9ce3446fae4f30810e8fea09d5b70c3bd027afbeecd67f007e8863998be README_JA.md -d4c53d2c260b635d70fa211029d608f63776e0a56c20253475fa47c58363f8a7 tests/test_state_io.py -dbf44a536c550e0cdffc01f8c3725b1b9af60dbeb16f45ff735f5d682276d389 tools/verify_runtime.py +15b900d02624bea6cfe8ea25b22266a0c68b38b9f10c9089be0e38988bf2e34d .github/workflows/tests.yml +0a2f69d4cec89d440f5d5aa1ec68a7c9a741382d313f80dcddf96d13f70b3e68 .gitignore dca65fb1393e67f59c6f81f9411e3e745eb8f1097e9a2adf7ffc6f4e3901ca9f __init__.py -e0c3d3b7b5d8ec5cd82b89e8a1e8ec9dd3364cabe0913abd8ac330e18352170e install_windows.ps1 -e30eaca61510ad5b224dacf2ee0797eabe5cc58594a0724dc2a6eaced8b34694 v2/diagnostics.py -e6fecb17e373333b315f0ce89e8dda3bda9dfdd34dac2656ae8785d26256c422 tests/test_layout_adapter.py +0005be4e1e56a88d5b2168dc3fe203d5f87944922aa400d87e8c840805d2a4e1 AGENTS.md +89f1cdf90b98f9d0167c4137b837e519698271f5fc549daf9952c136bc110748 CHANGELOG.md +7dbbc8ce1018d6ac07c53eaa40f2d8d144babf9c6fe6bd94b7ec1d08adffa215 compatibility.py +707884ea5ec950165044713ba70f54ce721470cab86821fead5259120ecbe66a conditioning.py +71e3df269e226b1ecad597f9831c2a10b2215c8a3783652e9e9f536e99ce46c9 constants.py +11877692d4aadea79ff35d4d5035457c26ac2ace7443889ed3fd7ee51e99a103 continuation.py +596a0630270846e28d8490e195b73943289ecca448cf9f0263a589e3238d2f4b docs/AB_TEST_LOG_JA.md +c93a3e52e4deabe5ef0db7f34a7605856a543089574ba17227e697e9a2c0139a docs/ARCHITECTURE.md +7660570840229b6fcbe62f0fbb52966d0099d64d7e6f01a739fbf9899293c8e4 docs/FUTURE_ROADMAP.md +6c72d9a9e35648355c4dd4c8f060a6b7667e322f4b6c86690df9d6769ba182b7 docs/images/h3-continuum-advanced.png +b9f1dca35706a1cd963ba892d218568ea30173c6cf6a3bdc896f7a2266eb9407 docs/images/h3-continuum-detailed-report.png +de5f8fbce6bc423817acf7dc86bb0c8805a1fd962afdb2722cde7395f117eb56 docs/images/h3-continuum-image-scale.png +a384e26f3b088607c616be1a2b038365147d92da0961d8f47060fed09f795062 docs/images/h3-continuum-sampler.png +759d18e15e0cf139630259db38123a824be565ec844a3d7ac020b74ff8537b25 docs/images/v31b-auto-resume.png +2c13aefd137db92a3dbf5576e9442d58012b1f0de1240c07d039ceeb702e7c1f docs/V2_1_4_UI_SIMPLIFICATION.md +b08022df068576c759c8bf80ac6b6519693f3c65c917f1822aeb06ea359aa5b1 docs/V2_1_5_UI_SERIALIZATION_STABILITY.md +a032738b0bc5acb136e92d8bf7694643a5f518b9c7fc0fc878d66d81ba8b1b04 docs/V2_1_6_UNIFIED_UI.md f0806bb2b999794ddda072e98424dbd1b613df1cd8a096b12d979f124e066d8a docs/VALIDATION_JA.md +6771c9905d35666121c4892d2ec26202505f96d244ce814ad9a87a02878952cd examples/H3_CONTINUUM_V1_WIRING.md +20f4e7c4ad085791f8b578f575d03e52ef09d0d4550aa58ad086c9857b59bf29 examples/H3_Continuum_V2.json +f67febfdd7b2bfca2ad4e477c87a9a74dbe636231f9db3e1158b944d7b9f8397 examples/H3_Continuum_V2.zip f85ba3c69a473f0ac4bb96895c6d6532e8270121da65f858e364b19d31f05ef5 examples/H3_Continuum_V2_3x5s.json -fcf068c7a7e606b084fa8483b9b50506d05fa370b747114ac958240fd1a73757 tests/test_v2_prompts.py +be419d6c773784823af7b58a3423ef2e21d3cc3e23c40e60e274560895ca034b examples/H3_Continuum_V2_README.txt +4b94f779a98bfc555f6999113a694da07746cc3cf400bfc70ebc580592034d52 examples/H3_Continuum_V2_reference.webp +c3cefcdf50df9d6609f583a008453b587c011a0fb41e290d5f1196ce62f58877 examples/H3_CONTINUUM_V2_WIRING_JA.md +68e1a724d3b99458b86b8f643dcb916183e7e8dd12d7b4b3850991feb8077694 examples/recommended_settings_v1.json +5a26408c770381cdb259cb710de7dab12d7ddecca262bdbf35ba1566056050f5 examples/recommended_settings_v2.json +b8275c8cecde12aee0418cea456d1e7f4b875cbb1bce32f1f3d9e06a44dd0be1 examples/v2_prompt_list_example.txt +0e59ea821081cb93165aa3f88c6949736dd225837fe1cdcf1173aa5cd54c6d29 examples/v2_prompt_timeline_example.txt +c88e4d4c86c4e9af392c959365fee24d7593e92f69df9acf7e36117536a5f335 graph_contract.py +3d57276669e4ce95f8537c67c6437250b52dd843ee0817c2e262018ead200107 hardening.py +6abdbc29472c7f9d447085b189fc47b69e110b94ef83192f9689d04000408843 INSTALL_JA.txt +23bddc5a41d2e997f4fbf789c7128e32f4f197f1405b2aef1c76794f57482446 install_windows.bat +d74073e7ee292ebeba913af4288284f9f197cd91fceed6c62bf6c66b784c7cec install_windows.ps1 +6b43294ebf00fde03acc3f2ac52f841f3c4323085c21643aa075a347cf4a432c layout_adapter.py +3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986 LICENSE +d3e213005670e94dee33a240349a4d245cf9a3b6602099f11ed30cf5a32e2c21 media.py +0220d75e8fc144cfac246793fdcd7f4a99008141b17042dacdfdd8b3a593f6fa metadata.ini +49424eff88b42967e3fc0b80876ecaf5b90626d38dc740c6124f9cb8bd1d1689 model_patch.py +dcaf662210b2329ccb4478dad2430d66eae2033b8925afb312e07e6150d394e0 nodes.py +a2ed99ccae02118a4f1d5c5c8aaab0daa853f355366f864573a6d365fccfdffd PACKAGE_INFO_JA.txt +770948a71cc503e8cb4c8bf53d5533c4ba6d2387e561a6dfb0e2e03b6bee33c4 PACKAGE_VALIDATION.txt +b470819f16fc179654dc1600721a63f0a5a14e777f4c004d574b499da6886ba5 public_api.py +80f5e4e15226ce2685f794da944413a10bc50b703f38133a7c4cfbdb07fffc9a pyproject.toml +94fdc2d545b2d4077a4d70229fd22ba3ccac21d49d1097d2873f76d04e9a3c7a pytest.ini +410fe6cf09c212bb384d3e23667ed16dca64058edc7ef287d851f291e4e2e6c4 README.md +d406a9ce3446fae4f30810e8fea09d5b70c3bd027afbeecd67f007e8863998be README_JA.md +49ecdd355bcda1c8ae12b4144af531e4685a07150dbc188995970151d030e55a reference.py +467edb2c188d024c2392aafe7423b3f835e16b10f570da76e2f7dda8a962c1c5 requirements.txt +3ca3efdb3b370fa95bdad2aef35b9d34b256c66a579849bd35f6e4f5999b3089 run_storage.py +3a359a0467725cc292ccb4c86cf0c3d30bb6a114d01f5345792b09ea3d45441d state.py +6056de6c0a5322a8a51ba5a114538dca2ef67788cd1afba10fedd483b95f6afa state_io.py +43ec4023dc06c941e5d7a04db4b8a89fb58d744ceb986f6eb9bf534d4fdcb87b temporal.py +3eeed61b7ee519631825e5f89e9a441644c66e552fce4207927cb8536867c8b1 tests/conftest.py +041289556cc621ea1857cbb8931ae41d817f69e084b2e8a7622e184a3197b61b tests/test_compatibility.py +7a1138fa8619247787039ddeb2f3692ba1f680b4553a13e472fadfbea1c88d07 tests/test_conditioning_modes.py +e6fecb17e373333b315f0ce89e8dda3bda9dfdd34dac2656ae8785d26256c422 tests/test_layout_adapter.py +e0d5d75bbdfafd5f31fe773b92dc65d57451edb8e222d1a9871a92713b395f0f tests/test_model_patch.py +45e8839cd82fd955df344b3bc6efa20092b8870ea378b0c898b073665d3e47d7 tests/test_nodes_logic.py +1ae0369943ba2fb13f21ad0cf56ee58621ba09bf20174379595e157a1775c7fd tests/test_public_api.py +98a33c75b33ff0c10a68e04bd856e4e43b3e70b6ae1ea458a2b21b4e4d74f46d tests/test_state.py +d4c53d2c260b635d70fa211029d608f63776e0a56c20253475fa47c58363f8a7 tests/test_state_io.py +58c06925ccf06c4feee19b927b3515c540c0536aa5f3f8d29be35b8e919915a7 tests/test_temporal.py +912661d91c7f11f5fcaf0bd14d7d3ecf5c74c33b1507272f0ae72af6e5bffa6f tests/test_v2_decoder.py +bbbd655731cc69414aed8bef59e236e17ed4cd891a40114e490a4804f2f96fff tests/test_v2_prompts.py +5dfdd4b108ba7444c0f5f371c3b1e244b5735d23136127b9818fd60738c78b68 tests/test_v2_registration.py +0a520b34b12e1d2556d50480c43318de7eab4221afb96ef4760127c8bc90c890 tests/test_v2_seam.py +74e623120a963cb96b68651b44f47a836ea8449d30ce89d749c71ffad4766d4e tests/test_v2_seeds_motion.py +91a45db5cdcf9b96e34e264ffd23b20ed6c10c57dc8d401d130bd0c231371219 tests/test_v2_sequence_orchestration.py +0b5b20a8318862d167f135720e0489b8d4f93406d67c6646e052e35b03dcb876 tests/test_v2_session.py +58438c3ed814adf40cefde098a37cae00ddcb703b7e5548bbbb295e54bed5a6d tests/test_v2_widget_migration.py +4628d862851fb5d0f849da9262be961102ab83545f00fa435dd2495bcb4709e6 tests/test_v217_stable_facade.py +78bc478a5e4edda902c80849c911782a99e75c06dfb04127391b6cc5b27b28e1 tests/test_v3_hardening.py +1ff1fbb15864535ff8ff095cd4f75a45112495cf0959701bf063d7da363414df tests/test_v31_run_storage.py +1a5c9e81abebd71fb6004153710c7a8ed459a9da763b9027de4562d2da25a488 tests/test_v32_reference.py +0dbe8a5f71c92f3523942343b40787104c8b96781461ba3ba82934a6bdbe5834 THIRD_PARTY_NOTICES.md +aa9cd295b3762df2f367a8d51247351c803e7507bddf8fe6bb29e7809878b845 tools/verify_runtime.py ffd61f3f31c9b6430e1169007ee906c8f5000eba63ee44e2976ad4f5f1112671 v2/__init__.py +cde27db19b677e318cc4dfb4235be7a11429c19945f4083052a91fe117e74c82 v2/decoder.py +31012ec48a64c7467ad869c79982b7f8502c1785c33f51ee1b5727ce8b4243fb v2/diagnostics.py +10bbdf1f39b625cea448363aba908868d2106f960efd71115e037ad5f1e24c09 v2/h3_builder.py +aea01a48a8c03a25ed97ea05e5b137f89e388832d1be7d38f2da2be3d1b9830b v2/motion.py +d758281825cc50ff386b3b6adbc47b4dca2e3aadb2a31924e82aa7f748f76e49 v2/nodes.py +cfab4847c2fd53b507081ee21724e7120666b52d1b98d159717ad54d1ca8fd9b v2/prompts.py +4080f1875b958b316e8e76852c4be5527a6de5c71d604e7642d3098478eb4a36 v2/sampling.py +2fd811794c4cc0f2ce050250b80484876454926b9f20fce6af3a97d728e5acdf v2/seam_guard.py +be0d8585fa57e0ccd6d02577bbc7299629e5bfe20e186747f571fccc98b67d7e v2/seam_types.py +12cfcc0c71ca087fe39a5ce2922959a62b2bb311bfe664f05c4480affce03708 v2/seeds.py +e7aace33b4ea7c104f7883814841690175556cb3ff25ff21eb7c3401eedb5742 v2/sequence.py +b708599c0f6ffba4556e77536558a415104b0d4c1d043f335197bfb6960f07df v2/session.py +13213e7709fd02bb810af3c18e4cd7d010f8cdfb121a4b99866a9f2333331089 v2/session_io.py +78c830cdf49034c6e3b2cd3da5914d5cfc5638eb63ec6dbd1bab13c50d6d4caf v3/__init__.py +9cdb682168cea0cd4bb2e8ce69d043ddcbdb9204901035e6ccabad112e77f81a v3/assembly.py +2b938cd7c338224fe87230a4672620dcadef6f0f22a57a3f472ec71e02aa3dfd v3/nodes.py +66bd67c9ec7d8a7f32c7d1c1fc4ce1c19b42fda5d7cece67b171c3cffc49f0a8 v3/plan.py +4085160d48172468901b9c0fd1229e97c3328ef1870071c2c8d0e4e7ac056e6e version.py diff --git a/PACKAGE_INFO_JA.txt b/PACKAGE_INFO_JA.txt index f18c99f..60d0eeb 100644 --- a/PACKAGE_INFO_JA.txt +++ b/PACKAGE_INFO_JA.txt @@ -1,21 +1,22 @@ 名称: ComfyUI-H3-Continuum -バージョン: 2.1.7 +バージョン: 3.2.1 対象: ComfyUI native MiniMax H3 主ノード: H3 Continuum Sampler ライセンス: GPL-3.0-or-later 追加pip依存: なし -V2.1.7: -- 標準ComfyUI描画だけを使用する静的Facade UI -- Clip Overrides / Advanced / Resultをpack補助ノードへ分離 -- 動的socket、DOM非表示、proxy widget、手動serialization処理を廃止 -- 旧H3ContinuumSamplerV2をLegacy/Core互換ノードとして維持 -- State/Session/Prompt Plan schemaとSampling処理は変更なし +V3.2.1: +- T2VA / I2VA / FL2VA / Reference + Continuation +- 最大2枚のReference Imageを全Chunkで維持 +- Core Video/Audio VAE Decodeへ外出し +- Run StorageによるChunk保存、自動再開、部分再生成 +- Graph + runtime署名とChunk SHA-256による安全側の再利用判定 +- 旧V1/V2/V3 Node IDをWorkflow互換のため維持 Core: - native H3 raw video/audio latent continuation - 5/22/39f + Auto context - Spectrum Interop API v1 Actual Prefix 2 request - SageAttention / Sol-Attn / Spectrum外部併用 -- Session resume / reroll -- Seam Correction Auto / Off / Basic +- Session / Run Storage resume / reroll +- Audio Seam Off / Auto diff --git a/PACKAGE_VALIDATION.txt b/PACKAGE_VALIDATION.txt index e567c82..a9a61dd 100644 --- a/PACKAGE_VALIDATION.txt +++ b/PACKAGE_VALIDATION.txt @@ -1,17 +1,20 @@ -ComfyUI-H3-Continuum 2.1.7 — Package Validation -Date: 2026-08-10 +ComfyUI-H3-Continuum 3.2.1 - Package Validation +Date: 2026-08-13 -Build basis: -- GitHub repository: ukr8b3g-cmyk/ComfyUI-H3-Continuum -- Repository source starts from V2.1.5 HEAD 28b5b751a665fe47a026eb1c8222ab83ce859360 -- V2.1.7 adds a static Facade over the unchanged V2 execution core. +Release hardening scope: +- Graph + runtime MODEL/CLIP/VAE sampling contract +- Chunk file SHA-256 verification +- Run Storage automatic ID fallback and Storage-only partial regeneration +- V3.2.1 Windows installer/runtime verifier +- Explicit CI numpy/safetensors test dependencies -Automated validation for this V2.1.7 change: -- Not executed yet. -- Required commands: python -m compileall -q .; python -m pytest -q +Required automated validation: +- python -m compileall -q . +- python -m pytest -q -p no:cacheprovider -Still requires the user's ComfyUI browser/GPU runtime validation: -- New Facade and three pack helper nodes appear without Import Error -- Legacy H3ContinuumSamplerV2 workflows still load -- Workflow save/reload retains Facade and pack values/connections -- Full MiniMax H3 generation and Spectrum Prefix 2 log verification +Runtime validation still required before a public Release: +- Save, interrupt and resume a multi-chunk run +- FL2VA -> Ref2VA -> FL2VA Revision restoration +- MODEL/LoRA change creates a separate Revision +- Corrupted stored Chunk is rejected +- Spectrum Actual Prefix 2 is claimed only when the receiver accepts it diff --git a/README.md b/README.md index a0a57a1..e52f533 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ The sampler selects the mode from connected image inputs. Reference images and First/Last Frame are mutually exclusive. `Reference 2` cannot be used without `Reference 1`. -For the formally supported Reference path, connect a MiniMax H3 **Ref2VA** MODEL upstream. FL2VA MODEL + Reference conditioning has also worked in local testing, but should be treated as experimental rather than an official checkpoint pairing. +For the formally supported Reference path, connect a MiniMax H3 **Ref2VA** MODEL upstream. With **Strict Compatibility** enabled (the default), Reference generation stops unless the upstream base checkpoint can be verified as Ref2VA. FL2VA MODEL + Reference conditioning has also worked in local testing, but requires Strict Compatibility to be disabled and remains experimental. Reference prompts should identify the images explicitly: @@ -184,7 +184,7 @@ Chunk 2 reused Chunk 3 generated ``` -Run Storage creates deterministic Revisions from the sampling contract. It tracks observable inputs including: +Run Storage creates deterministic Revisions from the sampling contract. When Run Name and Auto Resume ID are blank, a stable storage ID is derived from the sampler node. It tracks observable inputs including: - H3 MODEL loader and ordered MODEL patch/wrapper chain. - LoRA/Turbo enabled state, filename, and strength. @@ -194,13 +194,15 @@ Run Storage creates deterministic Revisions from the sampling contract. It track Changing FL2VA to Ref2VA, changing LoRA strength, or changing another tracked setting creates or selects a different Revision. Returning to an earlier compatible configuration reuses its earlier Revision. -Unknown upstream wrappers fail safe: chunks may still be saved, but automatic reuse is disabled when the graph cannot be identified reliably. +The upstream graph and runtime MODEL/CLIP/VAE weight probes are both retained. Unknown wrappers or incomplete runtime probes fail safe: chunks may still be saved, but automatic reuse is disabled when identity cannot be established reliably. + +Saved chunk files are verified by size and SHA-256 before reuse. Storage schema changes preserve old files but do not automatically reuse unverifiable older chunks. Even when all sampling chunks are reused, Core VAE Decode and final assembly run again. A reused 15-second test can therefore still take roughly one minute. ### Regenerate from a chunk -Select `Chunk N` in `Regenerate From` to reuse chunks before N and regenerate N onward. Keep `Auto` for normal resume. +Select `Chunk N` in `Regenerate From` to reuse chunks before N and regenerate N onward. Keep `Auto` for normal resume. Chunk regeneration requires `Run Storage = Save + Auto Resume`. `reroll_nonce = 0` uses automatic Revision behavior. A positive nonce is retained for compatibility and explicit branch selection. @@ -223,7 +225,7 @@ A compatible receiver logs: Spectrum H3: accepted H3 Continuum API v1, actual prefix=2 ``` -Older Spectrum versions ignore the hint and continue normally. +Actual Prefix 2 is active only when the Spectrum log reports that the Continuum API request was accepted. Older or incompatible Spectrum versions continue without that receiver behavior. ### Standard and Turbo profiles @@ -312,11 +314,7 @@ python -m compileall -q . python -m pytest -q ``` -Current V3.2.1 runtime validation: - -```text -112 passed -``` +The GitHub Actions workflow runs compileall and the full pytest suite with its explicit test dependencies. ## License diff --git a/graph_contract.py b/graph_contract.py index e0907e0..a4c8dc8 100644 --- a/graph_contract.py +++ b/graph_contract.py @@ -7,7 +7,7 @@ import json from typing import Any -GRAPH_CONTRACT_VERSION = 1 +GRAPH_CONTRACT_VERSION = 2 # Keep this deliberately explicit. New loader/patch nodes must be audited before # their saved chunks can be resumed automatically. @@ -21,6 +21,8 @@ _KNOWN_MODEL_NODES = { "SpectrumApplyMiniMaxH3", "MiniMaxH3MemoryEfficientSageAttention", "MiniMaxH3MemoryEfficientSageAttentionPatch", + "MiniMaxH3SigmaShift", + "ModelSamplingMiniMaxH3", } _KNOWN_CLIP_NODES = {"CLIPLoader", "DualCLIPLoader", "TripleCLIPLoader"} _KNOWN_VAE_NODES = {"VAELoader"} @@ -29,6 +31,10 @@ _KNOWN_SHARED_NODES = { "Any Switch (rgthree)", } +CHECKPOINT_REF2VA = "ref2va" +CHECKPOINT_FL2VA = "fl2va" +CHECKPOINT_UNKNOWN = "unknown" + def _canonical(value: Any) -> str: return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True) @@ -149,3 +155,60 @@ def build_upstream_graph_contract( } descriptor["sha256"] = _sha256(descriptor) return descriptor, safe, list(dict.fromkeys(reasons)) + + +def classify_h3_checkpoint(prompt: Any, unique_id: Any) -> str: + """Classify the base H3 UNET connected to the sampler, without guessing.""" + if not isinstance(prompt, dict): + return CHECKPOINT_UNKNOWN + sampler_node = prompt.get(str(unique_id)) + if not isinstance(sampler_node, dict): + return CHECKPOINT_UNKNOWN + model_link = (sampler_node.get("inputs") or {}).get("model") + if not ( + isinstance(model_link, (list, tuple)) + and len(model_link) == 2 + and isinstance(model_link[0], (str, int)) + ): + return CHECKPOINT_UNKNOWN + + stack = [str(model_link[0])] + visited: set[str] = set() + classifications: set[str] = set() + while stack: + node_id = stack.pop() + if node_id in visited: + continue + visited.add(node_id) + node = prompt.get(node_id) + if not isinstance(node, dict): + return CHECKPOINT_UNKNOWN + inputs = node.get("inputs") or {} + if str(node.get("class_type", "")) == "UNETLoader": + loader_text = " ".join( + str(value).lower() + for value in inputs.values() + if isinstance(value, str) + ) + if "ref2va" in loader_text or "ref2v" in loader_text: + classifications.add(CHECKPOINT_REF2VA) + elif "fl2va" in loader_text or "fl2v" in loader_text: + classifications.add(CHECKPOINT_FL2VA) + else: + classifications.add(CHECKPOINT_UNKNOWN) + continue + linked = False + for value in inputs.values(): + if ( + isinstance(value, (list, tuple)) + and len(value) == 2 + and isinstance(value[0], (str, int)) + and str(value[0]) in prompt + ): + stack.append(str(value[0])) + linked = True + if classifications == {CHECKPOINT_REF2VA}: + return CHECKPOINT_REF2VA + if classifications == {CHECKPOINT_FL2VA}: + return CHECKPOINT_FL2VA + return CHECKPOINT_UNKNOWN diff --git a/install_windows.ps1 b/install_windows.ps1 index ac47ae1..8a39415 100644 --- a/install_windows.ps1 +++ b/install_windows.ps1 @@ -46,5 +46,5 @@ if (Test-Path $python) { Write-Warning "venv Python was not found; installation was copied but runtime verification was skipped." } -Write-Host "Installed H3 Continuum 2.1.6 to: $destination" +Write-Host "Installed H3 Continuum to: $destination" Write-Host "Restart ComfyUI. If the browser cached the old frontend, use a hard reload." diff --git a/metadata.ini b/metadata.ini index b0eff50..f716d81 100644 --- a/metadata.ini +++ b/metadata.ini @@ -1,4 +1,4 @@ [project] name = H3 Continuum -version = 3.0.1 -description = Integrated native MiniMax H3 long-video continuation with stable Vue UI, V1 compatibility and external SageAttention, Sol-Attn and Spectrum composition. +version = 3.2.1 +description = Native MiniMax H3 continuation with Core VAE decode, Reference conditioning and crash-safe Run Storage. diff --git a/pyproject.toml b/pyproject.toml index c95dccf..fc74c53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "comfyui-h3-continuum" -version = "3.2.0" +version = "3.2.1" description = "Integrated N-chunk continuation for ComfyUI native MiniMax H3 video and audio" readme = "README.md" requires-python = ">=3.10" diff --git a/reference.py b/reference.py index c5f1060..a804c44 100644 --- a/reference.py +++ b/reference.py @@ -80,9 +80,13 @@ def _validate_image(name: str, image: torch.Tensor) -> torch.Tensor: raise ReferenceConditioningError(f"{name} must be a ComfyUI IMAGE tensor") if int(image.shape[0]) < 1 or int(image.shape[1]) < 1 or int(image.shape[2]) < 1: raise ReferenceConditioningError(f"{name} is empty") + if int(image.shape[0]) != 1: + raise ReferenceConditioningError( + f"{name} must contain exactly one image (batch size B=1)" + ) if int(image.shape[-1]) < 3: raise ReferenceConditioningError(f"{name} must have RGB channels") - return image[:1, :, :, :3] + return image[:, :, :, :3] def _resize_reference( diff --git a/run_storage.py b/run_storage.py index 09a220a..695a3c1 100644 --- a/run_storage.py +++ b/run_storage.py @@ -5,6 +5,7 @@ from __future__ import annotations import contextvars import hashlib import json +import marshal import os import re import shutil @@ -22,7 +23,7 @@ from .constants import CONTINUUM_ACTUAL_PREFIX_STEPS from .v2.session import make_session, validate_chunk_entry -RUN_STORAGE_SCHEMA_VERSION = 1 +RUN_STORAGE_SCHEMA_VERSION = 2 from .conditioning import ( CONDITIONING_MODES, conditioning_mode_from_presence, @@ -30,7 +31,7 @@ from .conditioning import ( ) -SAMPLING_CONTRACT_VERSION = 4 +SAMPLING_CONTRACT_VERSION = 5 RUN_STORAGE_OFF = "Off" RUN_STORAGE_AUTO = "Save + Auto Resume" RUN_STORAGE_OPTIONS = (RUN_STORAGE_OFF, RUN_STORAGE_AUTO) @@ -75,12 +76,24 @@ def sanitize_run_name(value: str) -> str: return name -def resolve_run_storage_name(*, project_id: str, legacy_run_name: str = "") -> str: +def resolve_run_storage_name( + *, project_id: str, legacy_run_name: str = "", automatic_key: str = "" +) -> str: """Resolve a stable storage folder while preserving old Run Name workflows.""" legacy = str(legacy_run_name) if legacy: return sanitize_run_name(legacy) raw_project_id = str(project_id).strip() + if not raw_project_id: + key = str(automatic_key).strip() + if not key: + raise RunStorageError( + "Automatic Resume ID is unavailable; enter a Run Name for this workflow" + ) + digest = hashlib.sha256( + f"H3ContinuumSamplerProduction:{key}".encode("utf-8") + ).hexdigest()[:24] + return f"run_auto_{digest}" try: parsed = uuid.UUID(raw_project_id) except (ValueError, AttributeError, TypeError) as exc: @@ -92,6 +105,51 @@ def resolve_run_storage_name(*, project_id: str, legacy_run_name: str = "") -> s return f"run_{parsed.hex}" +def automatic_project_key(prompt: Any, unique_id: Any) -> str: + """Build a stable key from sampler identity and graph topology only.""" + node_id = str(unique_id).strip() + if not node_id: + raise RunStorageError("Automatic Resume ID requires the sampler node ID") + if not isinstance(prompt, dict): + raise RunStorageError( + "Automatic Resume ID requires the ComfyUI prompt graph; enter a Run Name" + ) + def visit(current_id: str, stack: set[str]) -> dict[str, Any]: + if current_id in stack: + return {"node_id": current_id, "cycle": True} + raw = prompt.get(current_id) + if not isinstance(raw, dict): + return {"node_id": current_id, "missing": True} + links = [] + inputs = raw.get("inputs") or {} + next_stack = set(stack) + next_stack.add(current_id) + if isinstance(inputs, dict): + for name in sorted(inputs): + value = inputs[name] + if ( + isinstance(value, (list, tuple)) + and len(value) == 2 + and isinstance(value[0], (str, int)) + and isinstance(value[1], int) + and str(value[0]) in prompt + ): + child_id = str(value[0]) + links.append( + { + "input": str(name), + "output": int(value[1]), + "node": visit(child_id, next_stack), + } + ) + return { + "node_id": current_id, + "class_type": str(raw.get("class_type", "")), + "links": links, + } + return _hash({"sampler_node_id": node_id, "topology": visit(node_id, set())}) + + def _output_root() -> Path: try: import folder_paths @@ -141,6 +199,14 @@ def _read_json(path: Path) -> dict[str, Any]: return value +def _file_sha256(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as handle: + for block in iter(lambda: handle.read(1024 * 1024), b""): + digest.update(block) + return digest.hexdigest() + + def _qualified(value: Any) -> str: if value is None: return "none" @@ -209,7 +275,9 @@ def _observe(value: Any, *, depth: int = 0) -> tuple[Any, bool]: descriptor: dict[str, Any] = {"callable": _qualified(value)} safe = True if code is not None: - descriptor["code_sha256"] = hashlib.sha256(code.co_code).hexdigest() + descriptor["code_sha256"] = hashlib.sha256( + marshal.dumps(code) + ).hexdigest() defaults, defaults_safe = _observe(getattr(value, "__defaults__", None), depth=depth + 1) kwdefaults, kw_safe = _observe(getattr(value, "__kwdefaults__", None), depth=depth + 1) closure_values = tuple(cell.cell_contents for cell in (getattr(value, "__closure__", None) or ())) @@ -262,8 +330,13 @@ def _model_signature(model: Any, legacy_fingerprint: str) -> tuple[dict[str, Any "transformer_options": observed_transformer, "patches": patches, "weight_probe": weights, + "runtime_observation": { + "wrappers_complete": bool(wrappers_safe), + "patches_complete": bool(patches_safe), + "transformer_options_complete": bool(transformer_safe), + }, } - return descriptor, wrappers_safe and patches_safe and transformer_safe and weights_safe + return descriptor, weights_safe and bool(weights) def _sampler_signature(sampler: Any) -> tuple[dict[str, Any], bool]: @@ -356,13 +429,18 @@ def _clip_signature(clip: Any) -> tuple[dict[str, Any], bool]: if value is None or isinstance(value, (bool, int, float, str)): tokenizer_config[name] = value tokenizer_safe = tokenizer is not None and tokenizer_wrapper is not None and tokenizer_core is not None - return { + descriptor = { "wrapper_type": _qualified(clip), "conditioner": module_value, "patcher": patcher_value, "tokenizer": tokenizer_config, "options": options, - }, module_safe and patcher_safe and options_safe and tokenizer_safe + "runtime_observation": { + "patcher_complete": bool(patcher_safe), + "options_complete": bool(options_safe), + }, + } + return descriptor, module_safe and tokenizer_safe def _video_vae_signature(video_vae: Any, *, required: bool) -> tuple[dict[str, Any], bool]: @@ -383,7 +461,11 @@ def _video_vae_signature(video_vae: Any, *, required: bool) -> tuple[dict[str, A "chunked_io": bool(getattr(first_stage, "comfy_has_chunked_io", False)), } observed, config_safe = _observe(config) - return observed, module_safe and patcher_safe and config_safe + observed["runtime_observation"] = { + "patcher_complete": bool(patcher_safe), + "config_complete": bool(config_safe), + } + return observed, module_safe def _apply_nonce_contract( @@ -471,11 +553,20 @@ def build_sampling_contract( boundary = int(reroll_from_chunk) graph_authoritative = upstream_graph_contract is not None if graph_authoritative: - model_value = {"source": "comfy_prompt_graph", "route": upstream_graph_contract.get("routes", {}).get("model")} - clip_value = {"source": "comfy_prompt_graph", "route": upstream_graph_contract.get("routes", {}).get("clip")} + routes = upstream_graph_contract.get("routes", {}) + model_value = { + "runtime": model_value, + "graph_route": routes.get("model"), + } + clip_value = { + "runtime": clip_value, + "graph_route": routes.get("clip"), + } if uses_video_vae: - video_vae_value = {"source": "comfy_prompt_graph", "route": upstream_graph_contract.get("routes", {}).get("video_vae")} - model_safe = clip_safe = video_vae_safe = bool(upstream_graph_safe) + video_vae_value = { + "runtime": video_vae_value, + "graph_route": routes.get("video_vae"), + } global_contract = { "sampling_contract_version": SAMPLING_CONTRACT_VERSION, "conditioning_mode": conditioning_mode, @@ -526,13 +617,13 @@ def build_sampling_contract( effective_nonce=int(reroll_nonce) if boundary > 0 else 0, ) reasons = list(upstream_graph_reasons or []) if graph_authoritative else [] - if not graph_authoritative and not model_safe: + if not model_safe: reasons.append("MODEL wrapper/patch contract is not completely observable") if not sampler_safe: reasons.append("SAMPLER function/options are not completely observable") - if not graph_authoritative and not clip_safe: + if not clip_safe: reasons.append("CLIP/Qwen encoder contract is not completely observable") - if not graph_authoritative and not video_vae_safe: + if not video_vae_safe: reasons.append("Video VAE contract is not completely observable") graph_safe = bool(upstream_graph_safe) if graph_authoritative else True return contract, model_safe and clip_safe and video_vae_safe and sampler_safe and graph_safe, reasons @@ -543,11 +634,41 @@ def revision_identity(contract: dict[str, Any]) -> tuple[str, str]: return full[:16], full +def _pid_exists_windows(pid: int) -> bool: + """Probe a Windows PID without sending a console event or terminating it.""" + import ctypes + from ctypes import wintypes + + process_query_limited_information = 0x1000 + error_access_denied = 5 + kernel32 = ctypes.WinDLL("kernel32", use_last_error=True) + kernel32.OpenProcess.argtypes = ( + wintypes.DWORD, + wintypes.BOOL, + wintypes.DWORD, + ) + kernel32.OpenProcess.restype = wintypes.HANDLE + kernel32.CloseHandle.argtypes = (wintypes.HANDLE,) + kernel32.CloseHandle.restype = wintypes.BOOL + ctypes.set_last_error(0) + handle = kernel32.OpenProcess( + process_query_limited_information, + False, + int(pid), + ) + if handle: + kernel32.CloseHandle(handle) + return True + return ctypes.get_last_error() == error_access_denied + + def _pid_exists(pid: int) -> bool: if pid <= 0: return False if pid == os.getpid(): return True + if os.name == "nt": + return _pid_exists_windows(pid) try: os.kill(pid, 0) except ProcessLookupError: @@ -700,6 +821,11 @@ class RunStorageController: path = self.revisions_root / source / "chunks" / filename if path.stat().st_size != int(record["file_size"]): raise RunStorageError(f"stored chunk size mismatch: {filename}") + expected_sha256 = str(record.get("file_sha256", "")) + if not expected_sha256: + raise RunStorageError(f"stored chunk SHA-256 is missing: {filename}") + if _file_sha256(path) != expected_sha256: + raise RunStorageError(f"stored chunk SHA-256 mismatch: {filename}") with safe_open(str(path), framework="pt", device="cpu") as handle: if set(handle.keys()) != {"audio", "video"}: raise RunStorageError(f"stored chunk tensors are invalid: {filename}") @@ -926,6 +1052,7 @@ class RunStorageController: "storage_revision_id": self.revision_id, "filename": filename, "file_size": target.stat().st_size, + "file_sha256": _file_sha256(target), "entry": _entry_metadata(storage_entry), } records = existing_records[:position] diff --git a/tests/test_v2_sequence_orchestration.py b/tests/test_v2_sequence_orchestration.py index 9c53bf5..e397be7 100644 --- a/tests/test_v2_sequence_orchestration.py +++ b/tests/test_v2_sequence_orchestration.py @@ -1,8 +1,9 @@ from types import SimpleNamespace +import hashlib import torch from ComfyUI_H3_Continuum_Join.constants import CONTINUUM_INTEROP_KEY, DIAGNOSTICS_BASIC, PROMPT_MODE_FIXED, V2_CONTINUITY_OPTIONS from ComfyUI_H3_Continuum_Join.temporal import audio_latent_t, video_latent_t -from ComfyUI_H3_Continuum_Join.v2.h3_builder import IdentityAssets +from ComfyUI_H3_Continuum_Join.v2.h3_builder import IdentityAssets, _tensor_fingerprint from ComfyUI_H3_Continuum_Join.v2.prompts import make_prompt_plan from ComfyUI_H3_Continuum_Join.v2 import sequence @@ -17,6 +18,16 @@ class FakeClip: def tokenize(self,prompt,images): self.events.append(("tokenize",prompt,len(images))); return prompt def encode_from_tokens_scheduled(self,tokens): self.events.append(("encode",tokens)); return [[torch.zeros(1,1,2),{}]] + +def test_identity_fingerprint_hashes_full_resized_rgb_tensor(): + image = torch.zeros((1, 96, 64, 3), dtype=torch.float32) + image[0, 95, 63, 2] = 1.0 + digest = hashlib.sha256() + digest.update(str(tuple(image.shape)).encode("ascii")) + digest.update(str(image.dtype).encode("ascii")) + digest.update(image.contiguous().view(torch.uint8).numpy().tobytes(order="C")) + assert _tensor_fingerprint(image) == digest.hexdigest() + def test_v2_samples_every_chunk_before_any_decode(monkeypatch): events=[]; width,height=96,64 fake_model=SimpleNamespace(model=SimpleNamespace(diffusion_model=SimpleNamespace()),model_options={},wrappers={},model_dtype=lambda:torch.bfloat16,model_size=lambda:0) diff --git a/tests/test_v31_run_storage.py b/tests/test_v31_run_storage.py index b7517aa..a876bc6 100644 --- a/tests/test_v31_run_storage.py +++ b/tests/test_v31_run_storage.py @@ -5,17 +5,28 @@ import json from types import SimpleNamespace import torch +import pytest +import ctypes from ComfyUI_H3_Continuum_Join.run_storage import ( RunStorageController, _apply_nonce_contract, _fsync_file, + _pid_exists_windows, + automatic_project_key, build_sampling_contract, + resolve_run_storage_name, revision_identity, ) -from ComfyUI_H3_Continuum_Join.graph_contract import build_upstream_graph_contract +from ComfyUI_H3_Continuum_Join.graph_contract import ( + CHECKPOINT_FL2VA, + CHECKPOINT_REF2VA, + build_upstream_graph_contract, + classify_h3_checkpoint, +) from ComfyUI_H3_Continuum_Join.state import make_plan from ComfyUI_H3_Continuum_Join.v2.session import make_chunk_entry +from ComfyUI_H3_Continuum_Join.v3.nodes import _validate_regenerate_storage class _Nested: @@ -97,6 +108,7 @@ def test_three_chunks_are_committed_to_distinct_files(tmp_path): records = controller.manifest["chunks"] assert [record["sequence_index"] for record in records] == [0, 1, 2] assert [record["entry"]["sequence_index"] for record in records] == [0, 1, 2] + assert all(len(record["file_sha256"]) == 64 for record in records) assert [entry["sequence_index"] for entry in source_entries] == [0, 0, 0] persisted = json.loads(controller._manifest_path().read_text(encoding="utf-8")) @@ -137,6 +149,65 @@ def test_fsync_file_accepts_a_completed_file_on_windows(tmp_path): _fsync_file(target) +def test_chunk_sha256_rejects_same_size_corruption(tmp_path): + controller, _ = _controller(tmp_path) + controller.commit_chunk(_entry(0), position=0) + record = controller.manifest["chunks"][0] + target = controller.revision_root / "chunks" / record["filename"] + payload = bytearray(target.read_bytes()) + payload[-1] ^= 1 + target.write_bytes(payload) + with pytest.raises(Exception, match="SHA-256 mismatch"): + controller._load_entry(record, "same fixed prompt") + + +def test_automatic_storage_name_is_stable_for_sampler_node(): + first = resolve_run_storage_name( + project_id="", legacy_run_name="", automatic_key="242" + ) + second = resolve_run_storage_name( + project_id="", legacy_run_name="", automatic_key="242" + ) + assert first == second + assert first.startswith("run_auto_") + + +def test_windows_pid_probe_uses_open_process(monkeypatch): + class Function: + def __init__(self, result): + self.result = result + self.argtypes = None + self.restype = None + + def __call__(self, *args): + return self.result + + class Kernel32: + OpenProcess = Function(123) + CloseHandle = Function(True) + + monkeypatch.setattr(ctypes, "WinDLL", lambda *args, **kwargs: Kernel32(), raising=False) + monkeypatch.setattr(ctypes, "set_last_error", lambda value: None) + monkeypatch.setattr(ctypes, "get_last_error", lambda: 0) + assert _pid_exists_windows(12345) + + +def test_automatic_project_key_ignores_settings_but_tracks_topology(): + prompt = _prompt_graph() + first = automatic_project_key(prompt, "42") + prompt["10"]["inputs"]["unet_name"] = "different-model.safetensors" + assert automatic_project_key(prompt, "42") == first + prompt["42"]["inputs"]["model"] = ["10", 0] + assert automatic_project_key(prompt, "42") != first + + +def test_regenerate_from_requires_run_storage(): + _validate_regenerate_storage("Off", 0) + _validate_regenerate_storage("Save + Auto Resume", 2) + with pytest.raises(ValueError, match="requires Run Storage"): + _validate_regenerate_storage("Off", 2) + + def _sample_function(*args, **kwargs): return None @@ -206,6 +277,8 @@ def _sampling_contract( *, model=None, clip=None, video_vae=None, sampler=None, reroll_nonce=0, conditioning_mode="i2va", first_frame_hash="a" * 64, last_frame_hash="", reference_contract=None, + upstream_graph_contract=None, upstream_graph_safe=None, + upstream_graph_reasons=None, ): return build_sampling_contract( model=model or _Model(), @@ -232,6 +305,9 @@ def _sampling_contract( strict_compatibility=True, reference_contract=reference_contract, conditioning_mode=conditioning_mode, + upstream_graph_contract=upstream_graph_contract, + upstream_graph_safe=upstream_graph_safe, + upstream_graph_reasons=upstream_graph_reasons, ) @@ -420,6 +496,46 @@ def test_upstream_graph_fingerprint_tracks_loader_and_patch_order(): assert model_route["inputs"]["model"]["node"]["class_type"] == "PathchSageAttentionKJ" +def test_sampling_contract_combines_graph_and_runtime_weight_probe(): + graph, graph_safe, graph_reasons = build_upstream_graph_contract( + _prompt_graph(), "42", require_video_vae=True + ) + model = _Model() + first, safe, reasons = _sampling_contract( + model=model, + upstream_graph_contract=graph, + upstream_graph_safe=graph_safe, + upstream_graph_reasons=graph_reasons, + ) + assert safe, reasons + assert "runtime" in first["global"]["model"] + assert "graph_route" in first["global"]["model"] + with torch.no_grad(): + model.model.diffusion_model.weight.add_(1) + changed, safe, reasons = _sampling_contract( + model=model, + upstream_graph_contract=graph, + upstream_graph_safe=graph_safe, + upstream_graph_reasons=graph_reasons, + ) + assert safe, reasons + assert revision_identity(first) != revision_identity(changed) + + +def test_official_h3_sigma_shift_is_accepted_in_model_route(): + prompt = _prompt_graph() + prompt["13"] = { + "class_type": "MiniMaxH3SigmaShift", + "inputs": {"model": ["12", 0], "shift": 3.0}, + } + prompt["42"]["inputs"]["model"] = ["13", 0] + graph, safe, reasons = build_upstream_graph_contract( + prompt, "42", require_video_vae=True + ) + assert safe, reasons + assert graph["routes"]["model"]["node"]["class_type"] == "MiniMaxH3SigmaShift" + + def test_upstream_graph_fingerprint_accepts_runtime_turbo_and_sage_nodes(): prompt = _prompt_graph() prompt["11"] = { @@ -442,6 +558,14 @@ def test_upstream_graph_fingerprint_accepts_runtime_turbo_and_sage_nodes(): prompt, "42", require_video_vae=True ) assert safe, reasons + + +def test_checkpoint_classifier_uses_base_unet_filename(): + prompt = _prompt_graph() + prompt["10"]["inputs"]["unet_name"] = "minimax_h3_ref2va_pruned_int8.safetensors" + assert classify_h3_checkpoint(prompt, "42") == CHECKPOINT_REF2VA + prompt["10"]["inputs"]["unet_name"] = "minimax_h3_fl2va_pruned_int8.safetensors" + assert classify_h3_checkpoint(prompt, "42") == CHECKPOINT_FL2VA changed_prompt = copy.deepcopy(prompt) changed_prompt["12"]["inputs"]["lora_1"]["strength"] = 0.8 changed, changed_safe, changed_reasons = build_upstream_graph_contract( diff --git a/tests/test_v32_reference.py b/tests/test_v32_reference.py index 911b314..4bf5f63 100644 --- a/tests/test_v32_reference.py +++ b/tests/test_v32_reference.py @@ -7,8 +7,10 @@ from ComfyUI_H3_Continuum_Join.reference import ( REFERENCE_SIZE_MATCH_OUTPUT, ReferenceAssets, ReferenceConditioningError, + prepare_reference_assets, validate_reference_prompts, ) +from ComfyUI_H3_Continuum_Join.v3.nodes import _validate_reference_checkpoint def test_reference_size_is_appended_after_v31_widgets(): @@ -51,3 +53,46 @@ def test_picture_tags_must_match_connected_references(): def test_missing_picture_tag_is_a_warning_not_an_error(): warning = validate_reference_prompts(["The same person walks forward."], 1) assert "no tag" in warning + + +def test_reference_socket_rejects_image_batches(): + with pytest.raises(ReferenceConditioningError, match="batch size B=1"): + prepare_reference_assets( + reference_image_1=torch.zeros((2, 32, 32, 3)), + reference_image_2=None, + output_width=32, + output_height=32, + size_mode=REFERENCE_SIZE_MATCH_OUTPUT, + ) + + +def _reference_prompt(checkpoint_name: str) -> dict: + return { + "1": { + "class_type": "UNETLoader", + "inputs": {"unet_name": checkpoint_name}, + }, + "2": { + "class_type": "H3ContinuumSamplerProduction", + "inputs": {"model": ["1", 0]}, + }, + } + + +def test_strict_reference_requires_ref2va_checkpoint(): + assert _validate_reference_checkpoint( + _reference_prompt("minimax_h3_ref2va_pruned_int8.safetensors"), + "2", + strict_compatibility=True, + ) == "ref2va" + with pytest.raises(ValueError, match="FL2VA checkpoint"): + _validate_reference_checkpoint( + _reference_prompt("minimax_h3_fl2va_pruned_int8.safetensors"), + "2", + strict_compatibility=True, + ) + assert _validate_reference_checkpoint( + _reference_prompt("minimax_h3_fl2va_pruned_int8.safetensors"), + "2", + strict_compatibility=False, + ) == "fl2va" diff --git a/tools/verify_runtime.py b/tools/verify_runtime.py index ce302bb..0a7a048 100644 --- a/tools/verify_runtime.py +++ b/tools/verify_runtime.py @@ -76,6 +76,14 @@ def main() -> int: "H3ContinuumSaveSession", "H3ContinuumLoadSession", "H3ContinuumSessionInfo", + "H3ContinuumSampler", + "H3ContinuumClipOverrides", + "H3ContinuumAdvanced", + "H3ContinuumResult", + "H3ContinuumSamplerProduction", + "H3ContinuumSamplerV3", + "H3ContinuumAdvancedV3", + "H3ContinuumAssembleV3", } actual = set(module.NODE_CLASS_MAPPINGS) if actual != expected: @@ -83,7 +91,7 @@ def main() -> int: return 1 print(f"H3 Continuum Join {PACKAGE_VERSION} runtime verification passed.") print(layout_report) - print("V2 Fixed 3x5s prompt-plan self-test passed.") + print(f"V{PACKAGE_VERSION} Fixed 3x5s prompt-plan self-test passed.") print("Registered nodes:") for key in sorted(actual): print(f" - {module.NODE_DISPLAY_NAME_MAPPINGS[key]}") diff --git a/v2/h3_builder.py b/v2/h3_builder.py index 4ca6b49..52fbf10 100644 --- a/v2/h3_builder.py +++ b/v2/h3_builder.py @@ -38,13 +38,12 @@ class IdentityAssets: def _tensor_fingerprint(tensor: torch.Tensor | None) -> str: if tensor is None: return "none" - sample = tensor.detach().to("cpu", dtype=torch.float32).contiguous() - # Hash a deterministic downsampled view rather than several gigabytes of bytes. - if sample.ndim == 4: - sample = sample[:1].movedim(-1, 1) - sample = torch.nn.functional.interpolate(sample, size=(64, 64), mode="area") - raw = sample.numpy().tobytes(order="C") - return hashlib.sha256(raw).hexdigest() + sample = tensor.detach().to("cpu").contiguous() + digest = hashlib.sha256() + digest.update(str(tuple(int(value) for value in sample.shape)).encode("ascii")) + digest.update(str(sample.dtype).encode("ascii")) + digest.update(sample.view(torch.uint8).numpy().tobytes(order="C")) + return digest.hexdigest() def resize_h3_image(image: torch.Tensor, width: int, height: int, crop: str) -> torch.Tensor: diff --git a/v3/nodes.py b/v3/nodes.py index e83d6ba..e60d9b2 100644 --- a/v3/nodes.py +++ b/v3/nodes.py @@ -43,6 +43,36 @@ def _regenerate_from_value(value, *, chunks: int) -> int: return resolved +def _validate_regenerate_storage(run_storage: str, regenerate_from: int) -> None: + if str(run_storage) == "Off" and int(regenerate_from) > 0: + raise ValueError( + "Regenerate From requires Run Storage = Save + Auto Resume" + ) + + +def _validate_reference_checkpoint( + prompt, unique_id, *, strict_compatibility: bool +) -> str: + from ..graph_contract import ( + CHECKPOINT_FL2VA, + CHECKPOINT_REF2VA, + classify_h3_checkpoint, + ) + + classification = classify_h3_checkpoint(prompt, unique_id) + if strict_compatibility and classification != CHECKPOINT_REF2VA: + if classification == CHECKPOINT_FL2VA: + detail = "an FL2VA checkpoint is connected" + else: + detail = "the base checkpoint cannot be verified as Ref2VA" + raise ValueError( + "Reference Images require a verified MiniMax H3 Ref2VA MODEL when " + f"Strict Compatibility is enabled; {detail}. Disable Strict " + "Compatibility only for experimental FL2VA/unknown combinations." + ) + return classification + + class H3ContinuumAdvancedV3: DESCRIPTION = ( "Optional continuation, session, reroll, and diagnostics settings for V3." @@ -495,9 +525,9 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): "STRING", { "default": "", - "display_name": "Auto Resume ID (Automatic)", + "display_name": "Auto Resume ID Override", "advanced": True, - "tooltip": "Created automatically and saved with the workflow. It identifies which saved chunks can be resumed.", + "tooltip": "Optional. Leave blank to derive a stable ID from this sampler node. Run Name remains the explicit override.", }, ), }, @@ -566,6 +596,25 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): raise ValueError( "V3.2 Reference Images cannot be combined with First Frame or Last Frame" ) + reference_checkpoint = None + if reference_assets is not None: + reference_checkpoint = _validate_reference_checkpoint( + prompt, + unique_id, + strict_compatibility=bool(strict_compatibility), + ) + + def report_with_reference_status(report): + if reference_checkpoint is None: + return str(report) + if reference_checkpoint == "ref2va": + status = "Ref2VA verified." + else: + status = ( + f"{reference_checkpoint}; Experimental because Strict " + "Compatibility is disabled." + ) + return str(report) + "\nReference MODEL: " + status def execute(): return super(H3ContinuumSamplerProduction, self).run( @@ -598,26 +647,32 @@ class H3ContinuumSamplerProduction(H3ContinuumSamplerV3): ) if run_storage == "Off": + _validate_regenerate_storage(run_storage, regenerate_from) video_latents, audio_latents, assembly_plan, result = execute() return ( video_latents, audio_latents, assembly_plan, - str(result["report"]), + report_with_reference_status(result["report"]), ) if run_storage != "Save + Auto Resume": raise ValueError(f"unknown Run Storage mode: {run_storage!r}") - from ..run_storage import resolve_run_storage_name, run_storage_scope + from ..run_storage import ( + automatic_project_key, + resolve_run_storage_name, + run_storage_scope, + ) storage_name = resolve_run_storage_name( project_id=project_id, legacy_run_name=run_name, + automatic_key=automatic_project_key(prompt, unique_id), ) with run_storage_scope( storage_name, prompt=prompt, unique_id=unique_id ) as storage: video_latents, audio_latents, assembly_plan, result = execute() result = dict(result) - report = str(result["report"]) + "\n" + storage.summary( + report = report_with_reference_status(result["report"]) + "\n" + storage.summary( detailed=diagnostics == DIAGNOSTICS_OPTIONS[-1] ) result["report"] = report