Skip to content

Commit bebd14b

Browse files
committed
debug: upload regenerated contract artifacts on CI failure
1 parent ac74658 commit bebd14b

5 files changed

Lines changed: 32 additions & 16 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ jobs:
5454
- name: Run runtime contract tests
5555
run: make runtime-contract-test
5656

57+
- name: Upload regenerated contract artifacts for debugging
58+
if: failure()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: pbpk-runtime-contract-debug-${{ github.sha }}
62+
path: |
63+
.ci-regenerated/
64+
retention-days: 1
65+
5766
- name: Retain validated distribution artifacts
5867
run: |
5968
python scripts/check_distribution_artifacts.py \

docs/architecture/contract_manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"classification": "supporting",
174174
"relativePath": "docs/architecture/release_bundle_manifest.json",
175175
"role": "whole release bundle hash inventory",
176-
"sha256": "e6e4094692e270173cb2392cc876050e1c2c4c9d29672119223c75da1252c51a"
176+
"sha256": "83b2eb081e92415118a9ec61911078e5d05fe84dfa2cadc513ed0024ff71bc22"
177177
},
178178
{
179179
"classification": "supporting",
@@ -257,7 +257,7 @@
257257
"classification": "supporting",
258258
"relativePath": "scripts/generate_contract_artifacts.py",
259259
"role": "contract artifact generator",
260-
"sha256": "6d572e5bd4702d74513ff8017e42b1600caa2f1c9717397126cf5b3cf053d322"
260+
"sha256": "2003c73be78e39dad25c1bf4b88c63ca88a0c6511d7c68babe49619b19888d5f"
261261
},
262262
{
263263
"classification": "supporting",

docs/architecture/release_bundle_manifest.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"bundleSha256": "c7ed98f8479f43e4db1bc88deeb1deab9c60ffeda7dc73ad6e356e19e9c70623",
2+
"bundleSha256": "7726b4650350c6e65c26254d13bc5080d0312bf58709f5fafb3429f7dca89de6",
33
"contractVersion": "pbpk-mcp.v1",
44
"fileCount": 612,
55
"files": [
@@ -192,8 +192,8 @@
192192
{
193193
"group": "governance",
194194
"relativePath": ".github/workflows/ci.yml",
195-
"sha256": "7e76a0224e87ea7a21009cca3f68463a04184b991a9affdfece4681f691c6e32",
196-
"sizeBytes": 1717
195+
"sha256": "269ac7922d12d9692f71194d106dcecf4ece9f9edb3e242cef30386bdda4b9bd",
196+
"sizeBytes": 1998
197197
},
198198
{
199199
"group": "governance",
@@ -2202,8 +2202,8 @@
22022202
{
22032203
"group": "operations",
22042204
"relativePath": "scripts/generate_contract_artifacts.py",
2205-
"sha256": "6d572e5bd4702d74513ff8017e42b1600caa2f1c9717397126cf5b3cf053d322",
2206-
"sizeBytes": 16955
2205+
"sha256": "2003c73be78e39dad25c1bf4b88c63ca88a0c6511d7c68babe49619b19888d5f",
2206+
"sizeBytes": 17457
22072207
},
22082208
{
22092209
"group": "operations",
@@ -3721,5 +3721,5 @@
37213721
],
37223722
"mode": "staged-source-tree-equivalent"
37233723
},
3724-
"totalBytes": 12049460
3724+
"totalBytes": 12050243
37253725
}

scripts/generate_contract_artifacts.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,13 @@ def main() -> int:
485485
ok = _check_file(RELEASE_BUNDLE_MANIFEST_PATH, release_bundle_manifest_text) and ok
486486
ok = _check_file(CONTRACT_MANIFEST_PATH, manifest_text) and ok
487487
ok = _check_file(PACKAGED_MODULE_PATH, packaged_module_text) and ok
488+
if not ok:
489+
debug_dir = WORKSPACE_ROOT / ".ci-regenerated"
490+
debug_dir.mkdir(exist_ok=True)
491+
(debug_dir / "release_bundle_manifest.json").write_text(release_bundle_manifest_text, encoding="utf-8")
492+
(debug_dir / "contract_manifest.json").write_text(manifest_text, encoding="utf-8")
493+
(debug_dir / "artifacts.py").write_text(packaged_module_text, encoding="utf-8")
494+
print(f"Wrote regenerated files to {debug_dir}", file=sys.stderr)
488495
return 0 if ok else 1
489496

490497
RELEASE_BUNDLE_MANIFEST_PATH.write_text(release_bundle_manifest_text, encoding="utf-8")

src/mcp_bridge/contract/artifacts.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296
"classification": "supporting",
297297
"relativePath": "docs/architecture/release_bundle_manifest.json",
298298
"role": "whole release bundle hash inventory",
299-
"sha256": "e6e4094692e270173cb2392cc876050e1c2c4c9d29672119223c75da1252c51a"
299+
"sha256": "83b2eb081e92415118a9ec61911078e5d05fe84dfa2cadc513ed0024ff71bc22"
300300
},
301301
{
302302
"classification": "supporting",
@@ -380,7 +380,7 @@
380380
"classification": "supporting",
381381
"relativePath": "scripts/generate_contract_artifacts.py",
382382
"role": "contract artifact generator",
383-
"sha256": "6d572e5bd4702d74513ff8017e42b1600caa2f1c9717397126cf5b3cf053d322"
383+
"sha256": "2003c73be78e39dad25c1bf4b88c63ca88a0c6511d7c68babe49619b19888d5f"
384384
},
385385
{
386386
"classification": "supporting",
@@ -442,7 +442,7 @@
442442

443443
_RELEASE_BUNDLE_MANIFEST_JSON = r"""
444444
{
445-
"bundleSha256": "c7ed98f8479f43e4db1bc88deeb1deab9c60ffeda7dc73ad6e356e19e9c70623",
445+
"bundleSha256": "7726b4650350c6e65c26254d13bc5080d0312bf58709f5fafb3429f7dca89de6",
446446
"contractVersion": "pbpk-mcp.v1",
447447
"fileCount": 612,
448448
"files": [
@@ -635,8 +635,8 @@
635635
{
636636
"group": "governance",
637637
"relativePath": ".github/workflows/ci.yml",
638-
"sha256": "7e76a0224e87ea7a21009cca3f68463a04184b991a9affdfece4681f691c6e32",
639-
"sizeBytes": 1717
638+
"sha256": "269ac7922d12d9692f71194d106dcecf4ece9f9edb3e242cef30386bdda4b9bd",
639+
"sizeBytes": 1998
640640
},
641641
{
642642
"group": "governance",
@@ -2645,8 +2645,8 @@
26452645
{
26462646
"group": "operations",
26472647
"relativePath": "scripts/generate_contract_artifacts.py",
2648-
"sha256": "6d572e5bd4702d74513ff8017e42b1600caa2f1c9717397126cf5b3cf053d322",
2649-
"sizeBytes": 16955
2648+
"sha256": "2003c73be78e39dad25c1bf4b88c63ca88a0c6511d7c68babe49619b19888d5f",
2649+
"sizeBytes": 17457
26502650
},
26512651
{
26522652
"group": "operations",
@@ -4164,7 +4164,7 @@
41644164
],
41654165
"mode": "staged-source-tree-equivalent"
41664166
},
4167-
"totalBytes": 12049460
4167+
"totalBytes": 12050243
41684168
}
41694169
"""
41704170

0 commit comments

Comments
 (0)