feat(lab): seal reusable EoMT runtime trees
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
|
||||
SEALER_PATH = (
|
||||
REPOSITORY_ROOT
|
||||
/ "experiments"
|
||||
/ "perception"
|
||||
/ "worker"
|
||||
/ "observatory_portable"
|
||||
/ "Seal-LabV1EomtTreeAssets.ps1"
|
||||
)
|
||||
|
||||
|
||||
def test_eomt_tree_sealer_is_local_fixed_and_adapter_compatible() -> None:
|
||||
script = SEALER_PATH.read_text(encoding="utf-8")
|
||||
|
||||
assert '"missioncore.sealed-tree-runtime/v1"' in script
|
||||
assert '"relative-path-tab-size-tab-file-sha256-lf/v1"' in script
|
||||
assert '"tree-manifest.tsv"' in script
|
||||
assert '"tree-receipt.json"' in script
|
||||
assert '"D:\\NDC_MISSIONCORE\\runtime"' in script
|
||||
assert '"derived\\perception-e3-opencv413092-v1"' in script
|
||||
assert '"cache\\perception-e3-models-v1"' in script
|
||||
assert '"derived\\perception-p0-env-v1"' in script
|
||||
assert '"derived\\perception-p0-transformers4576-v1"' in script
|
||||
assert '$Utf8.GetByteCount($component) -gt 255' in script
|
||||
assert "$Utf8.GetByteCount($RelativePath) -gt 4096" in script
|
||||
assert "$components.Count -gt 256" in script
|
||||
assert "[\\p{Cc}<>:" in script
|
||||
assert "$SafeComponentPattern" not in script
|
||||
|
||||
lowered = script.lower()
|
||||
assert "docker " not in lowered
|
||||
assert "ssh " not in lowered
|
||||
assert "invoke-webrequest" not in lowered
|
||||
assert "start-bitstransfer" not in lowered
|
||||
assert "smb" not in lowered
|
||||
|
||||
|
||||
def test_eomt_tree_sealer_has_atomic_commit_marker_and_no_rehash_fast_path() -> None:
|
||||
script = SEALER_PATH.read_text(encoding="utf-8")
|
||||
|
||||
fast_path = script.split("function Test-ExistingSeal", maxsplit=1)[1].split(
|
||||
"function New-SealedReceipt", maxsplit=1
|
||||
)[0]
|
||||
assert "-HashPayload:$false" in fast_path
|
||||
assert "-HashPayload:$true" not in fast_path
|
||||
assert "Get-FileDigest" not in fast_path
|
||||
|
||||
publish = script.split("$manifestPath = Join-Path $Root $ManifestName", maxsplit=1)[1]
|
||||
manifest_move = publish.index("[IO.File]::Move($stagedManifest, $manifestPath)")
|
||||
receipt_move = publish.index("[IO.File]::Move($stagedReceipt, $receiptPath)")
|
||||
assert manifest_move < receipt_move
|
||||
assert "The receipt is the commit marker and is always published last" in publish
|
||||
assert "$relative -eq $ManifestName -or $relative -eq $ReceiptName" in script
|
||||
assert "New-Object Text.UTF8Encoding($false, $true)" in script
|
||||
assert "[StringComparer]::Ordinal.Compare" in script
|
||||
Reference in New Issue
Block a user