1 Commits
Author SHA1 Message Date
rookiestar28 21590f70c5 build: prepare public source 2026-11-25 13:28:25 +00:00
35 changed files with 2069 additions and 162 deletions
+20 -18
View File
@@ -18,6 +18,22 @@ implementation.
<details>
<summary><strong>1.4.6 — Longer videos on ComfyUI 0.44 and later</strong></summary>
- Longer videos are no longer held on ComfyUI 0.44 and later. Version 1.4.5 did not recognize the
native MiniMax H3 source those versions ship, so it held longer-video generation in T2VA and in
the frame modes (I2VA, FL2VA and L2VA). This version recognizes it. ComfyUI versions that 1.4.5
already recognized are handled as before.
- A two-segment T2VA longer video was generated on ComfyUI 0.46.0 with frontend 1.59.11, using
a 4-step turbo LoRA.
- When the extension does not recognize the MiniMax H3 nodes of your ComfyUI, the message now says
so: update ComfyUI, and if it is already up to date, update this extension when a newer version
is available. A single clip in H3 App Mode still works.
</details>
<details>
<summary><strong>1.4.5 — Longer videos from frames, CJK titles and title styles</strong></summary>
- Longer videos can now be generated in I2VA, FL2VA and L2VA, as in T2VA, with cuts between
@@ -44,14 +60,6 @@ implementation.
it starts.
- New checkouts use LF line endings on every platform.
正體中文:已修正:在 App Mode 已準備好、或已含相容 H3 流程的畫布上,
「執行/匯出」步驟的「啟動 H3 App Mode」現在可正常啟動(1.4.1 及更早版本會再次詢問保留或取代畫布);
裁切圖片並準備畫布後,從側邊欄啟動也可正常執行(1.4.0 與 1.4.1 會停在錯誤)。
简体中文:已修复:在 App Mode 已准备好、或已含兼容 H3 流程的画布上,
“执行/导出”步骤的“启动 H3 App Mode”现在可正常启动(1.4.1 及更早版本会再次询问保留或替换画布);
裁剪图片并准备画布后,从侧边栏启动也可正常运行(1.4.0 与 1.4.1 会停在错误)。
</details>
<details>
@@ -320,8 +328,9 @@ message names it. The canvas nodes keep working even when the sidebar cannot loa
Linux support for them is coming in an upcoming update.
- The clip editor, image crop and App Mode have been tested on ComfyUI 0.42.0 with frontend 1.55.18
and with frontend 1.57.1. Longer videos in the frame modes, and starting on a crop-prepared
canvas, have been tested on ComfyUI 0.42.0 with frontend 1.57.1. These are tested combinations,
not minimum versions.
canvas, have been tested on ComfyUI 0.42.0 with frontend 1.57.1. A two-segment T2VA longer video
was generated on ComfyUI 0.46.0 with frontend 1.59.11, using a 4-step turbo LoRA. These
are tested combinations, not minimum versions.
- Longer-video generation checks the installed H3 implementation separately. If it reports an
incompatibility, use a complete, compatible ComfyUI installation; installing FFmpeg or waiting
does not fix it.
@@ -900,14 +909,6 @@ emoji and other uncovered characters are refused with an explanation. No system
CJK titles need 1.4.5 or later. Opening a saved CJK project in 1.4.0 or 1.4.1 keeps its text and
permits moving, trimming or deleting the title, but CJK editing and rendering are refused.
正體中文:標題內建正體中文、簡體中文、日文及韓文字型,支援一般與粗體;中日韓文字不支援斜體,
請關閉斜體後再套用。單一內建字型必須涵蓋整段文字,不支援的 emoji 仍會遭拒絕。
中日韓標題需要 1.4.5 或更新版本;1.4.0 與 1.4.1 可開啟儲存的中日韓專案,但會拒絕編輯與渲染這類標題。
简体中文:标题内置繁中、简中、日文及韩文字体,支持常规和粗体;中日韩文字不支持斜体,
请关闭斜体后再应用。单一内置字体必须覆盖整段文字,不支持的 emoji 仍会被拒绝。
中日韩标题需要 1.4.5 或更新版本;1.4.0 与 1.4.1 可打开保存的中日韩项目,但会拒绝编辑和渲染这类标题。
Rendered files are kept for about an hour, at most 16 at a time. Download the ones you want to keep.
### Keeping your work
@@ -1255,6 +1256,7 @@ Review workflows and screenshots before sharing them. More detail is in
| A sequence cannot be resumed after a reload | Cancel it and start again. |
| Readiness expired before generating | Choose **Check readiness** again. |
| Readiness says the host does not provide every native MiniMax H3 workflow | The loaded native H3 implementation is incomplete or not supported; use a complete, compatible ComfyUI installation. |
| Readiness says the MiniMax H3 nodes in this ComfyUI are a version this extension cannot use for longer videos | Update ComfyUI. If it is already up to date, update this extension when a newer version is available. A single clip in H3 App Mode still works. |
| A remote assisted-authoring profile does not run | Check the message, profile, permission, API key and your provider quota. |
When reporting a problem, include the node name, the diagnostic code and the profile or contract
+18 -18
View File
@@ -1,3 +1,21 @@
# Release 1.4.6
## Longer videos on ComfyUI 0.44 and later
- Longer videos are no longer held on ComfyUI 0.44 and later. Version 1.4.5 did not recognize the
native MiniMax H3 source those versions ship, so it held longer-video generation in T2VA and in
the frame modes (I2VA, FL2VA and L2VA). This version recognizes it. ComfyUI versions that 1.4.5
already recognized are handled as before.
- When the extension does not recognize the MiniMax H3 nodes of your ComfyUI, the message now says
so and what to do: update ComfyUI, and if it is already up to date, update this extension when a
newer version is available. A single clip in H3 App Mode still works. Before, the message said
only that the host did not provide every native workflow that sequence generation needs.
## Compatibility
- A two-segment T2VA longer video was generated on ComfyUI 0.46.0 with frontend 1.59.11, using
a 4-step turbo LoRA. This is a tested combination, not a minimum version.
# Release 1.4.5
## Longer videos in the frame modes
@@ -41,16 +59,6 @@
- A style sets the weight, fill colour, stroke, shadow, background and background padding, and
turns italic off. It keeps the text, font, size, alignment and line height.
正體中文:新增正體中文、簡體中文、日文及韓文標題的一般與粗體字型,預覽與渲染採用相同字型。
中日韓文字不支援斜體,請關閉斜體;emoji 等未涵蓋字元仍會遭拒絕。套件因內含字型而增大。
中日韓標題需要 1.4.5 或更新版本;1.4.0 與 1.4.1 可開啟專案,但拒絕中日韓標題的編輯與渲染。
新增八種「標題樣式」,可在素材區與檢視器的「文字」分頁中使用。
简体中文:新增繁中、简中、日文及韩文标题的常规和粗体字体,预览与渲染采用相同字体。
中日韩文字不支持斜体,请关闭斜体;emoji 等未覆盖字符仍会被拒绝。内置字体使安装包增大。
中日韩标题需要 1.4.5 或更新版本;1.4.0 与 1.4.1 可打开项目,但拒绝中日韩标题的编辑和渲染。
新增八种“标题样式”,可在素材区与检查器的“文字”标签页中使用。
## App Mode
- When App Mode prepares an I2VA canvas, it no longer leaves the template's resolution selector
@@ -66,14 +74,6 @@
from the sidebar works. In 1.4.0 and 1.4.1 the sidebar stopped with an error and nothing was
queued. ComfyUI's own Run on the same canvas was not affected.
正體中文:已修正:在 App Mode 已準備好、或已含相容 H3 流程的畫布上,「執行/匯出」步驟的
「啟動 H3 App Mode」現在可正常啟動;1.4.1 及更早版本會再次詢問保留或取代畫布,且不會加入佇列。
裁切圖片並準備畫布後,從側邊欄啟動也可正常執行;1.4.0 與 1.4.1 會停在錯誤,且不會加入佇列。
简体中文:已修复:在 App Mode 已准备好、或已含兼容 H3 流程的画布上,“执行/导出”步骤的
“启动 H3 App Mode”现在可正常启动;1.4.1 及更早版本会再次询问保留或替换画布,且不会加入队列。
裁剪图片并准备画布后,从侧边栏启动也可正常运行;1.4.0 与 1.4.1 会停在错误,且不会加入队列。
## Windows storage
- Rendering and segment storage handle long Windows paths consistently when staging, publishing
+1 -1
View File
@@ -137,7 +137,7 @@ if os.environ.get("H3_CONTEXT_HOST_SEQUENCE_CONTINUATION_CANARY") == "1":
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **CANARY_NODES}
NODE_DISPLAY_NAME_MAPPINGS = {**NODE_DISPLAY_NAME_MAPPINGS, **CANARY_DISPLAY_NAMES}
__version__ = "1.4.5"
__version__ = "1.4.6"
WEB_DIRECTORY = "web"
# CRITICAL: this bounded operator attempt runs after node registration. Its module owner survives
@@ -39,6 +39,14 @@ QUALIFICATION_TTL_SECONDS = 60
_MAX_ISSUED_SOURCES = 8
_LOGGER = logging.getLogger(__name__)
_NOT_ISSUED = object()
#: The composition reasons that say the loaded native source was read and no audited lineage admits
#: it. They are the only holds that get the distinct public reason below.
_UNRECOGNIZED_SOURCE_COMPOSITION_REASONS = frozenset(
{
"native_t2va_structure_changed",
"native_keyframe_structure_changed",
}
)
_COMPILER_SOURCES = (
"core/audit_override.py",
"core/canonical.py",
@@ -57,6 +65,7 @@ _COMPILER_SOURCES = (
"core/native_t2va_baseline.py",
"core/native_keyframe_structure.py",
"core/native_keyframe_baseline.py",
"core/native_baseline_v0_44.py",
"core/native_guide.py",
"core/native_h3.py",
"core/native_mode_matrix.py",
@@ -238,7 +247,19 @@ class ManagedQualificationProducer:
composition.reason,
composition.detail,
)
raise ProductionWorkbenchError("qualification_composition_unqualified", 409)
# CRITICAL: only a source that was read and matched no audited lineage gets
# native_source_structure_unrecognized, whose advice is to update ComfyUI
# first and this extension second. A missing native workflow, an
# unreadable source or a held audio set keeps the generic reason, because
# that advice would send those users to the wrong fix.
raise ProductionWorkbenchError(
(
"native_source_structure_unrecognized"
if composition.reason in _UNRECOGNIZED_SOURCE_COMPOSITION_REASONS
else "qualification_composition_unqualified"
),
409,
)
if composition.observed_source() != source:
raise ProductionWorkbenchError("qualification_changed", 409)
admission = composition.detail
@@ -5,30 +5,30 @@
},
"bundle": {
"path": "comfyui_h3_context/web/h3-context-sidebar.js",
"sha256": "sha256:eb9a7de0179525f6d5fbe2229f5135d4c365b6da2898a3fb6ea8557cda655460",
"size": 3932886
"sha256": "sha256:3ceff7b6ed79f4300945eae369f4f4d70026bb2682e550566e714f0de81e91c3",
"size": 3933669
},
"embedded_identity": {
"builder_id": "scripts/frontend_build_report.py",
"resolved_dependencies_sha256": "sha256:25a1b962dc98cf60b699a496376a10be8f32bed85e6dc40fa0649d831b9d7ac3",
"resolved_dependencies_sha256": "sha256:9e0a1e1bdf3d99b7b633ea4ced569a3a6311751163e267ff10d217d7bbdddb24",
"schema": "h3-context-build-identity/1",
"source_commit": "179f39386ca47ce955c1eefc1fc5cd812577999e",
"source_inputs_sha256": "sha256:a033ec2864b96915a8cfc551ed46e12453c04f4521e185070f41caca2fa06979",
"source_tree": "83b40facdf48c390164d37c5abed0fceee3d56ad"
"source_commit": "144d97eb138f3d3dc4c31313540616c455ee5690",
"source_inputs_sha256": "sha256:6efc5b1374102b76156c81997b3a75a4de3e0137e3580666195ea9b4a75b24d1",
"source_tree": "16623b1544bbe4186d85a067573d33e569389883"
},
"external_parameters": {
"source_commit": "179f39386ca47ce955c1eefc1fc5cd812577999e",
"source_inputs_sha256": "sha256:a033ec2864b96915a8cfc551ed46e12453c04f4521e185070f41caca2fa06979",
"source_tree": "83b40facdf48c390164d37c5abed0fceee3d56ad"
"source_commit": "144d97eb138f3d3dc4c31313540616c455ee5690",
"source_inputs_sha256": "sha256:6efc5b1374102b76156c81997b3a75a4de3e0137e3580666195ea9b4a75b24d1",
"source_tree": "16623b1544bbe4186d85a067573d33e569389883"
},
"invocation": {
"finished_on": "2026-11-12T07:50:25Z",
"id": "sha256:f6914f083b85791814674f4094d618658ff7b4755843bcbc5165906faa1a957f",
"started_on": "2026-11-12T07:50:25Z"
"finished_on": "2026-11-24T21:39:14Z",
"id": "sha256:e5deeb4cec56490f5a5fd49450057ffe2951a32c9d317bba7ad6bb927a35c33b",
"started_on": "2026-11-24T21:39:14Z"
},
"resolved_dependencies": [
{
"digest": "sha256:0e02cfafa7a0a5034b71459c98256975e8baee48b87ce1d3562c479d00fca7fd",
"digest": "sha256:5fe7528ba4fafe64153bafd4f145ff39a8d2663e0e953dfb2fe19dd122904d1b",
"uri": "contract:h3-context-contract-inventory/1"
},
{
@@ -702,6 +702,7 @@
"frontend/src/lifecycle/nleWorkspaceSession.ts",
"frontend/src/state/nleWorkspaceState.ts",
"frontend/tests/managedQualification.test.ts",
"frontend/tests/nativeSourceCopy.test.ts",
"frontend/tests/nleSequencePanelControls.test.tsx",
"frontend/tests/plainProductCopy.test.tsx",
"governance/contracts/supply_chain_v1.json"
@@ -1398,6 +1399,7 @@
"comfyui_h3_context/adapters/comfyui_generation_profile.py",
"comfyui_h3_context/core/compatibility.py",
"comfyui_h3_context/core/generation_profile.py",
"comfyui_h3_context/core/native_baseline_v0_44.py",
"comfyui_h3_context/core/native_keyframe_baseline.py",
"comfyui_h3_context/core/native_t2va_baseline.py",
"comfyui_h3_context/core/native_t2va_structure.py",
@@ -15884,6 +15886,6 @@
"reachability_source": "none"
}
],
"fingerprint": "sha256:0e02cfafa7a0a5034b71459c98256975e8baee48b87ce1d3562c479d00fca7fd",
"fingerprint": "sha256:5fe7528ba4fafe64153bafd4f145ff39a8d2663e0e953dfb2fe19dd122904d1b",
"schema": "h3-context-contract-inventory/1"
}
@@ -1 +1 @@
{"profiles":[{"compatibility":["python>=3.10"],"distribution":"minimax-h3-studio==1.4.5","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"artifact","model_management":"none","owner":"package","profile_id":"core_manual","removal":"remove_package_owned_files","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"package"},{"compatibility":["comfyui-native-node-capabilities-v1","comfyui-frontend-extension-api-v1"],"distribution":"host-provided","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"host_reuse","model_management":"host_only","owner":"host","profile_id":"comfyui_native","removal":"leave_host_runtime_unchanged","required":true,"rollback":"restore_previous_verified_node_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"host"},{"compatibility":["h3-context-ollama-qualification/1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_ollama","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_openai_compatible_loopback","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_openai_compatible_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["anthropic-models-and-messages-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_anthropic_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["comfyui-frontend-extension-api-v1"],"distribution":"bundled-with-minimax-h3-studio","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"bundled_asset","model_management":"none","owner":"package","profile_id":"frontend_extension","removal":"remove_package_owned_bundle","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context/web/h3-context-sidebar.js"],"storage_owner":"package"}],"schema":"h3-context-installation-profiles/1","version":1}
{"profiles":[{"compatibility":["python>=3.10"],"distribution":"minimax-h3-studio==1.4.6","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"artifact","model_management":"none","owner":"package","profile_id":"core_manual","removal":"remove_package_owned_files","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"package"},{"compatibility":["comfyui-native-node-capabilities-v1","comfyui-frontend-extension-api-v1"],"distribution":"host-provided","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"host_reuse","model_management":"host_only","owner":"host","profile_id":"comfyui_native","removal":"leave_host_runtime_unchanged","required":true,"rollback":"restore_previous_verified_node_artifact","runtime_entries":["comfyui_h3_context"],"storage_owner":"host"},{"compatibility":["h3-context-ollama-qualification/1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_ollama","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"external-user-managed","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"external_runtime","model_management":"external_only","owner":"user","profile_id":"external_openai_compatible_loopback","removal":"leave_external_runtime_unchanged","required":false,"rollback":"user_managed_external_rollback","runtime_entries":[],"storage_owner":"user"},{"compatibility":["openai-compatible-model-list-and-chat-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_openai_compatible_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["anthropic-models-and-messages-v1"],"distribution":"third-party-service","download_policy":"forbidden","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"remote_service","model_management":"provider_managed","owner":"provider","profile_id":"remote_anthropic_service","removal":"leave_remote_service_unchanged","required":false,"rollback":"revoke_session_consent_and_clear_selection","runtime_entries":[],"storage_owner":"provider"},{"compatibility":["comfyui-frontend-extension-api-v1"],"distribution":"bundled-with-minimax-h3-studio","download_policy":"artifact_only","end_user_node_lifecycle":"forbidden","fallback":"none","install_mode":"bundled_asset","model_management":"none","owner":"package","profile_id":"frontend_extension","removal":"remove_package_owned_bundle","required":true,"rollback":"reinstall_previous_verified_artifact","runtime_entries":["comfyui_h3_context/web/h3-context-sidebar.js"],"storage_owner":"package"}],"schema":"h3-context-installation-profiles/1","version":1}
@@ -116,7 +116,7 @@ def build_default_installation_profiles() -> InstallationProfileManifest:
profile_id="core_manual",
owner="package",
# IMPORTANT: match package and manifest versions; strict decoding rejects drift.
distribution="minimax-h3-studio==1.4.5",
distribution="minimax-h3-studio==1.4.6",
compatibility=("python>=3.10",),
required=True,
install_mode="artifact",
@@ -0,0 +1,348 @@
"""Audited native structural baselines of one source shape: digests, never source text.
Shape ``split-latent``: the audited rows of the committed first lineage, with the empty-latent
helper split into ``_av_latent`` plus its wrapper. Each table is derived from the native
source at the revision it names; provenance identifies that audited input and is never
compared with a loaded source. Generated by ``scripts/native_t2va_structure.py
--host-root <root> --revision 2c75dc1b --shape split-latent --emit-lineage``.
Regenerate only for a newly audited shape; these tables are part of managed qualification
compiler identity.
"""
from typing import TypedDict
class _ManifestData(TypedDict):
source_revision: str
source_blob: str
definitions: tuple[tuple[str, str], ...]
constants: tuple[tuple[str, str], ...]
package_roots: tuple[str, ...]
required_imports: tuple[str, ...]
from_bindings: tuple[tuple[str, str], ...]
envelope_bindings: tuple[tuple[str, str], ...]
protected_builtins: tuple[str, ...]
external_paths: tuple[str, ...]
T2VA_DATA: _ManifestData = {
"source_revision": "2c75dc1b379a59e0880619d029607af5169a62ef", # pragma: allowlist secret
"source_blob": "b0abbc717ba6af7da5169f44467f44364468cda9", # pragma: allowlist secret
"definitions": (
(
"align_frame_count",
"sha256:815144140ac0f0c20a42a56f1168ca3086485456a52b4cb552b1d84c362c5cd3",
),
(
"video_latent_t",
"sha256:ddbe78607984329c205ec059fbad8114c5055e2a639c64cb7aceeb685316b0af",
),
(
"temporal_shape",
"sha256:5632544f143ed19e2cda997c2493292317d42bd117c572a4cb0bdf0e1c60b86f",
),
(
"_av_latent",
"sha256:69cca94829c012d7bc5985d7da95a41dda0764e2c307ebe5beda0d422c3554b0",
),
(
"_empty_av_latent",
"sha256:6e32805a47da3743c4e10aaeb91de9cd52b7564a328f10765f46fc598e5b9488",
),
(
"EmptyMiniMaxH3LatentAV",
"sha256:86eada1c51a9b09e633bb3404517041df858963f8873a914b042883f0005d717",
),
(
"MiniMaxH3SigmaShift",
"sha256:6cb500867f47b7a0c6498d5cf564663d079ce1ac60bde13ab3a23b947248cbc6",
),
(
"MiniMaxH3ImageToVideo.define_schema",
"sha256:48dbcd4e98c2b9afa141e3087700d870a385f9d901591489efe0b364abbb2857",
),
(
"MiniMaxH3ImageToVideo.execute",
"sha256:d7477fcff0fe777655379476c4d1ff93b92caa5ba181adf7d72fad102241490c",
),
(
"MiniMaxH3ImageToVideo",
"sha256:2e4cc7007bbbcc5727c4e0926955e61905cd8b4a0baab005eab2cde44e930c68",
),
),
"constants": (
(
"CANVAS_MULTIPLE",
"sha256:4bbc40eb232c133e8bfac3e9ad8c165931f54112e6a4d551c7f95e085ab55b32",
),
(
"BASE_SHORT_EDGE",
"sha256:383289f43aec04145db7c86df39ccb6565aaf082853fb99f94e3429cd7684556",
),
(
"MAX_PIXELS",
"sha256:ff31347e6d92b88b7149ba78d54671ce195da18493b701b5900584aab950956c",
),
(
"REF_IMAGE_SHORT_EDGE",
"sha256:a60810bf232af0fd71e3fb9a7bba6bdec75c7beb956760663bbb41bf3102ed10",
),
(
"FPS",
"sha256:27b17d774039c50a8b7aef6aaf060822b36c06f89a6b813fce2ada32caaaf0a9",
),
(
"AUDIO_LATENT_FPS",
"sha256:ddd3a27d187f8af6911bdaab2b520ec49bae831f1c30d48f923cc0440d2dff98",
),
(
"PH3_IMAGE_SIZE",
"sha256:b9a23ae99cb5d5d7b12c4c2ce9047683530e179a4f0d69025608d05895ed1608",
),
(
"PH3_IMAGE_VISION_PIXELS",
"sha256:e23b56dcf0280018008026196a2ff610b155e0d2a2e93906418e0de409c62021",
),
(
"PH3_IMAGE_EDIT",
"sha256:66b86d5e7389d5979e8f95f62a7f3c0f91832350e668127124dab3aa4a68f649",
),
),
"package_roots": (
"comfy",
"nodes",
"torch",
),
"required_imports": (
"comfy.model_management",
"comfy.model_sampling",
"comfy.nested_tensor",
"nodes",
"torch",
),
"from_bindings": (
(
"io",
"comfy_api.latest",
),
),
"envelope_bindings": (
(
"ComfyExtension",
"comfy_api.latest",
),
),
"protected_builtins": (
"classmethod",
"hasattr",
"max",
"round",
"staticmethod",
),
"external_paths": (
"comfy.model_management.intermediate_device",
"comfy.model_sampling.CONST",
"comfy.model_sampling.ModelSamplingAV",
"comfy.nested_tensor.NestedTensor",
"io.Clip.Input",
"io.ComfyNode",
"io.Conditioning.Output",
"io.Float.Input",
"io.Image.Input",
"io.Int.Input",
"io.Latent.Output",
"io.Model.Input",
"io.Model.Output",
"io.NodeOutput",
"io.Schema",
"io.String.Input",
"io.Vae.Input",
"nodes.MAX_RESOLUTION",
"torch.zeros",
),
}
KEYFRAME_DATA: _ManifestData = {
"source_revision": "2c75dc1b379a59e0880619d029607af5169a62ef", # pragma: allowlist secret
"source_blob": "b0abbc717ba6af7da5169f44467f44364468cda9", # pragma: allowlist secret
"definitions": (
(
"align_frame_count",
"sha256:815144140ac0f0c20a42a56f1168ca3086485456a52b4cb552b1d84c362c5cd3",
),
(
"video_latent_t",
"sha256:ddbe78607984329c205ec059fbad8114c5055e2a639c64cb7aceeb685316b0af",
),
(
"temporal_shape",
"sha256:5632544f143ed19e2cda997c2493292317d42bd117c572a4cb0bdf0e1c60b86f",
),
(
"_resize",
"sha256:96f2913538594100cb93e5b1c7bcb0d9b7c3fc9e9c174797c1a40410a4e3eb2f",
),
(
"_encode_ref_audio",
"sha256:b26132500b2e30d77567c5a5f39faf3beadbeadcf3e43c6235c8b467c6bdbed0",
),
(
"_av_latent",
"sha256:69cca94829c012d7bc5985d7da95a41dda0764e2c307ebe5beda0d422c3554b0",
),
(
"_empty_av_latent",
"sha256:6e32805a47da3743c4e10aaeb91de9cd52b7564a328f10765f46fc598e5b9488",
),
(
"EmptyMiniMaxH3LatentAV",
"sha256:86eada1c51a9b09e633bb3404517041df858963f8873a914b042883f0005d717",
),
(
"MiniMaxH3SigmaShift",
"sha256:6cb500867f47b7a0c6498d5cf564663d079ce1ac60bde13ab3a23b947248cbc6",
),
(
"MiniMaxH3ImageToVideo.define_schema",
"sha256:48dbcd4e98c2b9afa141e3087700d870a385f9d901591489efe0b364abbb2857",
),
(
"MiniMaxH3ImageToVideo.execute",
"sha256:6f3fd4575f704aec42ae1af1caf9391804aa1918d58ef13e0fe84a08564cb893",
),
(
"MiniMaxH3ImageToVideo",
"sha256:1fbe4e8c7fcb3c103ad1b24933b2b0759f7bfdb50df741013a409895db2ac33f",
),
(
"MiniMaxH3AddGuide.define_schema",
"sha256:9102fff0ecaea9c0d18683db8736825644d44ec432af0f750b5c27afd62abace",
),
(
"MiniMaxH3AddGuide.execute",
"sha256:36eaca7843593620bddc95b837c097ae835ce2be8ed83ea9b80bd8f409c91485",
),
(
"MiniMaxH3AddGuide",
"sha256:09c402c1a3f08725eae7ac983b15a4483c1a76fcb356987ee704d29f1303c64b",
),
),
"constants": (
(
"CANVAS_MULTIPLE",
"sha256:4bbc40eb232c133e8bfac3e9ad8c165931f54112e6a4d551c7f95e085ab55b32",
),
(
"BASE_SHORT_EDGE",
"sha256:383289f43aec04145db7c86df39ccb6565aaf082853fb99f94e3429cd7684556",
),
(
"MAX_PIXELS",
"sha256:ff31347e6d92b88b7149ba78d54671ce195da18493b701b5900584aab950956c",
),
(
"REF_IMAGE_SHORT_EDGE",
"sha256:a60810bf232af0fd71e3fb9a7bba6bdec75c7beb956760663bbb41bf3102ed10",
),
(
"FPS",
"sha256:27b17d774039c50a8b7aef6aaf060822b36c06f89a6b813fce2ada32caaaf0a9",
),
(
"AUDIO_LATENT_FPS",
"sha256:ddd3a27d187f8af6911bdaab2b520ec49bae831f1c30d48f923cc0440d2dff98",
),
(
"PH3_IMAGE_SIZE",
"sha256:b9a23ae99cb5d5d7b12c4c2ce9047683530e179a4f0d69025608d05895ed1608",
),
(
"PH3_IMAGE_VISION_PIXELS",
"sha256:e23b56dcf0280018008026196a2ff610b155e0d2a2e93906418e0de409c62021",
),
(
"PH3_IMAGE_EDIT",
"sha256:66b86d5e7389d5979e8f95f62a7f3c0f91832350e668127124dab3aa4a68f649",
),
),
"package_roots": (
"comfy",
"math",
"node_helpers",
"nodes",
"torch",
),
"required_imports": (
"comfy.audio",
"comfy.model_management",
"comfy.model_sampling",
"comfy.nested_tensor",
"comfy.utils",
"math",
"node_helpers",
"nodes",
"torch",
),
"from_bindings": (
(
"FRAME_PER_TOKEN",
"comfy.ldm.minimax.model",
),
(
"FRAME_RESCALE",
"comfy.ldm.minimax.model",
),
(
"io",
"comfy_api.latest",
),
),
"envelope_bindings": (
(
"ComfyExtension",
"comfy_api.latest",
),
),
"protected_builtins": (
"ValueError",
"classmethod",
"getattr",
"hasattr",
"len",
"list",
"max",
"range",
"round",
"staticmethod",
"sum",
),
"external_paths": (
"comfy.audio.resample",
"comfy.model_management.intermediate_device",
"comfy.model_sampling.CONST",
"comfy.model_sampling.ModelSamplingAV",
"comfy.nested_tensor.NestedTensor",
"comfy.utils.common_upscale",
"io.Audio.Input",
"io.Clip.Input",
"io.ComfyNode",
"io.Conditioning.Input",
"io.Conditioning.Output",
"io.Float.Input",
"io.Image.Input",
"io.Int.Input",
"io.Latent.Input",
"io.Latent.Output",
"io.Model.Input",
"io.Model.Output",
"io.NodeOutput",
"io.Schema",
"io.String.Input",
"io.Vae.Input",
"math.floor",
"node_helpers.conditioning_set_values",
"nodes.MAX_RESOLUTION",
"torch.zeros",
),
}
@@ -10,6 +10,7 @@ from __future__ import annotations
from dataclasses import asdict, dataclass
from enum import Enum
from . import native_baseline_v0_44 as lineage_v0_44
from . import native_t2va_structure as structure
from .native_keyframe_baseline import MANIFEST_DATA
@@ -36,6 +37,16 @@ class NativeKeyframeBaselineManifest(structure.NativeT2VABaselineManifest):
PRODUCTION_MANIFEST = NativeKeyframeBaselineManifest(**MANIFEST_DATA)
# The audited production lineages, oldest first. The first is the original baseline and never
# changes; a lineage is added only by deriving it from audited upstream bytes. Admission is
# membership of a verdict's manifest fingerprint in this closed set, never a caller's table.
PRODUCTION_LINEAGES: tuple[NativeKeyframeBaselineManifest, ...] = (
PRODUCTION_MANIFEST,
NativeKeyframeBaselineManifest(**lineage_v0_44.KEYFRAME_DATA),
)
PRODUCTION_FINGERPRINTS: frozenset[str] = frozenset(
item.fingerprint for item in PRODUCTION_LINEAGES
)
@dataclass(frozen=True, slots=True)
@@ -87,15 +98,16 @@ def _classify(
def classify_native_keyframe_source(content: bytes) -> NativeKeyframeStructureVerdict:
return _classify(content, PRODUCTION_MANIFEST)
return structure.classify_lineages(content, PRODUCTION_LINEAGES, _classify)
def is_production_admission(value: object) -> bool:
# CRITICAL: membership in the closed fingerprint set is the whole test; see the T2VA scope.
return (
type(value) is NativeKeyframeStructureVerdict
and value.admitted
and value.classifier_schema == NATIVE_KEYFRAME_CLASSIFIER_SCHEMA
and value.manifest_fingerprint == PRODUCTION_MANIFEST.fingerprint
and value.manifest_fingerprint in PRODUCTION_FINGERPRINTS
)
@@ -20,10 +20,12 @@ import io
import json
import symtable
import tokenize
from collections.abc import Iterator, Sequence
from collections.abc import Callable, Iterator, Sequence
from dataclasses import dataclass
from enum import Enum
from typing import Protocol, TypeVar
from . import native_baseline_v0_44 as lineage_v0_44
from . import native_t2va_baseline as baseline
NATIVE_T2VA_CLASSIFIER_SCHEMA = "h3.native_t2va_structure.v1"
@@ -48,6 +50,11 @@ _ENVELOPE_DECORATORS = frozenset({"classmethod", "staticmethod"})
_CLASS_CREATION_HOOKS = frozenset(
{"__init_subclass__", "__set_name__", "__class_getitem__", "__mro_entries__", "__prepare__"}
)
# The one module-level call form the envelope admits besides literals, as (module, attribute)
# pairs, and only while that module is bound by its own plain `import`. Closed on purpose: a pair
# joins this tuple only together with refusal rows for its arguments and a mutation receipt, never
# to make one more host source pass. Anything else called at module level stays `envelope_assign`.
_CLOSED_CALLS = (("re", "compile"),)
_COMFY_NODE_BASE = ("io", "ComfyNode")
_EXTENSION_BASE = "ComfyExtension"
_LITERAL_BINARY_OPERATORS = (
@@ -178,6 +185,21 @@ def _json_bytes(value: object) -> bytes:
return json.dumps(value, ensure_ascii=True, separators=(",", ":")).encode("ascii")
# The audited production lineages, oldest first: one per audited shape of the native source. The
# first lineage is the original baseline and never changes, so every fingerprint minted against it
# stays valid. A lineage is added only by deriving it from audited upstream bytes, never from a
# caller-supplied table or an observed source. (Defined here, not beside the manifest: a
# fingerprint needs `_json_bytes`.) The second is the shape whose empty-latent helper is split in
# two, derived with `scripts/native_t2va_structure.py --shape split-latent --emit-lineage`.
PRODUCTION_LINEAGES: tuple[NativeT2VABaselineManifest, ...] = (
PRODUCTION_MANIFEST,
NativeT2VABaselineManifest(**lineage_v0_44.T2VA_DATA),
)
PRODUCTION_FINGERPRINTS: frozenset[str] = frozenset(
item.fingerprint for item in PRODUCTION_LINEAGES
)
# --- parsing and bounds -------------------------------------------------------------------------
@@ -287,6 +309,56 @@ def _is_literal(node: ast.AST) -> bool:
return False
def _is_regex_flags(node: ast.AST, module: str) -> bool:
# An int literal (never a bool) or uppercase attributes of the bound module joined with `|`.
if isinstance(node, ast.Constant):
return type(node.value) is int
if isinstance(node, ast.BinOp):
return (
isinstance(node.op, ast.BitOr)
and _is_regex_flags(node.left, module)
and _is_regex_flags(node.right, module)
)
return (
isinstance(node, ast.Attribute)
and isinstance(node.value, ast.Name)
and node.value.id == module
and node.attr.isascii()
and node.attr.isidentifier()
and node.attr.isupper()
)
def _is_closed_call(node: ast.AST, plain_imports: frozenset[str]) -> bool:
"""A pinned module-level call: `re.compile(<str literal>[, <flags>])`, nothing else.
CRITICAL: this is the only call the definition-time envelope admits, because every other call
could run host code or rebind a protected name when the module loads. Keep each guard: the pair
must be in the closed tuple, the module must be bound by a plain `import` (an alias, a dotted
import or `from re import compile` would let the name mean something else), the call takes
positional arguments only, the pattern is a plain `str` literal (a name, a call, an f-string,
bytes or a concatenation can run code), and the flags are the pinned shape above. Admitting any
other `re` attribute, a keyword, or a wider expression reopens the module-level effect hole.
"""
if not (
isinstance(node, ast.Call)
and isinstance(node.func, ast.Attribute)
and isinstance(node.func.value, ast.Name)
):
return False
module = node.func.value.id
if (module, node.func.attr) not in _CLOSED_CALLS or module not in plain_imports:
return False
if node.keywords or not 1 <= len(node.args) <= 2:
return False
pattern, *flags = node.args
return (
isinstance(pattern, ast.Constant)
and type(pattern.value) is str
and all(_is_regex_flags(item, module) for item in flags)
)
def _is_reference(node: ast.AST) -> bool:
# A non-call annotation: a string, a name or a dotted attribute chain rooted at a name.
if isinstance(node, ast.Constant):
@@ -430,7 +502,13 @@ def _check_envelope(tree: ast.Module, manifest: NativeT2VABaselineManifest) -> _
if len(statement.targets) != 1 or not isinstance(statement.targets[0], ast.Name):
raise _changed("envelope_assign")
name = statement.targets[0].id
if not _is_literal(statement.value):
# `envelope.imports` holds exactly the names a plain `import` has bound so far, and
# `bind` refuses any later rebinding of them, so the closed form cannot be redirected
# by a statement that follows it (a rebinding before it is refused the same way).
if not (
_is_literal(statement.value)
or _is_closed_call(statement.value, frozenset(envelope.imports))
):
raise _changed("envelope_assign")
if name in protected and name not in constants:
raise _changed("binding:" + name)
@@ -621,18 +699,54 @@ def _classify(content: bytes, manifest: NativeT2VABaselineManifest) -> NativeT2V
return NativeT2VAStructureVerdict(StructureReason.ADMITTED, "admitted", manifest.fingerprint)
class _Admitting(Protocol):
@property
def admitted(self) -> bool: ...
_Manifest = TypeVar("_Manifest")
_Verdict = TypeVar("_Verdict", bound=_Admitting)
def classify_lineages(
content: bytes,
manifests: Sequence[_Manifest],
classify: Callable[[bytes, _Manifest], _Verdict],
) -> _Verdict:
"""Try the lineages in order and return the first admitted verdict.
When none admits, the verdict of the last (newest) lineage is returned: its refusal names the
check a source of the newest shape fails, which is the most useful one to report. Every
verdict carries the fingerprint of the manifest that produced it.
"""
verdict: _Verdict | None = None
for manifest in manifests:
verdict = classify(content, manifest)
if verdict.admitted:
return verdict
if verdict is None:
raise ValueError("no lineage to classify against")
return verdict
def classify_native_t2va_source(content: bytes) -> NativeT2VAStructureVerdict:
"""Classify loaded native bytes against the production baseline; no table is accepted."""
return _classify(content, PRODUCTION_MANIFEST)
"""Classify loaded native bytes against the production lineages; no table is accepted."""
return classify_lineages(content, PRODUCTION_LINEAGES, _classify)
def is_production_admission(verdict: object) -> bool:
"""True only for an admitted verdict produced against the current production manifest."""
"""True only for an admitted verdict produced against one of the production lineages.
CRITICAL: membership in the closed fingerprint set is the whole test. Never accept a caller's
manifest, table or fingerprint here, and never loosen it to a schema or reason check: a
synthetic manifest classifies sources too, and only this set separates its verdicts from
production authority.
"""
return (
type(verdict) is NativeT2VAStructureVerdict
and verdict.admitted
and verdict.classifier_schema == NATIVE_T2VA_CLASSIFIER_SCHEMA
and verdict.manifest_fingerprint == PRODUCTION_MANIFEST.fingerprint
and verdict.manifest_fingerprint in PRODUCTION_FINGERPRINTS
)
@@ -699,6 +813,22 @@ def derive_manifest(
if {name.split(".", 1)[0] for name in definitions} != {name for name, _node in surface}:
raise ValueError("a member row needs its top-level definition row")
referenced = _referenced_globals([node for _name, node in surface], imports)
plain_imports = frozenset(
alias.name
for node in imports
if isinstance(node, ast.Import)
for alias in node.names
if alias.asname is None
)
# An unread compiled regular expression is outside the audited surface: pinning it would turn
# an upstream edit of an unrelated pattern into a refusal of the whole lineage. A literal
# constant keeps its existing behavior (every literal is pinned, read or not).
constant_nodes = [
node
for node in constant_nodes
if not _is_closed_call(node.value, plain_imports)
or any(isinstance(target, ast.Name) and target.id in referenced for target in node.targets)
]
constant_names = {
target.id
for node in constant_nodes
@@ -769,10 +899,13 @@ __all__ = [
"MAX_AST_DEPTH",
"MAX_AST_NODES",
"MAX_SOURCE_BYTES",
"PRODUCTION_FINGERPRINTS",
"PRODUCTION_LINEAGES",
"PRODUCTION_MANIFEST",
"NativeT2VABaselineManifest",
"NativeT2VAStructureVerdict",
"StructureReason",
"classify_lineages",
"classify_native_t2va_source",
"definition_digest",
"derive_manifest",
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -198,7 +198,7 @@ Build a Python source distribution from a Git checkout whose reviewed public inp
```powershell
& .\.venv\Scripts\python.exe -m build --sdist
& .\.venv\Scripts\python.exe scripts/sdist_payload.py --archive dist/minimax_h3_studio-1.4.5.tar.gz
& .\.venv\Scripts\python.exe scripts/sdist_payload.py --archive dist/minimax_h3_studio-1.4.6.tar.gz
```
The standard build backend copies public tracked files into a fresh temporary tree and respects
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@comfyui-h3-context/frontend",
"version": "1.4.5",
"version": "1.4.6",
"private": true,
"type": "module",
"packageManager": "pnpm@11.3.0",
+6
View File
@@ -74,6 +74,8 @@ const en: Tables = {
"This ComfyUI host does not provide every native MiniMax H3 workflow that sequence generation needs.",
qualification_composition_unqualified:
"This ComfyUI host does not provide every native MiniMax H3 workflow that sequence generation needs.",
native_source_structure_unrecognized:
"The MiniMax H3 nodes in this ComfyUI are a version this extension cannot use for longer videos. Update ComfyUI; if it is already up to date, update this extension when a newer version is available. A single clip in H3 App Mode still works.",
qualification_compiler_unavailable:
"This extension's files could not be read. Reinstall the extension.",
qualification_host_bindings_unavailable:
@@ -444,6 +446,8 @@ const zhTW: Tables = {
"此 ComfyUI 主機未提供序列生成所需的全部原生 MiniMax H3 工作流程。",
qualification_composition_unqualified:
"此 ComfyUI 主機未提供序列生成所需的全部原生 MiniMax H3 工作流程。",
native_source_structure_unrecognized:
"此 ComfyUI 內的 MiniMax H3 節點版本無法用於此擴充功能的較長影片。請更新 ComfyUI;若已是最新版本,請在此擴充功能推出新版時更新。H3 App Mode 的單一片段仍可使用。",
qualification_compiler_unavailable:
"無法讀取此擴充功能的檔案,請重新安裝擴充功能。",
qualification_host_bindings_unavailable:
@@ -756,6 +760,8 @@ const zhCN: Tables = {
"此 ComfyUI 主机未提供序列生成所需的全部原生 MiniMax H3 工作流。",
qualification_composition_unqualified:
"此 ComfyUI 主机未提供序列生成所需的全部原生 MiniMax H3 工作流。",
native_source_structure_unrecognized:
"此 ComfyUI 内的 MiniMax H3 节点版本无法用于此扩展的较长视频。请更新 ComfyUI;若已是最新版本,请在此扩展推出新版时更新。H3 App Mode 的单个片段仍可使用。",
qualification_compiler_unavailable:
"无法读取此扩展的文件,请重新安装扩展。",
qualification_host_bindings_unavailable:
@@ -203,7 +203,10 @@ describe("candidate bundle environment", () => {
[CANDIDATE_BUNDLE_SHA256_ENV]: entry.sha256.replace(/^sha256:/, ""),
},
});
expect(candidate?.bytes).toEqual(bytes);
// IMPORTANT: compare the 3.9 MB bundle with one native `Buffer.equals`. `toEqual` walks a typed
// array element by element in JavaScript: it took 12 s of the 15 s limit on the 1.4.5 Hosted run and
// 16 s on the 1.4.6 one, so the test timed out although every byte was right.
expect(candidate?.bytes.equals(bytes)).toBe(true);
expect(candidate?.sha256).toBe(entry.sha256.replace(/^sha256:/, ""));
});
@@ -128,12 +128,18 @@ test("A61-1 negative: the same probe sees the snap guide, the one full-height li
await page.mouse.down();
await page.mouse.move(x + 130, y, { steps: 4 });
await expect(canvas).toHaveAttribute("data-h3-nle-snap-line", "present");
await expect
.poll(async () => (await fullHeightColumns(page)).columns.length)
.toBeGreaterThan(0);
const guide = (await fullHeightColumns(page)).columns;
// IMPORTANT: judge the guide on the same read that finds it. The decoration canvas is reset when its
// scene changes (a filmstrip or a waveform arriving) and painted again on the next animation frame,
// so a second read can land in that gap and see no column: `undefined - undefined` is NaN.
// One guide, one or two device pixels wide depending on its sub-pixel position.
expect(guide.at(-1)! - guide[0]!).toBeLessThanOrEqual(2);
await expect
.poll(async () => {
const { columns } = await fullHeightColumns(page);
return columns.length === 0
? Number.POSITIVE_INFINITY
: columns.at(-1)! - columns[0]!;
})
.toBeLessThanOrEqual(2);
await page.keyboard.press("Escape");
await page.mouse.up();
expect(transactions).toHaveLength(0);
+108
View File
@@ -0,0 +1,108 @@
import { describe, expect, it } from "vitest";
import {
PLAIN_REASON_TABLES,
plainReason,
} from "../src/components/plainReasons";
import { decodeManagedReadiness } from "../src/contracts/managedQualificationCodec";
// The closed reason the producer sends when the loaded native MiniMax H3 source was read and no
// audited lineage admits it. Its copy says the installed nodes are a version this extension
// cannot use for longer videos, and names no file, module or internal state.
//
// CRITICAL: the advice order is part of the contract. The same reason reaches two different users:
// one whose ComfyUI is older than the audited sources (nothing the extension ships can help, the
// host must be updated) and one whose ComfyUI is newer (only a later extension release helps).
// Telling both to wait for an extension update sent the first user to the wrong fix, so the copy
// must name a ComfyUI update first and the extension update second, in every locale.
const CODE = "native_source_structure_unrecognized";
const LOCALES = ["en", "zh-TW", "zh-CN"] as const;
const MESSAGES = {
en: [/longer videos/iu, /single clip/iu],
"zh-TW": [/較長影片/u, /單一片段/u],
"zh-CN": [/较长视频/u, /单个片段/u],
} as const;
const ADVICE_ORDER = {
en: /Update ComfyUI[\s\S]*update this extension/u,
"zh-TW": /請更新 ComfyUI[\s\S]*請在此擴充功能推出新版時更新/u,
"zh-CN": /请更新 ComfyUI[\s\S]*请在此扩展推出新版时更新/u,
} as const;
const INTERNAL =
/\.py|nodes_minimax|module|lineage|fingerprint|manifest|structure|blob|\bsha\b|hash|ast\b|baseline|registered|模組|模块|指紋|指纹|雜湊|哈希/iu;
function heldReadiness(reason: string) {
return decodeManagedReadiness({
schema: "h3.context.managed_readiness.v1",
request_id: "prepare.readiness",
status: "held",
reason,
qualification_fingerprint: null,
qualification: null,
});
}
describe("unrecognized native source copy", () => {
it.each(LOCALES)("reaches the user as plain copy in %s", (locale) => {
const readiness = heldReadiness(CODE);
expect(readiness.status).toBe("held");
expect(readiness.reason).toBe(CODE);
expect(
Object.hasOwn(PLAIN_REASON_TABLES[locale].readiness.codes, CODE),
).toBe(true);
const text = plainReason(locale, "readiness", readiness.reason);
expect(text).not.toBe(PLAIN_REASON_TABLES[locale].readiness.fallback);
expect(text).not.toContain(CODE);
expect(text).not.toMatch(INTERNAL);
for (const message of MESSAGES[locale]) expect(text).toMatch(message);
});
it.each(LOCALES)(
"advises a ComfyUI update before an extension update in %s",
(locale) => {
expect(plainReason(locale, "readiness", CODE)).toMatch(
ADVICE_ORDER[locale],
);
},
);
it.each(LOCALES)(
"never tells the user to wait for an extension update alone in %s",
(locale) => {
// The old copy said longer videos stay unavailable "until the extension is updated". That is
// wrong for a host older than the audited sources, so the extension update is conditional.
const text = plainReason(locale, "readiness", CODE);
expect(text).not.toMatch(
/until the extension is updated|在擴充功能更新前|在扩展更新前/u,
);
},
);
it.each(LOCALES)(
"is not the generic missing-workflow sentence in %s",
(locale) => {
expect(plainReason(locale, "readiness", CODE)).not.toBe(
plainReason(
locale,
"readiness",
"qualification_composition_unqualified",
),
);
},
);
it.each(LOCALES)(
"leaves every existing readiness sentence alone in %s",
(locale) => {
// The generic reasons keep their meaning: a missing native workflow is still reported as such.
for (const code of [
"qualification_host_unqualified",
"qualification_modes_incomplete",
"qualification_composition_unqualified",
])
expect(plainReason(locale, "readiness", code)).toMatch(
locale === "en"
? /does not provide every native MiniMax H3 workflow/u
: /MiniMax H3 工作流/u,
);
},
);
});
@@ -49,7 +49,7 @@
"path": "frontend/src/entry.tsx"
}
],
"fingerprint": "sha256:dfea2fd577e1ec3bf8c5717c77ec41b4fac21afb9a39770a6f59887f2a1fa5b7",
"fingerprint": "sha256:db96a5ef46c444845c5bbf9d43536c1e44d7da43a34d86570291eeb9c6d48394",
"known_violations": [],
"modules": [
{
@@ -2098,7 +2098,7 @@
"comfyui_h3_context/core/production_import.py"
],
"language": "python",
"lines": 342,
"lines": 363,
"path": "comfyui_h3_context/adapters/managed_mode_qualification.py",
"source_reachability": {
"class": "product",
@@ -5544,6 +5544,27 @@
"retained_reason": "reachable from a shipped entry point"
}
},
{
"imports": [],
"language": "python",
"lines": 348,
"path": "comfyui_h3_context/core/native_baseline_v0_44.py",
"source_reachability": {
"class": "product",
"evidence": "product_closure",
"owners": [
"comfyui_h3_context/__init__.py",
"comfyui_h3_context/adapters/assisted_draft_execution.py",
"comfyui_h3_context/adapters/authoring_derivative_generator.py",
"comfyui_h3_context/adapters/authoring_derivative_source.py",
"comfyui_h3_context/adapters/authoring_generated_source.py",
"comfyui_h3_context/adapters/authoring_image_source.py",
"comfyui_h3_context/adapters/authoring_native_renderer.py",
"comfyui_h3_context/adapters/authoring_output_preview.py"
],
"retained_reason": "reachable from a shipped entry point"
}
},
{
"imports": [
"comfyui_h3_context/core/canonical.py",
@@ -5654,11 +5675,12 @@
{
"imports": [
"comfyui_h3_context/core/__init__.py",
"comfyui_h3_context/core/native_baseline_v0_44.py",
"comfyui_h3_context/core/native_keyframe_baseline.py",
"comfyui_h3_context/core/native_t2va_structure.py"
],
"language": "python",
"lines": 113,
"lines": 125,
"path": "comfyui_h3_context/core/native_keyframe_structure.py",
"source_reachability": {
"class": "product",
@@ -5759,10 +5781,11 @@
{
"imports": [
"comfyui_h3_context/core/__init__.py",
"comfyui_h3_context/core/native_baseline_v0_44.py",
"comfyui_h3_context/core/native_t2va_baseline.py"
],
"language": "python",
"lines": 780,
"lines": 913,
"path": "comfyui_h3_context/core/native_t2va_structure.py",
"source_reachability": {
"class": "product",
@@ -11231,7 +11254,7 @@
"frontend/src/i18n/catalog.ts"
],
"language": "typescript",
"lines": 1052,
"lines": 1058,
"path": "frontend/src/components/plainReasons.ts",
"source_reachability": {
"class": "product",
@@ -1943,10 +1943,10 @@
],
"edge_kind_totals": {
"function_local": 114,
"module_level": 1799,
"module_level": 1801,
"type_checking": 128
},
"fingerprint": "sha256:85b1ddc6961f47068660f0251c896ed6c4299380db3018beaa1c18d36c76d782",
"fingerprint": "sha256:12da8e95627d37393d679d82d519292608eb7f0af573213010c8cb862add4194",
"forbidden_imports": [],
"layer_inversions": [],
"modules": [
@@ -2031,6 +2031,7 @@
"tests/test_media_lease_completion.py",
"tests/test_media_preview.py",
"tests/test_native_composition.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_source_admission_producer.py",
"tests/test_native_source_compatibility.py",
"tests/test_perception_settings.py",
@@ -3572,7 +3573,7 @@
"disposition": "movable",
"inbound": 1,
"layer": "adapters",
"lines": 342,
"lines": 363,
"module": "adapters.managed_mode_qualification",
"outbound": 15,
"owning_rules": [
@@ -3581,6 +3582,7 @@
],
"owning_tests": [
"tests/test_m26_04_qualification_producer.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_source_admission_producer.py"
],
"reasons": []
@@ -4540,6 +4542,8 @@
"tests/test_native_composition.py",
"tests/test_native_h3_adapter.py",
"tests/test_native_keyframe_structure.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_lineage_tables.py",
"tests/test_native_mode_matrix.py",
"tests/test_native_mode_qualification.py",
"tests/test_native_source_compatibility.py",
@@ -5631,6 +5635,7 @@
"tests/test_model_adapters.py",
"tests/test_native_behaviour_oracles.py",
"tests/test_native_h3_adapter.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_mode_matrix.py",
"tests/test_native_mode_qualification.py",
"tests/test_native_source_compatibility.py",
@@ -6733,6 +6738,21 @@
],
"reasons": []
},
{
"disposition": "movable",
"inbound": 2,
"layer": "core",
"lines": 348,
"module": "core.native_baseline_v0_44",
"outbound": 0,
"owning_rules": [
"submodule_as_name"
],
"owning_tests": [
"tests/test_native_lineage_tables.py"
],
"reasons": []
},
{
"disposition": "movable",
"inbound": 5,
@@ -6765,6 +6785,7 @@
"tests/test_frame_sequence_readiness_start.py",
"tests/test_m26_04_qualification_producer.py",
"tests/test_native_keyframe_structure.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_source_compatibility.py"
],
"reasons": []
@@ -6808,6 +6829,7 @@
"tests/test_native_composition.py",
"tests/test_native_composition_edges.py",
"tests/test_native_h3_adapter.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_mode_qualification.py",
"tests/test_native_source_compatibility.py",
"tests/test_product_shell.py",
@@ -6841,17 +6863,19 @@
"disposition": "movable",
"inbound": 3,
"layer": "core",
"lines": 113,
"lines": 125,
"module": "core.native_keyframe_structure",
"outbound": 2,
"outbound": 3,
"owning_rules": [
"direct_module",
"importlib_literal"
"importlib_literal",
"submodule_as_name"
],
"owning_tests": [
"tests/test_frame_sequence_readiness_start.py",
"tests/test_m26_04_qualification_producer.py",
"tests/test_native_keyframe_structure.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_source_compatibility.py"
],
"reasons": []
@@ -6888,36 +6912,41 @@
"tests/test_frame_sequence_readiness_start.py",
"tests/test_m26_04_qualification_producer.py",
"tests/test_native_composition_edges.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_source_compatibility.py"
],
"reasons": []
},
{
"disposition": "need_evidence",
"disposition": "movable",
"inbound": 1,
"layer": "core",
"lines": 126,
"module": "core.native_t2va_baseline",
"outbound": 0,
"owning_rules": [],
"owning_tests": [],
"reasons": [
"no test imports this module directly or through a hub symbol"
]
"owning_rules": [
"submodule_as_name"
],
"owning_tests": [
"tests/test_native_lineage_tables.py"
],
"reasons": []
},
{
"disposition": "movable",
"inbound": 4,
"layer": "core",
"lines": 780,
"lines": 913,
"module": "core.native_t2va_structure",
"outbound": 1,
"outbound": 2,
"owning_rules": [
"direct_module",
"submodule_as_name"
],
"owning_tests": [
"tests/test_native_keyframe_structure.py",
"tests/test_native_lineage_qualification.py",
"tests/test_native_lineage_tables.py",
"tests/test_native_source_compatibility.py",
"tests/test_native_t2va_structure.py"
],
File diff suppressed because one or more lines are too long
+10 -10
View File
@@ -27,7 +27,7 @@
},
{
"path": "comfyui_h3_context/contracts/build_provenance_v1.json",
"sha256": "sha256:070c203580b21bce9bebf97c5fb88d167d0019b0c661c9d95ea5f67518c41b5b",
"sha256": "sha256:efe849510e0401d6171a45432a8e500164ac9711d55c78ac2f13fcd88f16d8da",
"size": 1712
},
{
@@ -42,7 +42,7 @@
},
{
"path": "comfyui_h3_context/contracts/installation_profiles_v1.json",
"sha256": "sha256:0e85dd457791e53aefe3f010a5c94a4d7739b3a6e6908ce70de1d8d95f03bbe5",
"sha256": "sha256:78eec7060ea1f5933a807d0e7148485339649bf03046b24dd57657b7872b71ec",
"size": 3377
},
{
@@ -67,7 +67,7 @@
},
{
"path": "frontend/package.json",
"sha256": "sha256:20eb9936251816560de648eac39181e0b9353a87a32141fc60c0ac2212abe12e",
"sha256": "sha256:263fb36146f75700329e16938b0bf1a44abc6388a4c60c087cc4221aad763b56",
"size": 1307
},
{
@@ -537,8 +537,8 @@
},
{
"path": "frontend/src/components/plainReasons.ts",
"sha256": "sha256:23d1990ccc303578f2a81e9f241642ba590d7b8d432aebb431759e6ce760dd17",
"size": 57040
"sha256": "sha256:e9e618e61b9c95d13825c704e54e8bb92c15aced29ca0be7f6aa268f4fab9f5e",
"size": 57871
},
{
"path": "frontend/src/components/productionStateLabels.ts",
@@ -1697,7 +1697,7 @@
},
{
"path": "governance/contracts/sbom.spdx.json",
"sha256": "sha256:8aac315cda347e27585428731a3437b1bedc4738f821dce7edce0d52e68a4522",
"sha256": "sha256:32696ce7c3029b0210a92c3aca38296721592e0c8b85338d503aac0c7f7cfb81",
"size": 82650
},
{
@@ -1707,7 +1707,7 @@
},
{
"path": "pyproject.toml",
"sha256": "sha256:c516237f215d6a399ce8e4b6ef288c41343d5b459ea8844f831ab503aac8af03",
"sha256": "sha256:044bf276b2c2e6101825fa35f1c360f12d3ab307e8011100cac142efd00c2924",
"size": 4095
},
{
@@ -1730,15 +1730,15 @@
"runtime_entries": [
{
"path": "comfyui_h3_context/web/h3-context-sidebar.js",
"sha256": "sha256:eb9a7de0179525f6d5fbe2229f5135d4c365b6da2898a3fb6ea8557cda655460",
"size": 3932886
"sha256": "sha256:3ceff7b6ed79f4300945eae369f4f4d70026bb2682e550566e714f0de81e91c3",
"size": 3933669
}
],
"schema": "h3-context-supply-chain/1",
"spdx": {
"package_count": 180,
"path": "governance/contracts/sbom.spdx.json",
"sha256": "sha256:8aac315cda347e27585428731a3437b1bedc4738f821dce7edce0d52e68a4522",
"sha256": "sha256:32696ce7c3029b0210a92c3aca38296721592e0c8b85338d503aac0c7f7cfb81",
"version": "SPDX-2.3"
},
"version": 1
+1 -1
View File
@@ -5,7 +5,7 @@ backend-path = ["."]
[project]
name = "minimax-h3-studio"
version = "1.4.5"
version = "1.4.6"
description = "Turn a description into a finished MiniMax H3 video without leaving ComfyUI, prompt, segments, continuity and final cut in one workbench."
readme = "README.md"
requires-python = ">=3.10"
+2 -2
View File
@@ -241,7 +241,7 @@
{
"type": "Hex High Entropy String",
"filename": "comfyui_h3_context\\contracts\\build_provenance_v1.json",
"hashed_secret": "b37f41926be4066acbe2fb7bb41d67c423ac48ab",
"hashed_secret": "886b1b4e05a073c3e810e60bfc15c2f45d114213",
"is_verified": false,
"line_number": 15,
"is_secret": false
@@ -249,7 +249,7 @@
{
"type": "Hex High Entropy String",
"filename": "comfyui_h3_context\\contracts\\build_provenance_v1.json",
"hashed_secret": "125b1690859427e0fc82cefd3690a23598d59b36",
"hashed_secret": "2d594320294613512585ae1bc56cc345bcf34283",
"is_verified": false,
"line_number": 17,
"is_secret": false
+262 -45
View File
@@ -1,18 +1,30 @@
"""Maintainer tool for the native T2VA structural admission baseline.
"""Maintainer tool for the native structural admission baselines (T2VA, keyframe, reference).
Reads native source bytes from an explicitly supplied ComfyUI checkout -- a Git revision through
``git show`` or the file on disk -- and never imports, compiles for execution or runs host code.
It imports repository pure code only and prints hashes, closed identifiers and counts, never
native source text.
native source text. It covers every scope the repository checkout has: an older release line
without the reference scope simply reports and emits fewer tables.
Derive the manifest of an accepted revision (the committed baseline is regenerated from this)::
python scripts/native_t2va_structure.py --host-root <root> --revision b323a345
python scripts/native_t2va_structure.py --host-root <root> --revision b323a345 --emit-python
Classify a revision, or the disk file, with the production classifier::
Classify a revision, or the disk file, with the production classifiers of every scope::
python scripts/native_t2va_structure.py --check --host-root <root> [--revision <rev>]
python scripts/native_t2va_structure.py --check --scope keyframe --host-root <root>
Derive the manifests of an accepted revision and compare them with the committed lineages. The
shape names the audited rows: ``original`` is the committed first lineage's rows, ``split-latent``
adds ``_av_latent`` before ``_empty_av_latent`` (the helper newer hosts split in two)::
python scripts/native_t2va_structure.py --host-root <root> --revision <rev> --shape split-latent
Emit a lineage data module, every scope's table of one audited revision::
python scripts/native_t2va_structure.py --host-root <root> --revision <rev> \\
--shape split-latent --emit-lineage
Regenerate the first lineage's T2VA baseline module (the committed one is regenerated from this)::
python scripts/native_t2va_structure.py --host-root <root> --revision b323a345 --emit-python
A disk or Git check is maintainer evidence only. It says nothing about which bytes a running host
loaded; runtime admission comes from the registered-module observer on the actual candidate.
@@ -23,10 +35,15 @@ from __future__ import annotations
import argparse
import ast
import hashlib
import importlib
import json
import subprocess
import sys
from collections.abc import Callable
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Protocol
_REPO_ROOT = Path(__file__).resolve().parent.parent
if str(_REPO_ROOT) not in sys.path:
@@ -47,6 +64,102 @@ AUDITED_DEFINITIONS = (
structure.IMAGE_TO_VIDEO + ".execute",
structure.IMAGE_TO_VIDEO,
)
SHAPES = ("original", "split-latent")
# The helper newer hosts split in two: its body moves to `_av_latent`, and `_empty_av_latent`
# becomes a wrapper. The helper precedes its only caller, so the audited rows keep that order.
_SPLIT_HELPER = "_av_latent"
_SPLIT_CALLER = "_empty_av_latent"
class _Verdict(Protocol):
"""What the three scopes' verdict types have in common."""
@property
def reason(self) -> Enum: ...
@property
def admitted(self) -> bool: ...
@property
def check(self) -> str: ...
@property
def manifest_fingerprint(self) -> str: ...
@dataclass(frozen=True)
class _Scope:
name: str
data_name: str
rows: tuple[str, ...]
lineages: tuple[structure.NativeT2VABaselineManifest, ...]
derive: Callable[..., structure.NativeT2VABaselineManifest]
classify: Callable[[bytes], _Verdict]
is_production: Callable[[object], bool]
def _names(manifest: structure.NativeT2VABaselineManifest) -> tuple[str, ...]:
return tuple(name for name, _digest in manifest.definitions)
def _optional_scope(name: str, derive: str) -> _Scope | None:
"""The keyframe or reference scope, or None when this checkout does not have that module.
CRITICAL: the tool is carried to older release lines that have fewer scopes (the 1.4.5 line has
no reference scope). A scope is found by import, never named in a static import, so the tool
runs there unchanged and reports and emits only the scopes the checkout has. Only a missing
scope module is tolerated: any other import failure is a real fault and must surface.
"""
path = f"comfyui_h3_context.core.native_{name}_structure"
try:
module = importlib.import_module(path)
except ModuleNotFoundError as error:
if error.name != path:
raise
return None
return _Scope(
name,
f"{name.upper()}_DATA",
# The audited rows of a scope are the rows of its first production lineage, so the tool
# keeps no second copy of them.
_names(module.PRODUCTION_MANIFEST),
module.PRODUCTION_LINEAGES,
getattr(module, derive),
getattr(module, f"classify_native_{name}_source"),
module.is_production_admission,
)
# T2VA keeps its named row tuple above because its first baseline module is generated from it.
SCOPES: tuple[_Scope, ...] = (
_Scope(
"t2va",
"T2VA_DATA",
AUDITED_DEFINITIONS,
structure.PRODUCTION_LINEAGES,
structure.derive_manifest,
structure.classify_native_t2va_source,
structure.is_production_admission,
),
*(
scope
for scope in (
_optional_scope("keyframe", "derive_keyframe_manifest"),
_optional_scope("reference", "derive_reference_manifest"),
)
if scope is not None
),
)
def audited_rows(scope: _Scope, shape: str) -> tuple[str, ...]:
if shape == "original":
return scope.rows
return tuple(
name
for row in scope.rows
for name in ((_SPLIT_HELPER, row) if row == _SPLIT_CALLER else (row,))
)
def git_blob(content: bytes) -> str:
@@ -84,21 +197,22 @@ def census(content: bytes) -> dict[str, int]:
return {"bytes": len(content), "ast_nodes": nodes, "ast_depth": depth}
def _text(value: str) -> str:
return json.dumps(value)
def _pairs(items: tuple[tuple[str, str], ...]) -> str:
return "".join(
f" (\n {_text(name)},\n {_text(value)},\n ),\n" for name, value in items
)
def _singles(items: tuple[str, ...]) -> str:
return "".join(f" {_text(name)},\n" for name in items)
def render_python(manifest: structure.NativeT2VABaselineManifest) -> str:
"""Emit the baseline module exactly as `ruff format` leaves it, so regeneration is stable."""
def text(value: str) -> str:
return json.dumps(value)
def pairs(items: tuple[tuple[str, str], ...]) -> str:
return "".join(
f" (\n {text(name)},\n {text(value)},\n ),\n"
for name, value in items
)
def names(items: tuple[str, ...]) -> str:
return "".join(f" {text(name)},\n" for name in items)
return (
'"""Accepted native T2VA structural baseline: per-definition digests, never source text.\n'
"\n"
@@ -108,65 +222,168 @@ def render_python(manifest: structure.NativeT2VABaselineManifest) -> str:
"are part of managed qualification compiler identity.\n"
'"""\n'
"\n"
f"SOURCE_REVISION = {text(manifest.source_revision)} # pragma: allowlist secret\n"
f"SOURCE_BLOB = {text(manifest.source_blob)} # pragma: allowlist secret\n"
f"DEFINITIONS: tuple[tuple[str, str], ...] = (\n{pairs(manifest.definitions)})\n"
f"CONSTANTS: tuple[tuple[str, str], ...] = (\n{pairs(manifest.constants)})\n"
f"PACKAGE_ROOTS: tuple[str, ...] = (\n{names(manifest.package_roots)})\n"
f"REQUIRED_IMPORTS: tuple[str, ...] = (\n{names(manifest.required_imports)})\n"
f"FROM_BINDINGS: tuple[tuple[str, str], ...] = (\n{pairs(manifest.from_bindings)})\n"
f"SOURCE_REVISION = {_text(manifest.source_revision)} # pragma: allowlist secret\n"
f"SOURCE_BLOB = {_text(manifest.source_blob)} # pragma: allowlist secret\n"
f"DEFINITIONS: tuple[tuple[str, str], ...] = (\n{_pairs(manifest.definitions)})\n"
f"CONSTANTS: tuple[tuple[str, str], ...] = (\n{_pairs(manifest.constants)})\n"
f"PACKAGE_ROOTS: tuple[str, ...] = (\n{_singles(manifest.package_roots)})\n"
f"REQUIRED_IMPORTS: tuple[str, ...] = (\n{_singles(manifest.required_imports)})\n"
f"FROM_BINDINGS: tuple[tuple[str, str], ...] = (\n{_pairs(manifest.from_bindings)})\n"
"ENVELOPE_BINDINGS: tuple[tuple[str, str], ...] = (\n"
f"{pairs(manifest.envelope_bindings)})\n"
f"PROTECTED_BUILTINS: tuple[str, ...] = (\n{names(manifest.protected_builtins)})\n"
f"EXTERNAL_PATHS: tuple[str, ...] = (\n{names(manifest.external_paths)})\n"
f"{_pairs(manifest.envelope_bindings)})\n"
f"PROTECTED_BUILTINS: tuple[str, ...] = (\n{_singles(manifest.protected_builtins)})\n"
f"EXTERNAL_PATHS: tuple[str, ...] = (\n{_singles(manifest.external_paths)})\n"
)
def _field(key: str, rendered: str) -> str:
return f' "{key}": (\n{rendered} ),\n' if rendered else f' "{key}": (),\n'
def _indented(rendered: str) -> str:
return "".join(f" {line}\n" for line in rendered.splitlines())
def _data_block(name: str, manifest: structure.NativeT2VABaselineManifest) -> str:
return (
f"{name}: _ManifestData = {{\n"
f' "source_revision": {_text(manifest.source_revision)}, # pragma: allowlist secret\n'
f' "source_blob": {_text(manifest.source_blob)}, # pragma: allowlist secret\n'
+ _field("definitions", _indented(_pairs(manifest.definitions)))
+ _field("constants", _indented(_pairs(manifest.constants)))
+ _field("package_roots", _indented(_singles(manifest.package_roots)))
+ _field("required_imports", _indented(_singles(manifest.required_imports)))
+ _field("from_bindings", _indented(_pairs(manifest.from_bindings)))
+ _field("envelope_bindings", _indented(_pairs(manifest.envelope_bindings)))
+ _field("protected_builtins", _indented(_singles(manifest.protected_builtins)))
+ _field("external_paths", _indented(_singles(manifest.external_paths)))
+ "}\n"
)
def render_lineage(manifests: dict[str, structure.NativeT2VABaselineManifest], shape: str) -> str:
"""Emit one lineage data module: every scope's table of one audited revision."""
anchor = manifests["t2va"]
return (
'"""Audited native structural baselines of one source shape: digests, never source text.\n'
"\n"
f"Shape ``{shape}``: the audited rows of the committed first lineage, with the "
"empty-latent\n"
"helper split into ``_av_latent`` plus its wrapper. Each table is derived from the native\n"
"source at the revision it names; provenance identifies that audited input and is never\n"
"compared with a loaded source. Generated by ``scripts/native_t2va_structure.py\n"
f"--host-root <root> --revision {anchor.source_revision[:8]} --shape {shape} "
"--emit-lineage``.\n"
"Regenerate only for a newly audited shape; these tables are part of managed "
"qualification\n"
"compiler identity.\n"
'"""\n'
"\n"
"from typing import TypedDict\n"
"\n"
"\n"
"class _ManifestData(TypedDict):\n"
" source_revision: str\n"
" source_blob: str\n"
" definitions: tuple[tuple[str, str], ...]\n"
" constants: tuple[tuple[str, str], ...]\n"
" package_roots: tuple[str, ...]\n"
" required_imports: tuple[str, ...]\n"
" from_bindings: tuple[tuple[str, str], ...]\n"
" envelope_bindings: tuple[tuple[str, str], ...]\n"
" protected_builtins: tuple[str, ...]\n"
" external_paths: tuple[str, ...]\n"
"\n"
"\n" + "\n\n".join(_data_block(scope.data_name, manifests[scope.name]) for scope in SCOPES)
)
def _scope_results(content: bytes, selected: tuple[_Scope, ...]) -> dict[str, dict[str, object]]:
results: dict[str, dict[str, object]] = {}
for scope in selected:
verdict = scope.classify(content)
results[scope.name] = {
"reason": str(verdict.reason.value),
"check": verdict.check,
"manifest_fingerprint": verdict.manifest_fingerprint,
"production_admission": scope.is_production(verdict),
"admitted": verdict.admitted,
}
return results
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0] if __doc__ else None)
parser.add_argument("--host-root", required=True, type=Path)
parser.add_argument("--revision", help="Git revision; omit with --check for the disk file")
parser.add_argument("--check", action="store_true", help="classify with the production table")
parser.add_argument("--emit-python", action="store_true", help="print the baseline module")
parser.add_argument(
"--scope",
choices=("all", *(scope.name for scope in SCOPES)),
default="all",
help="with --check: the scopes to classify (default every scope this checkout has)",
)
parser.add_argument("--shape", choices=SHAPES, default="original", help="audited rows")
parser.add_argument("--emit-python", action="store_true", help="print the T2VA baseline module")
parser.add_argument("--emit-lineage", action="store_true", help="print a lineage data module")
args = parser.parse_args(argv)
content, full = read_source(args.host_root, args.revision)
blob = git_blob(content)
facts: dict[str, object] = {
"python": sys.version.split()[0],
"classifier_schema": structure.NATIVE_T2VA_CLASSIFIER_SCHEMA,
"subject": full or "disk",
"source_blob": blob,
**census(content),
}
if args.check:
verdict = structure.classify_native_t2va_source(content)
selected = tuple(item for item in SCOPES if args.scope in ("all", item.name))
results = _scope_results(content, selected)
facts.update(
{
"mode": "check",
"reason": verdict.reason.value,
"check": verdict.check,
"manifest_fingerprint": verdict.manifest_fingerprint,
"production_admission": structure.is_production_admission(verdict),
"scopes": results,
"scope": "maintainer disk/Git classification; not loaded-runtime evidence",
}
)
print(json.dumps(facts, indent=2))
return 0 if verdict.admitted else 1
return 0 if all(item["admitted"] for item in results.values()) else 1
if full is None:
parser.error("deriving a baseline requires --revision")
manifest = structure.derive_manifest(
content, source_revision=full, source_blob=blob, definitions=AUDITED_DEFINITIONS
)
if args.emit_python:
manifest = structure.derive_manifest(
content, source_revision=full, source_blob=blob, definitions=AUDITED_DEFINITIONS
)
# LF bytes: Windows text-mode stdout would emit CRLF and break the ruff-stable table.
sys.stdout.buffer.write(render_python(manifest).encode("utf-8"))
return 0
manifests = {
scope.name: scope.derive(
content,
source_revision=full,
source_blob=blob,
definitions=audited_rows(scope, args.shape),
)
for scope in SCOPES
}
if args.emit_lineage:
sys.stdout.buffer.write(render_lineage(manifests, args.shape).encode("utf-8"))
return 0
facts.update(
{
"mode": "derive",
"manifest": manifest.to_wire(),
"manifest_fingerprint": manifest.fingerprint,
"matches_committed": manifest == structure.PRODUCTION_MANIFEST,
"shape": args.shape,
"scopes": {
scope.name: {
"rows": len(audited_rows(scope, args.shape)),
"manifest_fingerprint": manifests[scope.name].fingerprint,
"matches_committed_lineage": [
index
for index, committed in enumerate(scope.lineages)
if committed == manifests[scope.name]
],
}
for scope in SCOPES
},
}
)
print(json.dumps(facts, indent=2))
+2 -2
View File
@@ -2,13 +2,13 @@
"schema": "h3-context-release-matrix/1",
"package": {
"name": "minimax-h3-studio",
"version": "1.4.5",
"version": "1.4.6",
"author": "rookiestar28",
"dependencies": []
},
"artifact": {
"required": ["wheel", "sdist"],
"prefix": "minimax_h3_studio-1.4.5",
"prefix": "minimax_h3_studio-1.4.6",
"forbidden_path_markers": [
"AGENTS.md",
"ROADMAP.md",
+317
View File
@@ -0,0 +1,317 @@
"""Synthetic lineage-B shaped native source and the closed regex-form tables, authored for tests.
Nothing here is ComfyUI source text. ``LINEAGE_B_SOURCE`` is the synthetic T2VA module of
``native_t2va_fixtures`` reshaped the way a newer host reshapes its module: a module-level compiled
regular expression and the latent helper split in two (``_av_latent`` plus the empty-latent
wrapper). The tables name each refusal after the guard of the closed assignment form that makes it.
This module has no pytest dependency, like ``native_t2va_fixtures``.
"""
from __future__ import annotations
from native_t2va_fixtures import SYNTHETIC_DEFINITIONS, SYNTHETIC_SOURCE, mutate
from comfyui_h3_context.core import native_t2va_structure as structure
#: The one module-level regular expression a lineage-B shaped source carries. Doubled backslashes
#: keep the generated source text a raw string literal.
PATTERN_NAME = "SYNTHETIC_MARKER"
PATTERN_LINE = PATTERN_NAME + ' = re.compile(r"\\s*(Synthetic <Item \\d+>|marker:)")\n'
_ORIGINAL_EMPTY_LATENT = (
"def _empty_av_latent(width, height, frames):\n"
" video, audio = temporal_shape(frames)\n"
" device = comfy.model_management.intermediate_device()\n"
" return torch.zeros([1, 16, video, height // 8, width // 8], device=device), audio\n"
)
_SPLIT_EMPTY_LATENT = (
"def _av_latent(width, height, video, audio):\n"
" device = comfy.model_management.intermediate_device()\n"
" return torch.zeros([1, 16, video, height // 8, width // 8], device=device), audio\n"
"\n"
"\n"
"def _empty_av_latent(width, height, frames):\n"
" video, audio = temporal_shape(frames)\n"
" return _av_latent(width, height, video, audio)\n"
)
def variant(source: str, *pairs: tuple[str, str]) -> str:
"""Apply replacements in order; each must match exactly once in the text it is applied to."""
for old, new in pairs:
source = mutate(source, old, new)
return source
#: The three edits that reshape a lineage-A shaped synthetic source into its lineage-B shape. They
#: apply to the T2VA fixture and, unchanged, to the keyframe test source built on it.
LINEAGE_B_EDITS: tuple[tuple[str, str], ...] = (
("import torch\n", "import re\nimport torch\n"),
("AUDIO_LATENT_FPS = 25\n", "AUDIO_LATENT_FPS = 25\n" + PATTERN_LINE),
(_ORIGINAL_EMPTY_LATENT, _SPLIT_EMPTY_LATENT),
)
def to_lineage_b(source: str) -> str:
return variant(source, *LINEAGE_B_EDITS)
def lineage_b_definitions(definitions: tuple[str, ...]) -> tuple[str, ...]:
"""The audited rows of a lineage-B manifest: the lineage-A rows plus the split helper, which
precedes its only caller."""
return tuple(
name
for item in definitions
for name in (("_av_latent", item) if item == "_empty_av_latent" else (item,))
)
LINEAGE_B_SOURCE = to_lineage_b(SYNTHETIC_SOURCE)
LINEAGE_B_DEFINITIONS = lineage_b_definitions(SYNTHETIC_DEFINITIONS)
#: A lineage-B shaped source whose audited ``video_latent_t`` reads the regular expression, so the
#: statement is part of the audited surface and a manifest must pin it.
PATTERN_READ_SOURCE = variant(
LINEAGE_B_SOURCE,
(
" return (align_frame_count(frames) - 1) // 4 + 1\n",
" return (align_frame_count(frames) - 1) // 4 + 1 + len("
+ PATTERN_NAME
+ ".pattern) * 0\n",
),
)
def lineage_a_manifest() -> structure.NativeT2VABaselineManifest:
return structure.derive_manifest(
SYNTHETIC_SOURCE.encode("utf-8"),
source_revision="synthetic-a",
source_blob="0" * 40,
definitions=SYNTHETIC_DEFINITIONS,
)
def lineage_b_manifest(
source: str = LINEAGE_B_SOURCE,
) -> structure.NativeT2VABaselineManifest:
return structure.derive_manifest(
source.encode("utf-8"),
source_revision="synthetic-b",
source_blob="2" * 40,
definitions=LINEAGE_B_DEFINITIONS,
)
def with_pattern(line: str) -> str:
"""The lineage-B shaped source with its one regular-expression statement replaced."""
return mutate(LINEAGE_B_SOURCE, PATTERN_LINE, line)
#: id -> statement text that replaces the pattern line. Each must stay admitted by lineage B.
REGEX_FORMS_ADMITTED: dict[str, str] = {
"pattern_only": PATTERN_LINE,
"int_flags": PATTERN_NAME + ' = re.compile("x", 2)\n',
"named_flag": PATTERN_NAME + ' = re.compile("x", re.IGNORECASE)\n',
"short_flag": PATTERN_NAME + ' = re.compile("x", re.I)\n',
"joined_flags": PATTERN_NAME + ' = re.compile("x", re.I | re.MULTILINE | re.S)\n',
"two_statements": PATTERN_LINE + "SYNTHETIC_OTHER = " + 're.compile("y")\n',
"adjacent_literals": PATTERN_NAME + ' = re.compile("a" "b")\n',
}
#: id -> (replacement pairs applied to the lineage-B source, expected closed refusal identifier).
#: Each row names the guard of the closed form that refuses it; the mutation receipt removes that
#: guard and the row must then fail.
REGEX_FORMS_REFUSED: dict[str, tuple[tuple[tuple[str, str], ...], str]] = {
# The callee: only ``re.compile`` on the plain-imported ``re``.
"call_is_not_a_regex": (((PATTERN_LINE, PATTERN_NAME + " = len([1])\n"),), "envelope_assign"),
"call_on_another_root": (
((PATTERN_LINE, PATTERN_NAME + " = torch.zeros(1)\n"),),
"envelope_assign",
),
"another_re_function": (
((PATTERN_LINE, PATTERN_NAME + ' = re.escape("x")\n'),),
"envelope_assign",
),
"method_on_the_compiled_value": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x").match\n'),),
"envelope_assign",
),
# The receiver of the callee must be the bound module's own name, not a longer expression that
# merely ends in `.compile`.
"call_on_an_attribute_receiver": (
((PATTERN_LINE, PATTERN_NAME + ' = re.re.compile("x")\n'),),
"envelope_assign",
),
"call_on_a_call_receiver": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("y").compile("x")\n'),),
"envelope_assign",
),
"call_nested_in_a_container": (
((PATTERN_LINE, PATTERN_NAME + ' = (re.compile("x"),)\n'),),
"envelope_assign",
),
"call_inside_an_operation": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x") | 1\n'),),
"envelope_assign",
),
"from_import_of_compile": (
(
("import re\n", "from re import compile\n"),
(PATTERN_LINE, PATTERN_NAME + ' = compile("x")\n'),
),
"envelope_assign",
),
# The binding of ``re``: a plain ``import re`` that nothing rebinds.
"re_is_never_imported": ((("import re\n", ""),), "envelope_assign"),
"re_is_imported_after_the_statement": (
(("import re\n", ""), (PATTERN_LINE, PATTERN_LINE + "import re\n")),
"envelope_assign",
),
"re_import_is_aliased": (
(("import re\n", "import re as r\n"),),
"envelope_assign",
),
"aliased_import_and_method": (
(
("import re\n", "import re as r\n"),
(PATTERN_LINE, PATTERN_NAME + ' = r.compile("x")\n'),
),
"envelope_assign",
),
"re_import_is_dotted": ((("import re\n", "import re.sub\n"),), "envelope_assign"),
"re_is_rebound_after": (((PATTERN_LINE, PATTERN_LINE + "re = 3\n"),), "envelope_duplicate"),
"re_is_rebound_before": ((("import re\n", "re = 3\nimport re\n"),), "envelope_duplicate"),
"re_is_defined_as_a_function": (
((PATTERN_LINE, PATTERN_LINE + "\n\ndef re(value):\n return value\n\n"),),
"envelope_duplicate",
),
"re_is_bound_by_a_from_import": (
((PATTERN_LINE, PATTERN_LINE + "from json import re\n"),),
"envelope_duplicate",
),
# The arguments: one pattern literal and at most one flags value, positional only.
"no_argument": (((PATTERN_LINE, PATTERN_NAME + " = re.compile()\n"),), "envelope_assign"),
"extra_argument": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", 0, 1)\n'),),
"envelope_assign",
),
"keyword_flags": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", flags=re.I)\n'),),
"envelope_assign",
),
"starred_argument": (
((PATTERN_LINE, PATTERN_NAME + " = re.compile(*FPS)\n"),),
"envelope_assign",
),
# The pattern: a plain string literal only.
"pattern_is_a_name": (
((PATTERN_LINE, PATTERN_NAME + " = re.compile(FPS)\n"),),
"envelope_assign",
),
"pattern_is_a_call": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile(len("x"))\n'),),
"envelope_assign",
),
"pattern_is_bytes": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile(b"x")\n'),),
"envelope_assign",
),
"pattern_is_an_fstring": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile(f"{FPS}")\n'),),
"envelope_assign",
),
"pattern_is_concatenated": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("a" + "b")\n'),),
"envelope_assign",
),
# The flags: an int literal or uppercase ``re`` attributes joined with ``|``.
"flags_is_a_name": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", FPS)\n'),),
"envelope_assign",
),
"flags_attribute_is_lowercase": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", re.i)\n'),),
"envelope_assign",
),
"flags_are_added": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", re.I + re.M)\n'),),
"envelope_assign",
),
"flags_is_a_bool": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", True)\n'),),
"envelope_assign",
),
"flags_is_a_float": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", 1.5)\n'),),
"envelope_assign",
),
"flags_is_negative": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", -1)\n'),),
"envelope_assign",
),
"flags_attribute_is_nested": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", re.RegexFlag.IGNORECASE)\n'),),
"envelope_assign",
),
"flags_attribute_is_on_another_root": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", torch.I)\n'),),
"envelope_assign",
),
"flags_is_a_call": (
((PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", re.I.__or__(re.M))\n'),),
"envelope_assign",
),
# The target: one plain name that is neither protected nor already bound.
"target_is_a_tuple": (
((PATTERN_LINE, 'SYNTHETIC_A, SYNTHETIC_B = re.compile("x"), re.compile("y")\n'),),
"envelope_assign",
),
"target_is_chained": (
((PATTERN_LINE, 'SYNTHETIC_A = SYNTHETIC_B = re.compile("x")\n'),),
"envelope_assign",
),
"target_is_a_defined_name": (
((PATTERN_LINE, PATTERN_LINE + 'align_frame_count = re.compile("x")\n'),),
"binding:align_frame_count",
),
"target_is_a_builtin": (
((PATTERN_LINE, PATTERN_LINE + 'round = re.compile("x")\n'),),
"binding:round",
),
"target_is_a_package_root": (
((PATTERN_LINE, PATTERN_LINE + 'torch = re.compile("x")\n'),),
"binding:torch",
),
"target_is_a_pinned_constant": (
(("FPS = 24\n", 'FPS = re.compile("x")\n'),),
"constant:FPS",
),
"target_is_a_dunder": (
((PATTERN_LINE, PATTERN_LINE + '__all__ = re.compile("x")\n'),),
"envelope_dunder",
),
"target_is_bound_twice": (
((PATTERN_LINE, PATTERN_LINE + PATTERN_LINE),),
"envelope_duplicate",
),
# Where: module level only. Class bodies and defaults keep refusing every call.
"class_body_statement": (
(
(
"class SyntheticExtension(ComfyExtension):\n",
'class SyntheticExtension(ComfyExtension):\n registered = re.compile("x")\n',
),
),
"envelope_class",
),
"function_default": (
(
(
" async def get_node_list(self):",
' async def get_node_list(self, hook=re.compile("x")):',
),
),
"envelope_function",
),
}
+6 -4
View File
@@ -12,7 +12,7 @@ from comfyui_h3_context.core.native_composition import NativeCompositionObservat
from comfyui_h3_context.core.native_h3 import NATIVE_H3_SOURCE_BLOB
from comfyui_h3_context.core.native_source_compatibility import NativeSourceObservation
from comfyui_h3_context.core.native_t2va_structure import (
PRODUCTION_MANIFEST,
PRODUCTION_LINEAGES,
NativeT2VAStructureVerdict,
StructureReason,
)
@@ -21,9 +21,10 @@ from comfyui_h3_context.core.native_t2va_structure import (
EQUIVALENT_BLOB = "1baa33cb" + "0" * 32
def structure_verdict(check: str = "admitted") -> NativeT2VAStructureVerdict:
def structure_verdict(check: str = "admitted", *, lineage: int = 0) -> NativeT2VAStructureVerdict:
"""A verdict against one production lineage (0 is the original baseline, 1 the newer shape)."""
reason = StructureReason.ADMITTED if check == "admitted" else StructureReason.CHANGED
return NativeT2VAStructureVerdict(reason, check, PRODUCTION_MANIFEST.fingerprint)
return NativeT2VAStructureVerdict(reason, check, PRODUCTION_LINEAGES[lineage].fingerprint)
def observed_source(
@@ -31,10 +32,11 @@ def observed_source(
*,
check: str = "admitted",
origin: object = "registered-module",
lineage: int = 0,
) -> NativeSourceObservation | None:
if blob is None:
return None
return NativeSourceObservation(blob, structure_verdict(check), (origin,))
return NativeSourceObservation(blob, structure_verdict(check, lineage=lineage), (origin,))
def composition_observation(
+2 -1
View File
@@ -113,7 +113,8 @@ def test_inventory_covers_both_stacks_and_the_shipped_entrypoint() -> None:
# adapter plus the two seam instruments; inactive product routes do not remove their modules.
# The shared native audio capacity adds one dependency-free policy owner.
# Validation and assisted proposals share one pure literal-content predicate owner.
assert len([row for row in document["modules"] if row["language"] == "python"]) == 355
# (2026-11-24) adds the second production lineage's data tables as one pure data owner.
assert len([row for row in document["modules"] if row["language"] == "python"]) == 356
# /48 add the toolbar/decisions and Media/Text; adds filmstrip ownership;
# replaces one legacy Inspector module with separate tabs and timeline-menu owners;
# adds the monitor transform overlay and its pure gesture mapper; adds the
+133
View File
@@ -5,11 +5,22 @@ from types import ModuleType
from typing import cast
import pytest
from native_lineage_fixtures import (
PATTERN_LINE,
PATTERN_NAME,
lineage_b_definitions,
to_lineage_b,
variant,
)
from native_t2va_fixtures import SYNTHETIC_DEFINITIONS, SYNTHETIC_SOURCE, synthetic_manifest
from comfyui_h3_context.core import native_t2va_structure as t2va
from comfyui_h3_context.core.native_keyframe_structure import NativeKeyframeBaselineManifest
# The committed keyframe production table (lineage A); a lineage added later never moves it.
PRODUCTION_MANIFEST_FINGERPRINT = (
"sha256:61c1ff85ea8d0f4de3d046b387770bb738705cf4e0d33cc0e4f1d290524690bf"
)
SOURCE = (
SYNTHETIC_SOURCE
+ """
@@ -116,6 +127,128 @@ def test_keyframe_classifier_preserves_parse_and_envelope_bounds() -> None:
assert not verdict.admitted and marker not in verdict.check
SOURCE_B = to_lineage_b(SOURCE)
def _manifest_b() -> NativeKeyframeBaselineManifest:
return cast(
NativeKeyframeBaselineManifest,
_module().derive_keyframe_manifest(
SOURCE_B.encode(),
source_revision="synthetic-keyframe-b",
source_blob="2" * 40,
definitions=lineage_b_definitions(DEFINITIONS),
),
)
def test_keyframe_lineages_are_tried_in_order_and_the_first_admission_wins() -> None:
module = _module()
a, b = _manifest(), _manifest_b()
assert a.fingerprint != b.fingerprint
for order in ((a, b), (b, a)):
older = t2va.classify_lineages(SOURCE.encode(), order, module._classify)
newer = t2va.classify_lineages(SOURCE_B.encode(), order, module._classify)
assert older.admitted and older.manifest_fingerprint == a.fingerprint
assert newer.admitted and newer.manifest_fingerprint == b.fingerprint
assert older.reason.value == "native_keyframe_structure_admitted"
def test_keyframe_refusal_comes_from_the_newest_lineage_and_stays_unmasked() -> None:
module = _module()
a, b = _manifest(), _manifest_b()
changed = variant(SOURCE_B, ("(0, first_frame)", "(1, first_frame)"))
# The T2VA scope masks this guarded body, so only the unmasked keyframe scope can refuse it.
assert t2va._classify(changed.encode(), t2va_manifest_b()).admitted
verdict = t2va.classify_lineages(changed.encode(), (a, b), module._classify)
assert not verdict.admitted
assert verdict.manifest_fingerprint == b.fingerprint
assert verdict.check == "definition:MiniMaxH3ImageToVideo.execute"
guide = variant(SOURCE_B, ("else count + frame_idx", "else count - frame_idx"))
verdict = t2va.classify_lineages(guide.encode(), (a, b), module._classify)
assert (verdict.manifest_fingerprint, verdict.check) == (
b.fingerprint,
"definition:MiniMaxH3AddGuide.execute",
)
def t2va_manifest_b() -> t2va.NativeT2VABaselineManifest:
return t2va.derive_manifest(
SOURCE_B.encode(),
source_revision="synthetic-t2va-b",
source_blob="3" * 40,
definitions=lineage_b_definitions(SYNTHETIC_DEFINITIONS),
)
@pytest.mark.parametrize(
("old", "new", "check"),
(
(PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", re.I | re.S)\n', "admitted"),
(PATTERN_LINE, PATTERN_NAME + " = len([1])\n", "envelope_assign"),
(PATTERN_LINE, PATTERN_NAME + ' = re.compile("x", flags=re.I)\n', "envelope_assign"),
("import re\n", "import re as r\n", "envelope_assign"),
),
)
def test_keyframe_scope_uses_the_shared_closed_regex_form(old: str, new: str, check: str) -> None:
verdict = _module()._classify(variant(SOURCE_B, (old, new)).encode(), _manifest_b())
assert verdict.check == check
assert verdict.admitted is (check == "admitted")
def test_keyframe_production_lineages_are_closed_and_led_by_the_unchanged_manifest() -> None:
module = _module()
lineages = module.PRODUCTION_LINEAGES
assert type(lineages) is tuple and lineages
assert lineages[0] is module.PRODUCTION_MANIFEST
assert lineages[0].fingerprint == PRODUCTION_MANIFEST_FINGERPRINT
assert type(module.PRODUCTION_FINGERPRINTS) is frozenset
assert module.PRODUCTION_FINGERPRINTS == {item.fingerprint for item in lineages}
assert len(module.PRODUCTION_FINGERPRINTS) == len(lineages)
def test_keyframe_production_admission_is_membership_in_the_closed_fingerprint_set(
monkeypatch: pytest.MonkeyPatch,
) -> None:
module = _module()
a, b = _manifest(), _manifest_b()
verdict_b = module._classify(SOURCE_B.encode(), b)
assert verdict_b.admitted and not module.is_production_admission(verdict_b)
monkeypatch.setattr(
module, "PRODUCTION_FINGERPRINTS", frozenset({a.fingerprint, b.fingerprint})
)
assert module.is_production_admission(verdict_b)
reason = module.KeyframeStructureReason
verdict_type = module.NativeKeyframeStructureVerdict
assert not module.is_production_admission(
verdict_type(reason.CHANGED, "definition:FPS", b.fingerprint)
)
assert not module.is_production_admission(
verdict_type(reason.ADMITTED, "admitted", b.fingerprint, classifier_schema="other")
)
assert not module.is_production_admission(
verdict_type(reason.ADMITTED, "admitted", "sha256:" + "0" * 64)
)
assert not module.is_production_admission({"manifest_fingerprint": b.fingerprint})
def test_keyframe_production_entry_point_tries_the_production_lineages_in_order(
monkeypatch: pytest.MonkeyPatch,
) -> None:
module = _module()
a, b = _manifest(), _manifest_b()
monkeypatch.setattr(module, "PRODUCTION_LINEAGES", (a, b))
monkeypatch.setattr(
module, "PRODUCTION_FINGERPRINTS", frozenset({a.fingerprint, b.fingerprint})
)
for source, manifest in ((SOURCE, a), (SOURCE_B, b)):
verdict = module.classify_native_keyframe_source(source.encode())
assert verdict.admitted and verdict.manifest_fingerprint == manifest.fingerprint
assert module.is_production_admission(verdict)
unrelated = module.classify_native_keyframe_source(b"x = 1\n")
assert not unrelated.admitted and unrelated.manifest_fingerprint == b.fingerprint
def test_shared_guide_capability_requires_registration_and_all_inputs() -> None:
guide = importlib.import_module("comfyui_h3_context.core.native_guide")
required = frozenset({"positive", "vae", "latent", "image", "frame_idx"})
+147
View File
@@ -0,0 +1,147 @@
"""Qualification of a loaded native source on each production lineage, and the unrecognized hold.
These are model-free: a source observation stands in for what the registered-module observer
classified, and the verdicts carry a production lineage's real fingerprint. They prove that every
native mode qualifies on the original lineage and on the newer one, that a receipt minted under
one lineage is not the other's, and that the closed public reason for a source no lineage admits
covers exactly the two structural refusals and nothing else.
"""
from __future__ import annotations
from dataclasses import replace
from typing import Any, cast
import pytest
from native_source_doubles import EQUIVALENT_BLOB, observed_source
from test_native_h3_adapter import (
_audio_only_reference_report,
_keyframe_report,
_report,
_single_keyframe_report,
)
from test_native_source_compatibility import _qualify
from comfyui_h3_context.adapters import managed_mode_qualification as producer_module
from comfyui_h3_context.core import native_keyframe_structure as keyframe_structure
from comfyui_h3_context.core.contracts import TaskMode
from comfyui_h3_context.core.native_guide import GUIDE_REQUIRED_INPUTS, NativeGuideCapability
from comfyui_h3_context.core.native_h3 import build_native_h3_wiring
from comfyui_h3_context.core.native_source_compatibility import (
NativeSourceObservation,
qualify_native_source_compatibility,
)
from comfyui_h3_context.core.native_t2va_structure import StructureReason
MODES = ("t2va", "i2va", "l2va", "fl2va")
LINEAGES = (0, 1)
_SCOPES = {
"t2va": "structural_t2va_without_bindings",
"i2va": "structural_keyframe",
"l2va": "structural_keyframe",
"fl2va": "structural_keyframe",
}
def _report_for(mode: str) -> Any:
if mode == "t2va":
return _report()
if mode == "fl2va":
return _keyframe_report()
return _single_keyframe_report(TaskMode[mode.upper()])
def _source_for(mode: str, lineage: int, *, admitted: bool = True) -> NativeSourceObservation:
"""A non-baseline source whose verdict for `mode`'s scope is against one production lineage."""
check = "admitted" if admitted else "definition:FPS"
base = cast(
NativeSourceObservation, observed_source(EQUIVALENT_BLOB, check=check, lineage=lineage)
)
if mode == "t2va":
return base
return replace(
base,
keyframes=keyframe_structure.NativeKeyframeStructureVerdict(
keyframe_structure.KeyframeStructureReason.ADMITTED
if admitted
else keyframe_structure.KeyframeStructureReason.CHANGED,
"admitted" if admitted else "definition:MiniMaxH3ImageToVideo.execute",
keyframe_structure.PRODUCTION_LINEAGES[lineage].fingerprint,
),
guide=NativeGuideCapability(True, GUIDE_REQUIRED_INPUTS),
)
@pytest.mark.parametrize("mode", MODES)
@pytest.mark.parametrize("lineage", LINEAGES)
def test_every_native_mode_qualifies_on_each_production_lineage(mode: str, lineage: int) -> None:
report = _report_for(mode)
wiring = build_native_h3_wiring(report)
source = _source_for(mode, lineage)
receipt = qualify_native_source_compatibility(source, wiring)
assert receipt is not None and receipt.scope == _SCOPES[mode]
assert receipt.admits(source, wiring)
qualified = _qualify([source], report=report, wiring=wiring, receipt=receipt)
assert qualified.qualified and qualified.detail == "structural_receipt"
qualified.assert_current(report, wiring)
@pytest.mark.parametrize("mode", MODES)
def test_a_receipt_minted_under_one_lineage_is_not_the_others(mode: str) -> None:
wiring = build_native_h3_wiring(_report_for(mode))
first = qualify_native_source_compatibility(_source_for(mode, 0), wiring)
second = qualify_native_source_compatibility(_source_for(mode, 1), wiring)
assert first is not None and second is not None
assert first.fingerprint != second.fingerprint
# The receipt binds the lineage its verdict was classified against: neither admits the other's
# observation, so a currentness check can never swap the lineage underneath a qualification.
assert not first.admits(_source_for(mode, 1), wiring)
assert not second.admits(_source_for(mode, 0), wiring)
@pytest.mark.parametrize("mode", MODES)
@pytest.mark.parametrize("lineage", LINEAGES)
def test_a_source_no_lineage_admits_is_held_with_a_structure_reason(
mode: str, lineage: int
) -> None:
report = _report_for(mode)
wiring = build_native_h3_wiring(report)
source = _source_for(mode, lineage, admitted=False)
assert qualify_native_source_compatibility(source, wiring) is None
held = _qualify([source], report=report, wiring=wiring)
assert not held.qualified
assert held.reason in producer_module._UNRECOGNIZED_SOURCE_COMPOSITION_REASONS
# The detail is a closed manifest identifier, never source text or a path.
assert held.detail is not None and held.detail.startswith("definition:")
def test_the_unrecognized_reason_covers_exactly_the_two_structural_refusals() -> None:
assert producer_module._UNRECOGNIZED_SOURCE_COMPOSITION_REASONS == {
StructureReason.CHANGED.value,
keyframe_structure.KeyframeStructureReason.CHANGED.value,
}
def test_other_composition_holds_keep_the_generic_reason() -> None:
unrecognized = producer_module._UNRECOGNIZED_SOURCE_COMPOSITION_REASONS
# No source observation at all: the workflow is not there to compare.
unavailable = _qualify([None])
assert unavailable.reason == "native_source_identity_mismatch"
assert unavailable.detail == "source_unavailable"
assert unavailable.reason not in unrecognized
# A non-baseline source with no verdict for the mode's scope is never promoted or named.
base = cast(NativeSourceObservation, observed_source(EQUIVALENT_BLOB))
keyframe_report = _keyframe_report()
absent = _qualify(
[base], report=keyframe_report, wiring=build_native_h3_wiring(keyframe_report)
)
assert (absent.reason, absent.detail) == ("native_source_identity_mismatch", "receipt_absent")
assert absent.reason not in unrecognized
# An audio-bearing reference set is held whatever the structure says, so it never reads as an
# unrecognized version either.
audio_report = _audio_only_reference_report()
audio_source = _source_for("t2va", 1, admitted=False)
audio = _qualify(
[audio_source], report=audio_report, wiring=build_native_h3_wiring(audio_report)
)
assert audio.reason not in unrecognized
+164
View File
@@ -0,0 +1,164 @@
"""The committed production lineages of the two native structure scopes, as data.
These rows need no upstream source: they pin the second lineage's fingerprints and state how each
scope's second table differs from its first. Admission of real upstream sources is maintainer
evidence (``scripts/native_t2va_structure.py --check``), not a unit test.
"""
from __future__ import annotations
import importlib
import re
from dataclasses import dataclass
from pathlib import Path
from types import ModuleType
from typing import Any
import pytest
from comfyui_h3_context.core import native_baseline_v0_44 as lineage_module
_STRUCTURE = "comfyui_h3_context.core.native_{}_structure"
_HEX_40 = re.compile(r"[0-9a-f]{40}")
_SPLIT_HELPER = "_av_latent"
_SPLIT_CALLER = "_empty_av_latent"
@dataclass(frozen=True)
class _Scope:
name: str
verdict_type: str
reason_type: str
first: str
second: str
# Literal constants the second source carries that the first one did not, pinned like every
# other module-level literal.
added_constants: frozenset[str]
SCOPES = (
_Scope(
"t2va",
"NativeT2VAStructureVerdict",
"StructureReason",
"sha256:9f37572101bc6cfd3acf41236e65d915d09ff3ce1641fbc4dd37a369e31b88c9",
"sha256:3c262899632b69e93296f240aacd9936aeaba3afa2aa33440457ecbb6c417839",
frozenset({"PH3_IMAGE_EDIT", "PH3_IMAGE_SIZE", "PH3_IMAGE_VISION_PIXELS"}),
),
_Scope(
"keyframe",
"NativeKeyframeStructureVerdict",
"KeyframeStructureReason",
"sha256:61c1ff85ea8d0f4de3d046b387770bb738705cf4e0d33cc0e4f1d290524690bf",
"sha256:baa041e6b6809b072190e953f4a5f6eb251e2d0de298ed1f1681dd53dfbb4006",
frozenset({"PH3_IMAGE_EDIT", "PH3_IMAGE_SIZE", "PH3_IMAGE_VISION_PIXELS"}),
),
)
IDS = [scope.name for scope in SCOPES]
def _module(scope: _Scope) -> ModuleType:
return importlib.import_module(_STRUCTURE.format(scope.name))
@pytest.mark.parametrize("scope", SCOPES, ids=IDS)
def test_each_scope_holds_the_two_audited_lineages_oldest_first(scope: _Scope) -> None:
module = _module(scope)
lineages = module.PRODUCTION_LINEAGES
assert type(lineages) is tuple and len(lineages) == 2
assert lineages[0] is module.PRODUCTION_MANIFEST
assert [item.fingerprint for item in lineages] == [scope.first, scope.second]
assert module.PRODUCTION_FINGERPRINTS == {scope.first, scope.second}
assert all(_HEX_40.fullmatch(item.source_revision) for item in lineages)
assert all(_HEX_40.fullmatch(item.source_blob) for item in lineages)
assert lineages[0].source_blob != lineages[1].source_blob
@pytest.mark.parametrize("scope", SCOPES, ids=IDS)
def test_the_second_lineage_differs_from_the_first_only_where_the_helper_split(
scope: _Scope,
) -> None:
first, second = _module(scope).PRODUCTION_LINEAGES
first_rows = dict(first.definitions)
second_rows = dict(second.definitions)
expected_order = [
name
for row in first_rows
for name in ((_SPLIT_HELPER, row) if row == _SPLIT_CALLER else (row,))
]
assert list(second_rows) == expected_order
changed = {name for name in first_rows if first_rows[name] != second_rows[name]}
assert changed == {_SPLIT_CALLER}
# Everything the closure is built from is the same table; only the pinned literals may grow.
for field in (
"package_roots",
"required_imports",
"from_bindings",
"envelope_bindings",
"protected_builtins",
"external_paths",
):
assert getattr(second, field) == getattr(first, field), field
first_constants, second_constants = dict(first.constants), dict(second.constants)
assert set(second_constants) - set(first_constants) == scope.added_constants
assert set(first_constants) <= set(second_constants)
assert all(second_constants[name] == digest for name, digest in first_constants.items())
def test_each_generated_module_is_what_the_renderer_makes_from_its_manifests() -> None:
# A generated baseline module is never edited by hand: the maintainer tool's renderer must
# reproduce the committed bytes from the committed manifests, so a hand edit (or a table
# that drifted from its manifest) fails here without any upstream source.
from comfyui_h3_context.core import native_t2va_baseline
from comfyui_h3_context.core import native_t2va_structure as structure
from scripts import native_t2va_structure as tool
assert [scope.name for scope in tool.SCOPES] == ["t2va", "keyframe"]
second = {scope.name: scope.lineages[1] for scope in tool.SCOPES}
committed = Path(str(lineage_module.__file__)).read_bytes()
assert tool.render_lineage(second, "split-latent").encode("utf-8") == committed
first_t2va = Path(str(native_t2va_baseline.__file__)).read_bytes()
assert tool.render_python(structure.PRODUCTION_MANIFEST).encode("utf-8") == first_t2va
def test_the_tool_skips_a_scope_the_checkout_lacks_and_surfaces_any_other_failure(
monkeypatch: pytest.MonkeyPatch,
) -> None:
# A release line that lacks a scope has its module simply absent, and the tool reports fewer
# scopes. A different import failure inside an existing module is a real fault.
from scripts import native_t2va_structure as tool
assert tool._optional_scope("no_such_scope", "derive_no_such_manifest") is None
def broken(path: str) -> ModuleType:
raise ModuleNotFoundError("a dependency is gone", name="not_the_scope_module")
monkeypatch.setattr(importlib, "import_module", broken)
with pytest.raises(ModuleNotFoundError, match="dependency"):
tool._optional_scope("keyframe", "derive_keyframe_manifest")
def test_the_lineage_module_holds_exactly_the_two_scope_tables() -> None:
names = {name for name in vars(lineage_module) if name.endswith("_DATA")}
assert names == {"T2VA_DATA", "KEYFRAME_DATA"}
keys = {tuple(sorted(getattr(lineage_module, name))) for name in names}
assert len(keys) == 1
@pytest.mark.parametrize("scope", SCOPES, ids=IDS)
def test_a_verdict_against_each_production_lineage_is_a_production_admission(
scope: _Scope,
) -> None:
module = _module(scope)
verdict_type: Any = getattr(module, scope.verdict_type)
reason: Any = getattr(module, scope.reason_type)
for fingerprint in (scope.first, scope.second):
assert module.is_production_admission(
verdict_type(reason.ADMITTED, "admitted", fingerprint)
)
assert not module.is_production_admission(
verdict_type(reason.CHANGED, "definition:FPS", fingerprint)
)
# A fingerprint that is not a production lineage's never is, whatever the verdict says.
other = "sha256:" + "0" * 64
assert not module.is_production_admission(verdict_type(reason.ADMITTED, "admitted", other))
+46 -1
View File
@@ -145,7 +145,9 @@ def test_changed_structure_holds_with_the_closed_public_reason(
)
before = set(sidebar._entries)
held = _prepare(service, selection, "prepare.changed")
assert (held["status"], held["reason"]) == ("held", "qualification_composition_unqualified")
# A source that was read and matches no audited lineage gets its own closed reason; the log
# keeps the composition reason and the closed check identifier for the maintainer.
assert (held["status"], held["reason"]) == ("held", "native_source_structure_unrecognized")
assert _CHANGED not in str(held) and "native_t2va" not in str(held)
assert registry._current is None and set(sidebar._entries) == before
assert [record.getMessage() for record in caplog.records] == [
@@ -154,6 +156,24 @@ def test_changed_structure_holds_with_the_closed_public_reason(
]
def test_a_source_of_the_newer_lineage_qualifies_through_the_real_producer(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
caplog.set_level(logging.INFO, logger=_LOGGER)
service, registry, selection, _clock, _facts, sidebar, _calls, _count = _ready_environment(
monkeypatch, source=observed_source(EQUIVALENT_BLOB, lineage=1)
)
before = set(sidebar._entries)
prepared = _prepare(service, selection, "prepare.newer.lineage")
assert prepared["status"] == "ready" and prepared["reason"] == "qualified"
assert registry._current is not None
assert set(sidebar._entries) == before
assert [record.getMessage() for record in caplog.records] == [
"H3 Context managed qualification issued: segments=2 "
f"source={EQUIVALENT_BLOB} detail=structural_receipt"
]
def test_unavailable_source_and_observer_failure_keep_distinct_closed_paths(
monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture
) -> None:
@@ -317,6 +337,31 @@ def test_compiler_identity_covers_the_classifier_and_its_baseline_table(
producer_module.compiler_identity()
def test_compiler_identity_covers_the_lineage_tables_of_every_scope(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
# A production lineage's table decides which native sources qualify in both scopes, so a
# changed table must change the identity a qualification is issued under, like the first one.
sources = producer_module._COMPILER_SOURCES
lineage_module = "core/native_baseline_v0_44.py"
assert lineage_module in sources
package = Path(producer_module.__file__).resolve().parent.parent
for relative in sources:
target = tmp_path / relative
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(package / relative, target)
monkeypatch.setattr(
producer_module, "__file__", str(tmp_path / "adapters" / "managed_mode_qualification.py")
)
original = producer_module.compiler_identity()
target = tmp_path / lineage_module
content = target.read_bytes()
target.write_bytes(content + b"# changed table\n")
assert producer_module.compiler_identity() != original
target.write_bytes(content)
assert producer_module.compiler_identity() == original
def test_fifteen_segment_structural_qualification_keeps_its_original_expiry(
monkeypatch: pytest.MonkeyPatch,
) -> None:
+189 -1
View File
@@ -6,6 +6,18 @@ import inspect
import json
import pytest
from native_lineage_fixtures import (
LINEAGE_B_SOURCE,
PATTERN_LINE,
PATTERN_NAME,
PATTERN_READ_SOURCE,
REGEX_FORMS_ADMITTED,
REGEX_FORMS_REFUSED,
lineage_a_manifest,
lineage_b_manifest,
variant,
with_pattern,
)
from native_t2va_fixtures import (
BENIGN,
MUTATIONS,
@@ -107,7 +119,11 @@ def test_production_entry_point_accepts_no_caller_table() -> None:
assert synthetic.admitted and not is_production_admission(synthetic)
production = classify_native_t2va_source(SYNTHETIC_SOURCE.encode("utf-8"))
assert not production.admitted
assert production.manifest_fingerprint == PRODUCTION_MANIFEST.fingerprint
# A source no production lineage admits reports the newest lineage's refusal, so the verdict
# carries that production table's fingerprint and never the caller's.
assert production.manifest_fingerprint == structure.PRODUCTION_LINEAGES[-1].fingerprint
assert production.manifest_fingerprint in structure.PRODUCTION_FINGERPRINTS
assert production.manifest_fingerprint != synthetic_manifest().fingerprint
with pytest.raises(TypeError):
classify_native_t2va_source( # type: ignore[call-arg]
SYNTHETIC_SOURCE.encode("utf-8"), synthetic_manifest()
@@ -336,6 +352,178 @@ def test_derivation_refuses_an_open_closure_or_a_missing_definition() -> None:
)
def _classify_b(source: str) -> NativeT2VAStructureVerdict:
return structure._classify(source.encode("utf-8"), lineage_b_manifest())
@pytest.mark.parametrize("name", sorted(REGEX_FORMS_ADMITTED))
def test_closed_regex_assignment_form_is_admitted_in_every_shape(name: str) -> None:
verdict = _classify_b(with_pattern(REGEX_FORMS_ADMITTED[name]))
assert (verdict.reason, verdict.check) == (StructureReason.ADMITTED, "admitted")
@pytest.mark.parametrize("name", sorted(REGEX_FORMS_REFUSED))
def test_every_other_assignment_stays_refused_and_names_its_guard(name: str) -> None:
pairs, check = REGEX_FORMS_REFUSED[name]
verdict = _classify_b(variant(LINEAGE_B_SOURCE, *pairs))
assert verdict.reason is StructureReason.CHANGED
assert verdict.check == check
assert not verdict.admitted
def test_regex_form_refusals_carry_closed_identifiers_only() -> None:
manifest = lineage_b_manifest()
closed = (
{"envelope_" + suffix for suffix in ("assign", "class", "dunder", "duplicate", "function")}
| {"binding:" + name for name in manifest.protected_names()}
| {"constant:" + name for name, _digest in manifest.constants}
)
for pairs, _check in REGEX_FORMS_REFUSED.values():
assert _classify_b(variant(LINEAGE_B_SOURCE, *pairs)).check in closed
def test_lineage_b_shaped_source_is_admitted_only_by_its_own_manifest() -> None:
a, b = lineage_a_manifest(), lineage_b_manifest()
assert a.fingerprint != b.fingerprint
assert [name for name, _digest in b.definitions][3:5] == ["_av_latent", "_empty_av_latent"]
assert structure._classify(LINEAGE_B_SOURCE.encode(), b).admitted
refused = structure._classify(LINEAGE_B_SOURCE.encode(), a)
assert (refused.reason, refused.check) == (
StructureReason.CHANGED,
"definition:_empty_av_latent",
)
assert structure._classify(SYNTHETIC_SOURCE.encode(), a).admitted
def test_derivation_pins_a_regex_only_when_a_selected_definition_reads_it() -> None:
unread = lineage_b_manifest()
assert [name for name, _digest in unread.constants] == [
name for name, _digest in lineage_a_manifest().constants
]
read = lineage_b_manifest(PATTERN_READ_SOURCE)
assert PATTERN_NAME in [name for name, _digest in read.constants]
# An unread regular expression is not part of the audited surface: its text may change.
other = PATTERN_NAME + ' = re.compile("another")\n'
assert _classify_b(with_pattern(other)).admitted
# A read one is: a different pattern or a missing statement names the constant.
for source in (
variant(PATTERN_READ_SOURCE, (PATTERN_LINE, other)),
variant(PATTERN_READ_SOURCE, (PATTERN_LINE, "")),
):
verdict = structure._classify(source.encode(), read)
assert (verdict.reason, verdict.check) == (
StructureReason.CHANGED,
"constant:" + PATTERN_NAME,
)
assert structure._classify(PATTERN_READ_SOURCE.encode(), read).admitted
def test_derivation_drops_an_unread_pattern_only_when_the_envelope_would_admit_its_form() -> None:
# `re` is bound by an aliased import here, so the statement is not the closed form: derivation
# must keep it pinned (as it keeps every other unrecognised constant) instead of dropping it,
# and no manifest admits the source because the envelope refuses the statement itself.
aliased = variant(LINEAGE_B_SOURCE, ("import re\n", "import re as r\n"))
manifest = lineage_b_manifest(aliased)
assert PATTERN_NAME in [name for name, _digest in manifest.constants]
verdict = structure._classify(aliased.encode(), manifest)
assert (verdict.reason, verdict.check) == (StructureReason.CHANGED, "envelope_assign")
def test_an_empty_lineage_list_is_an_error_never_a_refusal() -> None:
with pytest.raises(ValueError):
structure.classify_lineages(SYNTHETIC_SOURCE.encode(), (), structure._classify)
def test_lineages_are_tried_in_order_and_the_first_admission_wins() -> None:
a, b = lineage_a_manifest(), lineage_b_manifest()
for order in ((a, b), (b, a)):
older = structure.classify_lineages(SYNTHETIC_SOURCE.encode(), order, structure._classify)
newer = structure.classify_lineages(LINEAGE_B_SOURCE.encode(), order, structure._classify)
assert older.admitted and older.manifest_fingerprint == a.fingerprint
assert newer.admitted and newer.manifest_fingerprint == b.fingerprint
def test_a_source_no_lineage_admits_reports_the_newest_lineages_refusal() -> None:
a, b = lineage_a_manifest(), lineage_b_manifest()
def refused(source: str) -> NativeT2VAStructureVerdict:
return structure.classify_lineages(source.encode(), (a, b), structure._classify)
helper = refused(variant(LINEAGE_B_SOURCE, ("[1, 16, video,", "[1, 32, video,")))
wrapper = refused(
variant(
LINEAGE_B_SOURCE,
(
"_av_latent(width, height, video, audio)\n",
"_av_latent(height, width, video, audio)\n",
),
)
)
for verdict, check in (
(helper, "definition:_av_latent"),
(wrapper, "definition:_empty_av_latent"),
):
assert not verdict.admitted
assert (verdict.reason, verdict.check) == (StructureReason.CHANGED, check)
assert verdict.manifest_fingerprint == b.fingerprint
changed = refused(mutate(SYNTHETIC_SOURCE, "FPS = 24\n", "FPS = 30\n"))
assert not changed.admitted and changed.manifest_fingerprint == b.fingerprint
def test_production_lineages_are_a_closed_tuple_led_by_the_unchanged_manifest() -> None:
lineages = structure.PRODUCTION_LINEAGES
assert type(lineages) is tuple and lineages
assert lineages[0] is PRODUCTION_MANIFEST
assert lineages[0].fingerprint == PRODUCTION_MANIFEST_FINGERPRINT
assert all(type(item) is type(PRODUCTION_MANIFEST) for item in lineages)
assert type(structure.PRODUCTION_FINGERPRINTS) is frozenset
assert structure.PRODUCTION_FINGERPRINTS == {item.fingerprint for item in lineages}
assert len(structure.PRODUCTION_FINGERPRINTS) == len(lineages)
def test_production_admission_is_membership_in_the_closed_fingerprint_set(
monkeypatch: pytest.MonkeyPatch,
) -> None:
a, b = lineage_a_manifest(), lineage_b_manifest()
verdict_b = structure._classify(LINEAGE_B_SOURCE.encode(), b)
# A synthetic manifest's verdict is never a production admission.
assert verdict_b.admitted and not is_production_admission(verdict_b)
monkeypatch.setattr(
structure, "PRODUCTION_FINGERPRINTS", frozenset({a.fingerprint, b.fingerprint})
)
assert is_production_admission(verdict_b)
assert not is_production_admission(
NativeT2VAStructureVerdict(StructureReason.CHANGED, "definition:FPS", b.fingerprint)
)
assert not is_production_admission(
NativeT2VAStructureVerdict(
StructureReason.ADMITTED, "admitted", b.fingerprint, classifier_schema="other"
)
)
assert not is_production_admission(
NativeT2VAStructureVerdict(StructureReason.ADMITTED, "admitted", "sha256:" + "0" * 64)
)
# A forged verdict type, and any caller-supplied table, cannot stand in for the real thing.
assert not is_production_admission({"manifest_fingerprint": b.fingerprint})
assert list(inspect.signature(is_production_admission).parameters) == ["verdict"]
def test_production_entry_point_tries_the_production_lineages_in_order(
monkeypatch: pytest.MonkeyPatch,
) -> None:
a, b = lineage_a_manifest(), lineage_b_manifest()
monkeypatch.setattr(structure, "PRODUCTION_LINEAGES", (a, b))
monkeypatch.setattr(
structure, "PRODUCTION_FINGERPRINTS", frozenset({a.fingerprint, b.fingerprint})
)
for source, manifest in ((SYNTHETIC_SOURCE, a), (LINEAGE_B_SOURCE, b)):
verdict = classify_native_t2va_source(source.encode())
assert verdict.admitted and verdict.manifest_fingerprint == manifest.fingerprint
assert is_production_admission(verdict)
unrelated = classify_native_t2va_source(b"x = 1\n")
assert not unrelated.admitted and unrelated.manifest_fingerprint == b.fingerprint
def test_parity_report_is_pinned_for_the_cross_interpreter_probe() -> None:
# P09/P32: the probe prints this digest under the host interpreter; equality is the parity.
report = parity_report()
+2 -2
View File
@@ -19,9 +19,9 @@ ROOT = Path(__file__).resolve().parents[1]
# IMPORTANT: move this pin only with the rebuilt bundle and supply-chain manifest; otherwise HEAD
# fails its own deterministic runtime-parity contract.
RUNTIME_BUNDLE_SHA256 = (
"eb9a7de0179525f6d5fbe2229f5135d4c365b6da2898a3fb6ea8557cda655460" # pragma: allowlist secret
"3ceff7b6ed79f4300945eae369f4f4d70026bb2682e550566e714f0de81e91c3" # pragma: allowlist secret
)
RUNTIME_BUNDLE_SIZE = 3932886
RUNTIME_BUNDLE_SIZE = 3933669
def supply_chain() -> ModuleType: