Python 버전별 GZip 시험 생성 차이를 수정함
- 작성자
- 시로사키 하나
- 작성 시각
- 커밋
6eb499b9a4c33205ae4562c30879088e72a5252d- 부모
- f7fc8cb
변경된 파일 6개
+407-3| @@ -0,0 +1,3 @@ | ||
| 1 | 추가: fc7dd6d4bdc0d26553f7d44e545e799f5f2388ce4c9b21573ac3faf016fa9cd4 overlay.json | |
| 2 | 추가: ac7696f5dd7ae784ab0a59cc25f0f96794fbf0747bbd00a7419c801ce92a324c verify.py | |
| 3 | 추가: 8f3f5d2134f63739e3a4926d3ff9cd1f9c0f9a1ab3047ae38546cc4700c1cf59 static-validation.json |
| @@ -0,0 +1,84 @@ | ||
| 1 | 추가: { | |
| 2 | 추가: "schema": 1, | |
| 3 | 추가: "status": "source-static-only; Rust compile/run awaits fixed-head review", | |
| 4 | 추가: "branch": "features/python-gzip-fixture-compat", | |
| 5 | 추가: "base_head": "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc", | |
| 6 | 추가: "base_tree": "ab5574289f537a4028a3abf092e4634cb9b89282", | |
| 7 | 추가: "historical_sources": { | |
| 8 | 추가: "path": "tests/rust-integration-baseline/sources.json", | |
| 9 | 추가: "sha256": "d28874ea921a8027029f37bf35b64cb804c8e19345be893bc37a929d8b9dd932" | |
| 10 | 추가: }, | |
| 11 | 추가: "historical_metadata": [ | |
| 12 | 추가: { | |
| 13 | 추가: "path": "tests/rust-integration-baseline/sources.json", | |
| 14 | 추가: "mode": "100644", | |
| 15 | 추가: "type": "blob", | |
| 16 | 추가: "sha": "495e32eb6eb40a81d95935385b4c9bef01732692" | |
| 17 | 추가: }, | |
| 18 | 추가: { | |
| 19 | 추가: "path": "tests/rust-integration-baseline/run-plan.json", | |
| 20 | 추가: "mode": "100644", | |
| 21 | 추가: "type": "blob", | |
| 22 | 추가: "sha": "89eabfc1f19a402ab84666233a704e464288ec10" | |
| 23 | 추가: }, | |
| 24 | 추가: { | |
| 25 | 추가: "path": "tests/rust-integration-baseline/SHA256SUMS", | |
| 26 | 추가: "mode": "100644", | |
| 27 | 추가: "type": "blob", | |
| 28 | 추가: "sha": "e0e32c99b5401562a8abcc0a7ebe6335d82d8413" | |
| 29 | 추가: } | |
| 30 | 추가: ], | |
| 31 | 추가: "replacements": { | |
| 32 | 추가: "tests/rust-app-core-memory/generate_fixtures.py": { | |
| 33 | 추가: "before_git_blob": "9cffa6f45fa063fcc77d0b48796bb42a38e938a8", | |
| 34 | 추가: "before_sha256": "203566ae81a254f4006924b74a3433a18b465950e5f1c9acb69e807809643534", | |
| 35 | 추가: "after_git_blob": "f0e89ea50d7e6178a4e4f6d3e29e8af6c6f63640", | |
| 36 | 추가: "after_sha256": "a358a8480c9f3addfcf9ab7572f31858ce59828436a1765faa6e427cfb062e11" | |
| 37 | 추가: }, | |
| 38 | 추가: "tests/rust-app-core-memory/SHA256SUMS": { | |
| 39 | 추가: "before_git_blob": "d2545fab5e8472abe8a49f2ba491d02d9cf27278", | |
| 40 | 추가: "before_sha256": "9855466588a5a145c70d3db49ca0e372aeb20f0142520df318954b424884d95e", | |
| 41 | 추가: "after_git_blob": "278ee9a537cfe0777fb53f1227f95330dc6a1d04", | |
| 42 | 추가: "after_sha256": "0c8a155a9b14c886b3c46f002e35a6f795d7b5a815c8ea7ed87526d3574cff30" | |
| 43 | 추가: } | |
| 44 | 추가: }, | |
| 45 | 추가: "preservation": { | |
| 46 | 추가: "base_files": 305, | |
| 47 | 추가: "unchanged_base_files": 303, | |
| 48 | 추가: "all_rust_source_tests_unchanged": true, | |
| 49 | 추가: "fixtures_hex_json_unchanged": true, | |
| 50 | 추가: "native_static_check_unchanged": true, | |
| 51 | 추가: "historical_source_test_evidence_pins_unchanged": true, | |
| 52 | 추가: "no_check_removed_or_relaxed": true | |
| 53 | 추가: }, | |
| 54 | 추가: "generation": "Use stdlib GzipFile with empty filename, explicit mtime=0 and compression level=6; no header patching, expected byte changes, new dependency or raw encoder replacement.", | |
| 55 | 추가: "validation": "Compare full generated fixtures.hex and fixtures.json bytes against unchanged frozen originals on host Python3.14 and Ubuntu24 Python3.12; run the unchanged core static checker with the new core manifest hash. This is Python-only, not Rust execution.", | |
| 56 | 추가: "future_plan": { | |
| 57 | 추가: "historical_plan": "tests/rust-integration-baseline/run-plan.json", | |
| 58 | 추가: "overlay_application": "Materialize fixed base main then apply only these two replacements and this overlay directory; do not reinterpret historical pin files as the new candidate. Fix and verify the final PR head/tree separately before any Rust compile/run.", | |
| 59 | 추가: "headless_groups": [ | |
| 60 | 추가: 67, | |
| 61 | 추가: 11, | |
| 62 | 추가: 42, | |
| 63 | 추가: 150, | |
| 64 | 추가: 303, | |
| 65 | 추가: 31, | |
| 66 | 추가: 14, | |
| 67 | 추가: 72 | |
| 68 | 추가: ], | |
| 69 | 추가: "expected_total": 690, | |
| 70 | 추가: "test_names_and_expectations": "All eight original native contracts and Rust files unchanged", | |
| 71 | 추가: "first_failure_stop": true, | |
| 72 | 추가: "each_test_once_serially": true, | |
| 73 | 추가: "cargo_build_jobs": 1, | |
| 74 | 추가: "locked_offline": true, | |
| 75 | 추가: "rust_toolchain": "1.99.1", | |
| 76 | 추가: "no_host_targets_for_ubuntu24": true, | |
| 77 | 추가: "no_gui_worker_vm_or_real_data": true | |
| 78 | 추가: }, | |
| 79 | 추가: "limitations": [ | |
| 80 | 추가: "Empty filename/mtime/OS header policy is explicit; exact equality was checked only on the two recorded Python/zlib environments, not every future compressor version.", | |
| 81 | 추가: "No Rust type check/compile/discovery/runtime or Ubuntu24 kernel/desktop support claim.", | |
| 82 | 추가: "Previous static failures and all previous passed/failed execution records remain historical evidence." | |
| 83 | 추가: ] | |
| 84 | 추가: } |
| @@ -0,0 +1,196 @@ | ||
| 1 | 추가: { | |
| 2 | 추가: "schema": 1, | |
| 3 | 추가: "state": "python_static_checks_passed", | |
| 4 | 추가: "base_head": "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc", | |
| 5 | 추가: "base_tree": "ab5574289f537a4028a3abf092e4634cb9b89282", | |
| 6 | 추가: "modified_files": [ | |
| 7 | 추가: "tests/rust-app-core-memory/SHA256SUMS", | |
| 8 | 추가: "tests/rust-app-core-memory/generate_fixtures.py" | |
| 9 | 추가: ], | |
| 10 | 추가: "new_files": [ | |
| 11 | 추가: "tests/python-gzip-fixture-compat/overlay.json", | |
| 12 | 추가: "tests/python-gzip-fixture-compat/verify.py", | |
| 13 | 추가: "tests/python-gzip-fixture-compat/static-validation.json", | |
| 14 | 추가: "tests/python-gzip-fixture-compat/SHA256SUMS" | |
| 15 | 추가: ], | |
| 16 | 추가: "checks": [ | |
| 17 | 추가: { | |
| 18 | 추가: "environment": "host", | |
| 19 | 추가: "fixture_and_overlay_check": { | |
| 20 | 추가: "state": "passed", | |
| 21 | 추가: "scope": "Python-only fixture bytes/provenance and fixed overlay verification; no Rust compile/run", | |
| 22 | 추가: "base_head": "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc", | |
| 23 | 추가: "base_tree": "ab5574289f537a4028a3abf092e4634cb9b89282", | |
| 24 | 추가: "python": "3.14.4 (main, Aug 20 2026, 10:41:58) [GCC 15.2.0]", | |
| 25 | 추가: "zlib_runtime": "1.3.1", | |
| 26 | 추가: "base_paths_verified": 305, | |
| 27 | 추가: "unchanged_base_paths": 303, | |
| 28 | 추가: "changed_paths": [ | |
| 29 | 추가: "tests/rust-app-core-memory/SHA256SUMS", | |
| 30 | 추가: "tests/rust-app-core-memory/generate_fixtures.py" | |
| 31 | 추가: ], | |
| 32 | 추가: "fixtures_hex_sha256": "b57d63624622ad0d17a0902a48bf9a514d1cb67be99d87d831bca4984d485e37", | |
| 33 | 추가: "fixtures_json_sha256": "a1201119b4e74c9466affe0907025ae04ca24afb5d08aa55540fc42385cfe400", | |
| 34 | 추가: "exact_bytes_and_json_equal": true, | |
| 35 | 추가: "gzip_members_verified": 2, | |
| 36 | 추가: "inputs_unchanged": true, | |
| 37 | 추가: "rust_compiled": false, | |
| 38 | 추가: "rust_executed": false | |
| 39 | 추가: }, | |
| 40 | 추가: "unchanged_core_static_check": { | |
| 41 | 추가: "source_head": "23b8d1c615f24f42469138fcc63e7fce7cda4f24", | |
| 42 | 추가: "source_pins_verified": 69, | |
| 43 | 추가: "manifest_sha256": "0c8a155a9b14c886b3c46f002e35a6f795d7b5a815c8ea7ed87526d3574cff30", | |
| 44 | 추가: "declared": 67, | |
| 45 | 추가: "selected_registry_packages": null, | |
| 46 | 추가: "rust_compiled": false, | |
| 47 | 추가: "runtime_discovered": null, | |
| 48 | 추가: "runtime_executed": 0, | |
| 49 | 추가: "fixture_stdlib_verification": true, | |
| 50 | 추가: "inputs_unchanged": true | |
| 51 | 추가: }, | |
| 52 | 추가: "native_checker_helper_tests_passed": 9, | |
| 53 | 추가: "commands": [ | |
| 54 | 추가: { | |
| 55 | 추가: "argv": [ | |
| 56 | 추가: "/usr/bin/python3", | |
| 57 | 추가: "-B", | |
| 58 | 추가: "tests/python-gzip-fixture-compat/verify.py" | |
| 59 | 추가: ], | |
| 60 | 추가: "cwd": "/home/user/projects/zipelo/tests/python-gzip-fixture-compat/validation-host/c", | |
| 61 | 추가: "exit": 0, | |
| 62 | 추가: "duration_seconds": 0.06062793799992505, | |
| 63 | 추가: "stdout_sha256": "b26c95ea637656791de1d6649deaefd3e9e07b0a9bc12981c980abc522ab0675", | |
| 64 | 추가: "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | |
| 65 | 추가: "stdout_bytes": 812, | |
| 66 | 추가: "stderr_bytes": 0 | |
| 67 | 추가: }, | |
| 68 | 추가: { | |
| 69 | 추가: "argv": [ | |
| 70 | 추가: "/usr/bin/python3", | |
| 71 | 추가: "-B", | |
| 72 | 추가: "tests/rust-app-core-memory/static_check.py", | |
| 73 | 추가: "--manifest-sha256", | |
| 74 | 추가: "0c8a155a9b14c886b3c46f002e35a6f795d7b5a815c8ea7ed87526d3574cff30" | |
| 75 | 추가: ], | |
| 76 | 추가: "cwd": "/home/user/projects/zipelo/tests/python-gzip-fixture-compat/validation-host/c", | |
| 77 | 추가: "exit": 0, | |
| 78 | 추가: "duration_seconds": 0.05417774899979122, | |
| 79 | 추가: "stdout_sha256": "0808164c77bab6d10130b0d8a3213834c18ba9533191636d9b86bd5532554a9e", | |
| 80 | 추가: "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | |
| 81 | 추가: "stdout_bytes": 365, | |
| 82 | 추가: "stderr_bytes": 0 | |
| 83 | 추가: }, | |
| 84 | 추가: { | |
| 85 | 추가: "argv": [ | |
| 86 | 추가: "/usr/bin/python3", | |
| 87 | 추가: "-B", | |
| 88 | 추가: "tests/rust-app-core-memory/static_check_helper_tests.py" | |
| 89 | 추가: ], | |
| 90 | 추가: "cwd": "/home/user/projects/zipelo/tests/python-gzip-fixture-compat/validation-host/c", | |
| 91 | 추가: "exit": 0, | |
| 92 | 추가: "duration_seconds": 1.4344941700001073, | |
| 93 | 추가: "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | |
| 94 | 추가: "stderr_sha256": "3c6cc1a67560b93d5f5856c2df5b5461dd0bddc9437b09f34eda4e9c9e0336ec", | |
| 95 | 추가: "stdout_bytes": 0, | |
| 96 | 추가: "stderr_bytes": 1176 | |
| 97 | 추가: } | |
| 98 | 추가: ] | |
| 99 | 추가: }, | |
| 100 | 추가: { | |
| 101 | 추가: "environment": "ubuntu24", | |
| 102 | 추가: "fixture_and_overlay_check": { | |
| 103 | 추가: "state": "passed", | |
| 104 | 추가: "scope": "Python-only fixture bytes/provenance and fixed overlay verification; no Rust compile/run", | |
| 105 | 추가: "base_head": "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc", | |
| 106 | 추가: "base_tree": "ab5574289f537a4028a3abf092e4634cb9b89282", | |
| 107 | 추가: "python": "3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]", | |
| 108 | 추가: "zlib_runtime": "1.3", | |
| 109 | 추가: "base_paths_verified": 305, | |
| 110 | 추가: "unchanged_base_paths": 303, | |
| 111 | 추가: "changed_paths": [ | |
| 112 | 추가: "tests/rust-app-core-memory/SHA256SUMS", | |
| 113 | 추가: "tests/rust-app-core-memory/generate_fixtures.py" | |
| 114 | 추가: ], | |
| 115 | 추가: "fixtures_hex_sha256": "b57d63624622ad0d17a0902a48bf9a514d1cb67be99d87d831bca4984d485e37", | |
| 116 | 추가: "fixtures_json_sha256": "a1201119b4e74c9466affe0907025ae04ca24afb5d08aa55540fc42385cfe400", | |
| 117 | 추가: "exact_bytes_and_json_equal": true, | |
| 118 | 추가: "gzip_members_verified": 2, | |
| 119 | 추가: "inputs_unchanged": true, | |
| 120 | 추가: "rust_compiled": false, | |
| 121 | 추가: "rust_executed": false | |
| 122 | 추가: }, | |
| 123 | 추가: "unchanged_core_static_check": { | |
| 124 | 추가: "source_head": "23b8d1c615f24f42469138fcc63e7fce7cda4f24", | |
| 125 | 추가: "source_pins_verified": 69, | |
| 126 | 추가: "manifest_sha256": "0c8a155a9b14c886b3c46f002e35a6f795d7b5a815c8ea7ed87526d3574cff30", | |
| 127 | 추가: "declared": 67, | |
| 128 | 추가: "selected_registry_packages": null, | |
| 129 | 추가: "rust_compiled": false, | |
| 130 | 추가: "runtime_discovered": null, | |
| 131 | 추가: "runtime_executed": 0, | |
| 132 | 추가: "fixture_stdlib_verification": true, | |
| 133 | 추가: "inputs_unchanged": true | |
| 134 | 추가: }, | |
| 135 | 추가: "native_checker_helper_tests_passed": 9, | |
| 136 | 추가: "commands": [ | |
| 137 | 추가: { | |
| 138 | 추가: "argv": [ | |
| 139 | 추가: "/usr/bin/python3", | |
| 140 | 추가: "-B", | |
| 141 | 추가: "tests/python-gzip-fixture-compat/verify.py" | |
| 142 | 추가: ], | |
| 143 | 추가: "cwd": "/work/g", | |
| 144 | 추가: "exit": 0, | |
| 145 | 추가: "duration_seconds": 0.06128367699966475, | |
| 146 | 추가: "stdout_sha256": "67dc65be2e5a781611c59af0a177b6e38b44e23c080f768c371fbe30630a23b2", | |
| 147 | 추가: "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | |
| 148 | 추가: "stdout_bytes": 810, | |
| 149 | 추가: "stderr_bytes": 0 | |
| 150 | 추가: }, | |
| 151 | 추가: { | |
| 152 | 추가: "argv": [ | |
| 153 | 추가: "/usr/bin/python3", | |
| 154 | 추가: "-B", | |
| 155 | 추가: "tests/rust-app-core-memory/static_check.py", | |
| 156 | 추가: "--manifest-sha256", | |
| 157 | 추가: "0c8a155a9b14c886b3c46f002e35a6f795d7b5a815c8ea7ed87526d3574cff30" | |
| 158 | 추가: ], | |
| 159 | 추가: "cwd": "/work/g", | |
| 160 | 추가: "exit": 0, | |
| 161 | 추가: "duration_seconds": 0.053824678000637505, | |
| 162 | 추가: "stdout_sha256": "0808164c77bab6d10130b0d8a3213834c18ba9533191636d9b86bd5532554a9e", | |
| 163 | 추가: "stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | |
| 164 | 추가: "stdout_bytes": 365, | |
| 165 | 추가: "stderr_bytes": 0 | |
| 166 | 추가: }, | |
| 167 | 추가: { | |
| 168 | 추가: "argv": [ | |
| 169 | 추가: "/usr/bin/python3", | |
| 170 | 추가: "-B", | |
| 171 | 추가: "tests/rust-app-core-memory/static_check_helper_tests.py" | |
| 172 | 추가: ], | |
| 173 | 추가: "cwd": "/work/g", | |
| 174 | 추가: "exit": 0, | |
| 175 | 추가: "duration_seconds": 0.9235151720004069, | |
| 176 | 추가: "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | |
| 177 | 추가: "stderr_sha256": "f0fc6f693c225d34e802724d0f1d8f5337aca98e654a75a79cd92f9452d252c6", | |
| 178 | 추가: "stdout_bytes": 0, | |
| 179 | 추가: "stderr_bytes": 1176 | |
| 180 | 추가: } | |
| 181 | 추가: ] | |
| 182 | 추가: } | |
| 183 | 추가: ], | |
| 184 | 추가: "unchanged_original_files": 303, | |
| 185 | 추가: "rust_source_test_files_unchanged": 53, | |
| 186 | 추가: "frozen_fixture_hex_json_unchanged": true, | |
| 187 | 추가: "original_native_static_checker_unchanged": true, | |
| 188 | 추가: "historical_manifest_source_pins_and_execution_logs_unchanged": true, | |
| 189 | 추가: "rust_expected_total_unchanged": 690, | |
| 190 | 추가: "rust_compile_discover_execute": false, | |
| 191 | 추가: "dependencies_changed": false, | |
| 192 | 추가: "installation_or_network_change": false, | |
| 193 | 추가: "remaining_owned_test_processes": [], | |
| 194 | 추가: "limits": "Exact equality recorded on Python3.14.4/zlib1.3.1 and Python3.12.3/zlib1.3 only. No proof of identical compression across every future Python/zlib release.", | |
| 195 | 추가: "future_gate": "Review fixed PR head/tree before a new Rust compile/run assignment; use this explicit overlay instead of rewriting historical pins." | |
| 196 | 추가: } |
| @@ -0,0 +1,114 @@ | ||
| 1 | 추가: import argparse | |
| 2 | 추가: import gzip | |
| 3 | 추가: import hashlib | |
| 4 | 추가: import json | |
| 5 | 추가: from pathlib import Path, PurePosixPath | |
| 6 | 추가: import runpy | |
| 7 | 추가: import stat | |
| 8 | 추가: import sys | |
| 9 | 추가: import zlib | |
| 10 | 추가: | |
| 11 | 추가: BASE_HEAD = "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc" | |
| 12 | 추가: BASE_TREE = "ab5574289f537a4028a3abf092e4634cb9b89282" | |
| 13 | 추가: CHANGED = { | |
| 14 | 추가: "tests/rust-app-core-memory/generate_fixtures.py", | |
| 15 | 추가: "tests/rust-app-core-memory/SHA256SUMS", | |
| 16 | 추가: } | |
| 17 | 추가: | |
| 18 | 추가: | |
| 19 | 추가: def require(condition, message): | |
| 20 | 추가: if not condition: | |
| 21 | 추가: raise RuntimeError(message) | |
| 22 | 추가: | |
| 23 | 추가: | |
| 24 | 추가: def git_hash(kind, data): | |
| 25 | 추가: return hashlib.sha1(kind.encode() + b" " + str(len(data)).encode() + b"\0" + data).hexdigest() | |
| 26 | 추가: | |
| 27 | 추가: | |
| 28 | 추가: def tree_hash(entries): | |
| 29 | 추가: tree = {} | |
| 30 | 추가: for item in entries: | |
| 31 | 추가: parts = PurePosixPath(item["path"]).parts | |
| 32 | 추가: node = tree | |
| 33 | 추가: for part in parts[:-1]: | |
| 34 | 추가: node = node.setdefault(part, {}) | |
| 35 | 추가: require(parts[-1] not in node, "중복 tree 경로임") | |
| 36 | 추가: node[parts[-1]] = (item["mode"], item["sha"]) | |
| 37 | 추가: | |
| 38 | 추가: def calculate(node): | |
| 39 | 추가: data = bytearray() | |
| 40 | 추가: for name, value in sorted(node.items(), key=lambda row: (row[0] + ("/" if isinstance(row[1], dict) else "")).encode()): | |
| 41 | 추가: mode, digest = ("40000", calculate(value)) if isinstance(value, dict) else value | |
| 42 | 추가: data.extend(mode.encode() + b" " + name.encode() + b"\0" + bytes.fromhex(digest)) | |
| 43 | 추가: return git_hash("tree", bytes(data)) | |
| 44 | 추가: | |
| 45 | 추가: return calculate(tree) | |
| 46 | 추가: | |
| 47 | 추가: | |
| 48 | 추가: def main(): | |
| 49 | 추가: require(__debug__ and not sys.flags.optimize, "최적화 모드에서는 검증할 수 없음") | |
| 50 | 추가: parser = argparse.ArgumentParser() | |
| 51 | 추가: parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parents[2]) | |
| 52 | 추가: args = parser.parse_args() | |
| 53 | 추가: root = args.root.resolve() | |
| 54 | 추가: overlay_path = root / "tests/python-gzip-fixture-compat/overlay.json" | |
| 55 | 추가: overlay = json.loads(overlay_path.read_bytes()) | |
| 56 | 추가: require(overlay["base_head"] == BASE_HEAD and overlay["base_tree"] == BASE_TREE, "기준 head/tree 불일치") | |
| 57 | 추가: require(set(overlay["replacements"]) == CHANGED, "허용 변경 경로 불일치") | |
| 58 | 추가: source_manifest = root / overlay["historical_sources"]["path"] | |
| 59 | 추가: require(hashlib.sha256(source_manifest.read_bytes()).hexdigest() == overlay["historical_sources"]["sha256"], "과거 출처 pin 변경됨") | |
| 60 | 추가: entries = json.loads(source_manifest.read_bytes())["entries"] | |
| 61 | 추가: require(len(entries) == 302, "원본 출처 항목 수 불일치") | |
| 62 | 추가: entries = [{key: item[key] for key in ["path", "mode", "type", "sha"]} for item in entries] | |
| 63 | 추가: entries.extend(overlay["historical_metadata"]) | |
| 64 | 추가: require(len(entries) == len({item["path"] for item in entries}) == 305, "기준 tree 경로 수 불일치") | |
| 65 | 추가: require(tree_hash(entries) == BASE_TREE, "고정 원본 tree 불일치") | |
| 66 | 추가: before = {} | |
| 67 | 추가: for item in entries: | |
| 68 | 추가: relative = PurePosixPath(item["path"]) | |
| 69 | 추가: require(not relative.is_absolute() and ".." not in relative.parts and str(relative) == item["path"], "경로 이탈 거부함") | |
| 70 | 추가: path = root / relative | |
| 71 | 추가: require(path.is_file() and not path.is_symlink() and path.resolve().is_relative_to(root), "일반 파일 경로가 아님") | |
| 72 | 추가: require(stat.S_IMODE(path.stat().st_mode) == 0o644 and item["mode"] == "100644" and item["type"] == "blob", "고정 파일 mode 불일치") | |
| 73 | 추가: raw = path.read_bytes() | |
| 74 | 추가: replacement = overlay["replacements"].get(item["path"]) | |
| 75 | 추가: expected = item["sha"] | |
| 76 | 추가: if replacement is not None: | |
| 77 | 추가: require(replacement["before_git_blob"] == expected, "overlay 부모 pin 불일치") | |
| 78 | 추가: expected = replacement["after_git_blob"] | |
| 79 | 추가: require(hashlib.sha256(raw).hexdigest() == replacement["after_sha256"], "overlay SHA256 불일치") | |
| 80 | 추가: require(git_hash("blob", raw) == expected, "고정 blob 불일치: " + item["path"]) | |
| 81 | 추가: before[item["path"]] = hashlib.sha256(raw).hexdigest() | |
| 82 | 추가: fixture_dir = root / "tests/rust-app-core-memory" | |
| 83 | 추가: generated_hex, generated_json = runpy.run_path(str(fixture_dir / "generate_fixtures.py"))["build"]() | |
| 84 | 추가: require(generated_hex.encode() == (fixture_dir / "fixtures.hex").read_bytes(), "기존 fixture bytes와 다름") | |
| 85 | 추가: require(generated_json.encode() == (fixture_dir / "fixtures.json").read_bytes(), "기존 fixture JSON bytes와 다름") | |
| 86 | 추가: values = dict(line.split(" ", 1) for line in generated_hex.splitlines()) | |
| 87 | 추가: for name, payload in [("gzip_digits", b"123456789"), ("gzip_empty", b"")]: | |
| 88 | 추가: member = bytes.fromhex(values[name]) | |
| 89 | 추가: require(member[:10] == bytes.fromhex("1f8b08000000000000ff"), "고정 GZip header와 다름") | |
| 90 | 추가: require(gzip.decompress(member) == payload, "표준 GZip 해제 결과가 다름") | |
| 91 | 추가: for relative, digest in before.items(): | |
| 92 | 추가: require(hashlib.sha256((root / relative).read_bytes()).hexdigest() == digest, "검증 중 입력 변경됨") | |
| 93 | 추가: print(json.dumps({ | |
| 94 | 추가: "state": "passed", | |
| 95 | 추가: "scope": "Python-only fixture bytes/provenance and fixed overlay verification; no Rust compile/run", | |
| 96 | 추가: "base_head": BASE_HEAD, | |
| 97 | 추가: "base_tree": BASE_TREE, | |
| 98 | 추가: "python": sys.version, | |
| 99 | 추가: "zlib_runtime": zlib.ZLIB_RUNTIME_VERSION, | |
| 100 | 추가: "base_paths_verified": len(before), | |
| 101 | 추가: "unchanged_base_paths": len(before) - len(CHANGED), | |
| 102 | 추가: "changed_paths": sorted(CHANGED), | |
| 103 | 추가: "fixtures_hex_sha256": hashlib.sha256(generated_hex.encode()).hexdigest(), | |
| 104 | 추가: "fixtures_json_sha256": hashlib.sha256(generated_json.encode()).hexdigest(), | |
| 105 | 추가: "exact_bytes_and_json_equal": True, | |
| 106 | 추가: "gzip_members_verified": 2, | |
| 107 | 추가: "inputs_unchanged": True, | |
| 108 | 추가: "rust_compiled": False, | |
| 109 | 추가: "rust_executed": False, | |
| 110 | 추가: }, ensure_ascii=False)) | |
| 111 | 추가: | |
| 112 | 추가: | |
| 113 | 추가: if __name__ == "__main__": | |
| 114 | 추가: main() |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | c2c9f8f2a077ff22fce09c3b9ff4ebefb0627a031e68fd7b1523a93315c3e922 delivery.rs |
| 6 | 6 | b57d63624622ad0d17a0902a48bf9a514d1cb67be99d87d831bca4984d485e37 fixtures.hex |
| 7 | 7 | a1201119b4e74c9466affe0907025ae04ca24afb5d08aa55540fc42385cfe400 fixtures.json |
| 8 | 삭제: 203566ae81a254f4006924b74a3433a18b465950e5f1c9acb69e807809643534 generate_fixtures.py | |
| 8 | 추가: a358a8480c9f3addfcf9ab7572f31858ce59828436a1765faa6e427cfb062e11 generate_fixtures.py | |
| 9 | 9 | 7f26dade709fd7b598739b6e01f56a619a481af6a1c10df881be04d3f5306b60 gzip.rs |
| 10 | 10 | 01282aa60ebb5137faf467ed81f28739c885b44563be57e37cf09a329a323062 main.rs |
| 11 | 11 | 4e2eeaa88b5c592fa9ec936e5b6cd8834c4685fc2104217b177620b1caec7cc6 send.rs |
| @@ -6,6 +6,13 @@ import tarfile | ||
| 6 | 6 | import zlib |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 추가: def gzip_bytes(payload): | |
| 10 | 추가: archive = io.BytesIO() | |
| 11 | 추가: with gzip.GzipFile(filename="", mode="wb", compresslevel=6, fileobj=archive, mtime=0) as writer: | |
| 12 | 추가: writer.write(payload) | |
| 13 | 추가: return archive.getvalue() | |
| 14 | 추가: | |
| 15 | 추가: | |
| 9 | 16 | def build(): |
| 10 | 17 | payload = b"123456789" |
| 11 | 18 | archive = io.BytesIO() |
| @@ -18,8 +25,8 @@ def build(): | ||
| 18 | 25 | tar_bytes = archive.getvalue()[:2048] |
| 19 | 26 | values = { |
| 20 | 27 | "digits": payload, |
| 21 | 삭제: "gzip_digits": gzip.compress(payload, compresslevel=6, mtime=0), | |
| 22 | 삭제: "gzip_empty": gzip.compress(b"", compresslevel=6, mtime=0), | |
| 28 | 추가: "gzip_digits": gzip_bytes(payload), | |
| 29 | 추가: "gzip_empty": gzip_bytes(b""), | |
| 23 | 30 | "ustar_one": tar_bytes, |
| 24 | 31 | "ustar_sha256": hashlib.sha256(tar_bytes).digest(), |
| 25 | 32 | } |