junidude14 commited on
Commit
21cb8ff
·
verified ·
1 Parent(s): d8d44e1

Archive 4 checkpoints (1-4)

Browse files
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/10/SOURCE_REUSE.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "pbisc.strictpairs.source-reuse.v1",
3
+ "at": "2026-10-12T14:30:10.806533+00:00",
4
+ "transitions": [
5
+ {
6
+ "operation": "immicro-healthy-fold0-n5-train",
7
+ "old_signature": "2ca886713c69144fd1ef558468dbeba98e7f9840c0fe183f683af69e065b14e2",
8
+ "new_signature": "ab97afdd574f8ec532dfade4e716e9ddfccf68dc732848f35932a6f8c15561d8",
9
+ "original_receipt": {
10
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-train.json",
11
+ "sha256": "a5adc14fe5a2bce4f9aaaaae6a3cfa087e13f91ba8bf7972eb937f1508cf3714"
12
+ },
13
+ "evidence": [
14
+ {
15
+ "name": "old-source-reproduction",
16
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-train-proof.json",
17
+ "sha256": "32fad796b963affb2e3fcdf1248f22804b0c595678305846477c02e47636c16c"
18
+ },
19
+ {
20
+ "name": "isolated-replay",
21
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold0/n5/REPLAY.json",
22
+ "sha256": "bdb8576d6558943f4886c3fe063445a129a4c2c04a3adb8d11bfb869f04c8c82"
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "operation": "immicro-healthy-fold0-n5-scinputs",
28
+ "old_signature": "a77b1b0a1f3a649d1330526615e7ad0c31da2fa815a773e584d9e3e34bf15e0e",
29
+ "new_signature": "d339898c4f2fc662561acc03749f380e14d0df82dd5b54108f60581c54e312ce",
30
+ "original_receipt": {
31
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-scinputs.json",
32
+ "sha256": "2888679e086cfd188852113c98c28fba592220a109223c78fba5cf56392a3b8c"
33
+ },
34
+ "evidence": [
35
+ {
36
+ "name": "old-source-reproduction",
37
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-scinputs-proof.json",
38
+ "sha256": "678c157b9f907b853276212437b95854bc5dfee5a58a29096c8df4c8d0bbb8ca"
39
+ },
40
+ {
41
+ "name": "isolated-replay",
42
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold0/n5/REPLAY.json",
43
+ "sha256": "bdb8576d6558943f4886c3fe063445a129a4c2c04a3adb8d11bfb869f04c8c82"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "operation": "immicro-healthy-fold1-n5-train",
49
+ "old_signature": "1f82de5256dadba1d66d0756684eac3d4373329abe9606684ebb9036cd42618f",
50
+ "new_signature": "6b102fb7edbdafd80b61c231398bf40bfbf6bec4420c148a9e265b1064a45263",
51
+ "original_receipt": {
52
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-train.json",
53
+ "sha256": "752d2bf7c1ed36ee224cf8d4ec4a5c36f3ec3258fc0d044c377d151886403b48"
54
+ },
55
+ "evidence": [
56
+ {
57
+ "name": "old-source-reproduction",
58
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-train-proof.json",
59
+ "sha256": "abc5c91549a18877b3dc9569d67aad489310c4c618c83f4e7dc8f337566e042e"
60
+ },
61
+ {
62
+ "name": "isolated-replay",
63
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold1/n5/REPLAY.json",
64
+ "sha256": "baa4653814d2a151ab0f55830e57b4a6a30d47edcecebaefb727c968cb495609"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "operation": "immicro-healthy-fold1-n5-scinputs",
70
+ "old_signature": "4938632fc0e7110fcd4ee952b42a0c3479d43243d4310527c954eeb42238ca49",
71
+ "new_signature": "64fc2195127f1e90ad286e2198a8fefcb821a7c4f284cb2b520c060d37ca006d",
72
+ "original_receipt": {
73
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-scinputs.json",
74
+ "sha256": "feeeef8b6e7a120c879344084e58b646f2c590b693895dba0313d0fadb5cd278"
75
+ },
76
+ "evidence": [
77
+ {
78
+ "name": "old-source-reproduction",
79
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-scinputs-proof.json",
80
+ "sha256": "482e5417167f4f67b0bc00d4ed1cc1972fa4602757b700767cd1d881485e89e0"
81
+ },
82
+ {
83
+ "name": "isolated-replay",
84
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold1/n5/REPLAY.json",
85
+ "sha256": "baa4653814d2a151ab0f55830e57b4a6a30d47edcecebaefb727c968cb495609"
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ }
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/11/REMOTE_SOURCE_VERIFICATION.json ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "host": "server_2",
3
+ "source_host": "server_1",
4
+ "checks": [
5
+ {
6
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/runs/f01_6k_1x_seed20260627/checkpoint_epoch_016.pt",
7
+ "expected": "8c7cd0e83e2bc19fe03dfcbc084919a1e2f61be8cc8bc12f4caf543dfda91633",
8
+ "actual": "8c7cd0e83e2bc19fe03dfcbc084919a1e2f61be8cc8bc12f4caf543dfda91633",
9
+ "match": true
10
+ },
11
+ {
12
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/scripts/sample_sdd_standalone.py",
13
+ "expected": "95ace096cdc58a9ca92a18af649c60fe6ac0a55e97f977e7ab9bcb04efa968cb",
14
+ "actual": "95ace096cdc58a9ca92a18af649c60fe6ac0a55e97f977e7ab9bcb04efa968cb",
15
+ "match": true
16
+ },
17
+ {
18
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/__init__.py",
19
+ "expected": "46c7212b637e67f2b44b616fef47f964a284b576ba56c372f71463ce46ea24ee",
20
+ "actual": "46c7212b637e67f2b44b616fef47f964a284b576ba56c372f71463ce46ea24ee",
21
+ "match": true
22
+ },
23
+ {
24
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/data.py",
25
+ "expected": "0d959a35175549a263e1b23c2709bfe2699dc293141d5699f01cf70cd7a0ba73",
26
+ "actual": "0d959a35175549a263e1b23c2709bfe2699dc293141d5699f01cf70cd7a0ba73",
27
+ "match": true
28
+ },
29
+ {
30
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/diffusion.py",
31
+ "expected": "ed97ca9fe56b9328da9ee455d4fbfc4b5102dfcf4f2364363bb715d19610429f",
32
+ "actual": "ed97ca9fe56b9328da9ee455d4fbfc4b5102dfcf4f2364363bb715d19610429f",
33
+ "match": true
34
+ },
35
+ {
36
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/ema.py",
37
+ "expected": "dcc982725b7f94986b4b13b782c7a587b9efcf06d4fd444e9bf51bca051940c1",
38
+ "actual": "dcc982725b7f94986b4b13b782c7a587b9efcf06d4fd444e9bf51bca051940c1",
39
+ "match": true
40
+ },
41
+ {
42
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/experiment.py",
43
+ "expected": "5e4f6169410fa165e5b1c39391ab731c38c32b7d3202618da326b2f82131e6de",
44
+ "actual": "5e4f6169410fa165e5b1c39391ab731c38c32b7d3202618da326b2f82131e6de",
45
+ "match": true
46
+ },
47
+ {
48
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/fast_rows.py",
49
+ "expected": "83cb181499903d20d5aeb58a3e978af5cf132751057561d12f5920ce23378c60",
50
+ "actual": "83cb181499903d20d5aeb58a3e978af5cf132751057561d12f5920ce23378c60",
51
+ "match": true
52
+ },
53
+ {
54
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/gene_selection.py",
55
+ "expected": "6818525e212b2192e40e7b9f5f879e29f644c17a099aa09a6ab2adb66f1b7e7d",
56
+ "actual": "6818525e212b2192e40e7b9f5f879e29f644c17a099aa09a6ab2adb66f1b7e7d",
57
+ "match": true
58
+ },
59
+ {
60
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/ladder_experiment.py",
61
+ "expected": "872bf059e14f0042eec64d290cb84685dafd9705ae364125462d1d8e06e14314",
62
+ "actual": "872bf059e14f0042eec64d290cb84685dafd9705ae364125462d1d8e06e14314",
63
+ "match": true
64
+ },
65
+ {
66
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/model.py",
67
+ "expected": "c3d725b97d003b9b2fb45d5061d5f7daffe89fd37147f9d53753b3ed2da77ffa",
68
+ "actual": "c3d725b97d003b9b2fb45d5061d5f7daffe89fd37147f9d53753b3ed2da77ffa",
69
+ "match": true
70
+ },
71
+ {
72
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/panel_ladder.py",
73
+ "expected": "45116a496e1f38247dfdaa3d306ab54aa28e13736754dbe9dd75eaa5dc7d518f",
74
+ "actual": "45116a496e1f38247dfdaa3d306ab54aa28e13736754dbe9dd75eaa5dc7d518f",
75
+ "match": true
76
+ },
77
+ {
78
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/src/pbisc_sdd/proportion_hint.py",
79
+ "expected": "7a352d73728e78c9d262e29c35628d2437af0bc7743b88c077ba81d911dd2a52",
80
+ "actual": "7a352d73728e78c9d262e29c35628d2437af0bc7743b88c077ba81d911dd2a52",
81
+ "match": true
82
+ },
83
+ {
84
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/data/immicro/features.npz",
85
+ "expected": "735255066ce7ebbac13a1fdfd058e26f31edd60314cc02fd589b0a292dbbc838",
86
+ "actual": "735255066ce7ebbac13a1fdfd058e26f31edd60314cc02fd589b0a292dbbc838",
87
+ "match": true
88
+ },
89
+ {
90
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/data/immicro/cells_panel6k.npz",
91
+ "expected": "e1168468b621183604038b79280f46961c5819fe2386d9da0b454f7db642742a",
92
+ "actual": "e1168468b621183604038b79280f46961c5819fe2386d9da0b454f7db642742a",
93
+ "match": true
94
+ },
95
+ {
96
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/data/immicro/conditions_raw_fixed.npz",
97
+ "expected": "2be5717d19e86bdf38e4838d4bd2886a211ba78bfbfe749c458305a3e0ac2dcc",
98
+ "actual": "2be5717d19e86bdf38e4838d4bd2886a211ba78bfbfe749c458305a3e0ac2dcc",
99
+ "match": true
100
+ },
101
+ {
102
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/data/immicro/samples.csv",
103
+ "expected": "9e1e370519910b57528902d7e119a4f5f369f1610779d2bfa1d0ce958953d744",
104
+ "actual": "9e1e370519910b57528902d7e119a4f5f369f1610779d2bfa1d0ce958953d744",
105
+ "match": true
106
+ },
107
+ {
108
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/data/immicro/folds.csv",
109
+ "expected": "0adc10f4ac973e5b7558effbea0fd6950a6bf59e5af1d3a376e12eb00bf6a643",
110
+ "actual": "0adc10f4ac973e5b7558effbea0fd6950a6bf59e5af1d3a376e12eb00bf6a643",
111
+ "match": true
112
+ },
113
+ {
114
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/scsemi/tools/run_scsemi_paired.py",
115
+ "expected": "24d36efb13500e9d555bcdf19976dea575f9710fd0a25c68fae836f51723fc7f",
116
+ "actual": "24d36efb13500e9d555bcdf19976dea575f9710fd0a25c68fae836f51723fc7f",
117
+ "match": true
118
+ },
119
+ {
120
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/scsemi/tools/lean_hvset.py",
121
+ "expected": "3783f6e9728c3ecdb41ec6068f15bc9bf44ff5fc25644ca0e8734c1981486e86",
122
+ "actual": "3783f6e9728c3ecdb41ec6068f15bc9bf44ff5fc25644ca0e8734c1981486e86",
123
+ "match": true
124
+ },
125
+ {
126
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/scsemi/tools/lean_cellgraph.py",
127
+ "expected": "0de823e4475786fcd86c0fb83302182ffebafe00a1dad44cdcccc99938430230",
128
+ "actual": "0de823e4475786fcd86c0fb83302182ffebafe00a1dad44cdcccc99938430230",
129
+ "match": true
130
+ },
131
+ {
132
+ "path": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/scsemi/tools/validate_export.py",
133
+ "expected": "48687cd59bbd3cbba9e07d56a01116a6d9ab46e5a8fb02d9b616cab873ab0f4a",
134
+ "actual": "48687cd59bbd3cbba9e07d56a01116a6d9ab46e5a8fb02d9b616cab873ab0f4a",
135
+ "match": true
136
+ }
137
+ ],
138
+ "all_match": true
139
+ }
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/8/test_two_host_resume.py ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import importlib.util
3
+ import json
4
+ from pathlib import Path
5
+ import sys
6
+ import tempfile
7
+ import unittest
8
+ from unittest.mock import Mock
9
+
10
+ ROOT = Path(__file__).resolve().parents[1]
11
+ sys.path.insert(0, str(ROOT / "tools"))
12
+
13
+
14
+ class TwoHostTests(unittest.TestCase):
15
+ def setUp(self):
16
+ spec = importlib.util.spec_from_file_location("two_host_resume", ROOT / "tools/two_host_resume.py")
17
+ self.mod = importlib.util.module_from_spec(spec)
18
+ spec.loader.exec_module(self.mod)
19
+
20
+ def test_partition_covers_exactly_authorized_units(self):
21
+ names = [f"unit-{i}" for i in range(40)]
22
+ self.mod.verify_partition(names, names[:28], names[28:])
23
+ for local, remote in ((names[:28], names[27:]), (names[:27], names[28:]),
24
+ (names[:28] + [names[0]], names[28:]),
25
+ (names[:28], names[28:-1] + ["outside"]), ([], names)):
26
+ with self.subTest(local=local, remote=remote):
27
+ with self.assertRaises(ValueError):
28
+ self.mod.verify_partition(names, local, remote)
29
+
30
+ def fixture(self, directory):
31
+ root = Path(directory)
32
+ unit = "immicro-healthy-fold2-n5"
33
+ relative = Path("immicro/healthy/fold2/n5")
34
+ support = root / "protocol/splits" / relative / "support.json"
35
+ support.parent.mkdir(parents=True)
36
+ support.write_text(json.dumps({"sha256": "support-hash"}))
37
+ output = root / "generated" / relative / "lora.npz"
38
+ output.parent.mkdir(parents=True)
39
+ output.write_bytes(b"immutable-scientific-output")
40
+ imported = root / "recoveries/two_host/imported" / unit
41
+ (imported / "receipts").mkdir(parents=True)
42
+ (imported / "unit_status").mkdir()
43
+ marker = {"stage": "compute", "state": "completed", "support_sha256": "support-hash"}
44
+ marker_path = imported / "unit_status" / f"{unit}.json"
45
+ marker_path.write_text(json.dumps(marker))
46
+ raw = {"state": "completed", "signature": "canonical-signature",
47
+ "outputs": [{"path": str(output), "bytes": output.stat().st_size,
48
+ "mtime_ns": 3, "sha256": self.mod.sha256(output)}]}
49
+ for suffix in self.mod.REQUIRED_RECEIPTS:
50
+ (imported / "receipts" / f"{unit}-{suffix}.json").write_text(json.dumps(raw))
51
+ files = []
52
+ for file in [output, marker_path, *sorted((imported / "receipts").glob("*.json"))]:
53
+ rel = file.relative_to(imported if file.is_relative_to(imported) else root)
54
+ files.append({"path": str(rel), "bytes": file.stat().st_size, "sha256": self.mod.sha256(file)})
55
+ snapshot = {"schema": "pbisc.two-host.snapshot.v1", "unit": unit,
56
+ "relative": str(relative), "root": str(root), "source_host": "server_2",
57
+ "hostname": "spark-0110", "support_sha256": "support-hash",
58
+ "support_file_sha256": self.mod.sha256(support), "marker": marker,
59
+ "files": files, "directories": [str(Path("generated") / relative)]}
60
+ self.mod.write_once_json(imported / "source_snapshot.json", snapshot)
61
+ return root, unit, output, imported, snapshot
62
+
63
+ def test_import_preserves_raw_provenance_and_signature(self):
64
+ with tempfile.TemporaryDirectory() as td:
65
+ root, unit, output, imported, snapshot = self.fixture(td)
66
+ raw_path = imported / "receipts" / f"{unit}-train.json"
67
+ raw_bytes = raw_path.read_bytes()
68
+ self.mod.publish_import(root, unit, snapshot, imported)
69
+ record = json.loads((root / "receipts" / raw_path.name).read_text())
70
+ self.assertEqual(raw_path.read_bytes(), raw_bytes)
71
+ self.assertEqual(record["signature"], "canonical-signature")
72
+ self.assertEqual(record["outputs"][0]["mtime_ns"], output.stat().st_mtime_ns)
73
+ self.assertEqual(record["remote_provenance"]["source_host"], "server_2")
74
+ self.assertEqual(record["remote_provenance"]["raw_receipt_sha256"], self.mod.sha256(raw_path))
75
+ self.assertEqual(record["remote_provenance"]["hostname"], "spark-0110")
76
+ self.mod.verify_import(root, unit, imported)
77
+ self.mod.publish_import(root, unit, snapshot, imported)
78
+
79
+ def test_output_tamper_rejected_before_any_receipt_publish(self):
80
+ with tempfile.TemporaryDirectory() as td:
81
+ root, unit, output, imported, snapshot = self.fixture(td)
82
+ output.write_bytes(b"tampered")
83
+ with self.assertRaises(self.mod.ReceiptError):
84
+ self.mod.publish_import(root, unit, snapshot, imported)
85
+ self.assertFalse((root / "receipts").exists())
86
+ self.assertEqual(output.read_bytes(), b"tampered")
87
+
88
+ def test_post_import_output_tamper_rejected(self):
89
+ with tempfile.TemporaryDirectory() as td:
90
+ root, unit, output, imported, snapshot = self.fixture(td)
91
+ self.mod.publish_import(root, unit, snapshot, imported)
92
+ output.write_bytes(b"tampered")
93
+ with self.assertRaises(self.mod.ReceiptError):
94
+ self.mod.verify_import(root, unit, imported)
95
+
96
+ def test_conflicting_existing_receipt_preserved(self):
97
+ with tempfile.TemporaryDirectory() as td:
98
+ root, unit, _, imported, snapshot = self.fixture(td)
99
+ existing = root / "receipts" / f"{unit}-train.json"
100
+ existing.parent.mkdir()
101
+ existing.write_bytes(b'{"state":"failed"}')
102
+ with self.assertRaises(self.mod.ReceiptError):
103
+ self.mod.publish_import(root, unit, snapshot, imported)
104
+ self.assertEqual(existing.read_bytes(), b'{"state":"failed"}')
105
+ self.assertFalse((imported / "IMPORTED.json").exists())
106
+
107
+ def test_raw_remote_receipt_tamper_rejected(self):
108
+ with tempfile.TemporaryDirectory() as td:
109
+ root, unit, _, imported, snapshot = self.fixture(td)
110
+ self.mod.publish_import(root, unit, snapshot, imported)
111
+ raw = imported / "receipts" / f"{unit}-train.json"
112
+ record = json.loads(raw.read_text())
113
+ record["signature"] = "altered"
114
+ raw.write_text(json.dumps(record))
115
+ with self.assertRaises(self.mod.ReceiptError):
116
+ self.mod.verify_import(root, unit, imported)
117
+
118
+ def test_normalized_receipt_tamper_rejected(self):
119
+ with tempfile.TemporaryDirectory() as td:
120
+ root, unit, _, imported, snapshot = self.fixture(td)
121
+ self.mod.publish_import(root, unit, snapshot, imported)
122
+ path = root / "receipts" / f"{unit}-train.json"
123
+ record = json.loads(path.read_text())
124
+ record["remote_provenance"]["raw_receipt_sha256"] = "0" * 64
125
+ path.write_text(json.dumps(record))
126
+ with self.assertRaises(self.mod.ReceiptError):
127
+ self.mod.verify_import(root, unit, imported)
128
+
129
+ def test_failed_and_missing_previous_services_never_restart(self):
130
+ for properties in ({"LoadState": "not-found"},
131
+ {"LoadState": "loaded", "ActiveState": "failed", "Result": "exit-code",
132
+ "Description": "PBISC strict two-host binding local"}):
133
+ controller = self.mod.Controller.__new__(self.mod.Controller)
134
+ controller.config = {"service_prefix": "test"}
135
+ controller.config_hash = "binding"
136
+ controller.state = {"services": {"local": {"state": "launch_intent"}}}
137
+ controller.properties = Mock(return_value=properties)
138
+ controller.command = Mock()
139
+ controller.save = Mock()
140
+ with self.assertRaises(self.mod.ReceiptError):
141
+ controller.ensure_service("local", ["python", "campaign.py"])
142
+ controller.command.assert_not_called()
143
+
144
+ def test_snapshot_rejects_other_unit_paths(self):
145
+ with tempfile.TemporaryDirectory() as td:
146
+ root, unit, _, imported, snapshot = self.fixture(td)
147
+ corrupt = copy.deepcopy(snapshot)
148
+ corrupt["files"][0]["path"] = "generated/other/secret.npz"
149
+ with self.assertRaises(self.mod.ReceiptError):
150
+ self.mod.publish_import(root, unit, corrupt, imported)
151
+
152
+ def test_service_success_requires_zero_exit_and_retained_completion(self):
153
+ success = {"LoadState": "loaded", "ActiveState": "active", "SubState": "exited",
154
+ "Result": "success", "ExecMainStatus": "0", "ExecMainCode": "1"}
155
+ self.assertEqual(self.mod.service_phase(success), "completed")
156
+ self.assertEqual(self.mod.service_phase({**success, "ActiveState": "failed", "Result": "exit-code"}), "failed")
157
+ self.assertEqual(self.mod.service_phase({**success, "ExecMainStatus": "2"}), "failed")
158
+ self.assertEqual(self.mod.service_phase({"LoadState": "not-found"}), "missing")
159
+
160
+ def test_controller_launch_is_bounded_without_outer_gpu_lock(self):
161
+ argv = self.mod.service_command("pbisc-test", ["/python", "campaign.py", "run"],
162
+ ROOT, ROOT / "recovery.log", "binding")
163
+ self.assertNotIn("ml-run", " ".join(argv))
164
+ for value in ("--slice=app.slice", "MemoryMax=2G", "MemorySwapMax=0", "OOMPolicy=kill",
165
+ "OOMScoreAdjust=500", "Restart=no", "RemainAfterExit=yes", "CUDA_VISIBLE_DEVICES="):
166
+ self.assertIn(value, argv)
167
+
168
+
169
+ if __name__ == "__main__":
170
+ unittest.main()
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/9/rebind_sources_20261012.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Explicitly attest unchanged historical support computations after input isolation.
2
+
3
+ Original receipts and source bytes remain immutable. This does not reclassify
4
+ historical full-array loading as physically isolated access.
5
+ """
6
+ from pathlib import Path
7
+ import hashlib
8
+ import json
9
+ import shutil
10
+ import sys
11
+
12
+ ROOT = Path(__file__).resolve().parents[1]
13
+ sys.path.insert(0, str(ROOT / "tools"))
14
+ import campaign as C
15
+ from runtime import Runtime, atomic_json, sha256, stamp
16
+
17
+
18
+ def main():
19
+ destination = ROOT / "recoveries/source_reuse_20261012"
20
+ destination.mkdir(exist_ok=True)
21
+ backups = json.loads((ROOT / "backups/recovery_input_isolation_20261012T142024Z/MANIFEST.json").read_text())
22
+ lookup = {x["source"]: x for x in backups}
23
+ for item in backups:
24
+ assert sha256(Path(item["backup"])) == item["sha256"]
25
+ cache = {}
26
+
27
+ def digest(path):
28
+ path = str(Path(path).resolve())
29
+ if path not in cache:
30
+ cache[path] = sha256(Path(path))
31
+ return cache[path]
32
+
33
+ def old_signature(argv, inputs):
34
+ rows = [{"path": str(p.resolve()), "sha256": lookup[str(p.resolve())]["sha256"]
35
+ if str(p.resolve()) in lookup else digest(p)} for p in inputs]
36
+ return hashlib.sha256(json.dumps({"argv": argv, "inputs": rows}, sort_keys=True).encode()).hexdigest()
37
+
38
+ runtime = Runtime(ROOT)
39
+ transitions = []
40
+ for fold in ("fold0", "fold1"):
41
+ support = ROOT / "protocol/splits/immicro/healthy" / fold / "n5/support.json"
42
+ replay = ROOT / "isolated/immicro/healthy" / fold / "n5/REPLAY.json"
43
+ evidence = json.loads(replay.read_text())
44
+ assert evidence["all_selected_values_exact"] and evidence["training_draws_exact"]
45
+ assert evidence["support_sha256"] == C.read_support(support)["sha256"]
46
+ prepare = C.OLD / "scsemi/tools/prepare_draw_inputs.py"
47
+ work = ROOT / "scsemi" / C.relative(support)
48
+ commands = [("train", C.train_command(support), C.train_inputs(support)),
49
+ ("scinputs", [C.SC_PY, "-u", str(prepare), "--dataset", "immicro",
50
+ "--support-manifest", str(support), "--work", str(work)],
51
+ [support, prepare, ROOT / "tools/support_input_isolation.py"])]
52
+ for suffix, argv, inputs in commands:
53
+ name = f"{C.name(support)}-{suffix}"
54
+ receipt_path = runtime.receipt_path(name)
55
+ receipt = json.loads(receipt_path.read_text())
56
+ assert receipt["state"] == "completed"
57
+ prior_inputs = [p for p in inputs if p.name != "support_input_isolation.py"]
58
+ reproduced = old_signature(argv, prior_inputs)
59
+ assert reproduced == receipt["signature"], f"old source binding cannot be reproduced: {name}"
60
+ outputs = [Path(x["path"]) for x in receipt["outputs"]]
61
+ assert runtime.can_skip(name, reproduced, outputs)
62
+ preserved = destination / receipt_path.name
63
+ if preserved.exists():
64
+ assert preserved.read_bytes() == receipt_path.read_bytes()
65
+ else:
66
+ shutil.copy2(receipt_path, preserved)
67
+ proof = destination / f"{name}-proof.json"
68
+ new_signature = runtime.signature(argv, inputs)
69
+ atomic_json(proof, {"operation": name, "old_signature_reproduced": reproduced,
70
+ "new_signature": new_signature, "source_backups": backups,
71
+ "support_manifest_sha256": digest(support),
72
+ "selected_computation_replay": str(replay),
73
+ "outputs_unchanged": receipt["outputs"],
74
+ "limitation": "Original loaders materialized non-support arrays before selection. Reuse establishes selected-computation equivalence, not historical physical input isolation."})
75
+ transitions.append({"operation": name, "old_signature": reproduced,
76
+ "new_signature": new_signature,
77
+ "original_receipt": {"path": str(preserved), "sha256": sha256(preserved)},
78
+ "evidence": [{"name": "old-source-reproduction", "path": str(proof), "sha256": sha256(proof)},
79
+ {"name": "isolated-replay", "path": str(replay), "sha256": sha256(replay)}]})
80
+ manifest = ROOT / "recoveries/SOURCE_REUSE.json"
81
+ if manifest.exists():
82
+ raise FileExistsError("source reuse already recorded; do not replace evidence")
83
+ atomic_json(manifest, {"schema": "pbisc.strictpairs.source-reuse.v1", "at": stamp(), "transitions": transitions})
84
+ for item in transitions:
85
+ record = json.loads(runtime.receipt_path(item["operation"]).read_text())
86
+ assert runtime.can_skip(item["operation"], item["new_signature"], [Path(x["path"]) for x in record["outputs"]])
87
+ print(json.dumps({"verified_transitions": len(transitions), "manifest": str(manifest)}))
88
+
89
+
90
+ if __name__ == "__main__":
91
+ main()