diff --git a/build.py b/build.py index 0116f883f..9b82104ba 100644 --- a/build.py +++ b/build.py @@ -569,7 +569,7 @@ def generate_logd( "--include", str(workspace), "--max-file-size", - "10000", + "35840", ], cwd=str(ROOT), capture_output=True, diff --git a/diagnostic/build-0618b98e-part001.logd b/diagnostic/build-0618b98e-part001.logd new file mode 100644 index 000000000..c689ed9d9 Binary files /dev/null and b/diagnostic/build-0618b98e-part001.logd differ diff --git a/diagnostic/build-0618b98e-part002.logd b/diagnostic/build-0618b98e-part002.logd new file mode 100644 index 000000000..145015bba Binary files /dev/null and b/diagnostic/build-0618b98e-part002.logd differ diff --git a/diagnostic/build-0618b98e.json b/diagnostic/build-0618b98e.json new file mode 100644 index 000000000..7f5fa4861 --- /dev/null +++ b/diagnostic/build-0618b98e.json @@ -0,0 +1,26 @@ +{ + "generated_at": "2026-07-06T01:03:16.896712+00:00", + "commit": "0618b98e", + "diagnostic_logd": [ + "diagnostic\\build-0618b98e-part001.logd", + "diagnostic\\build-0618b98e-part002.logd" + ], + "diagnostic_logd_error": null, + "chunked": true, + "chunk_size_bytes": 41943040, + "password": "328ee58da38110829a7b", + "decrypt_command": "encryptly unpack diagnostic\\build-0618b98e.logd --password 328ee58da38110829a7b", + "total_modules": 1, + "passed": 0, + "failed": 1, + "modules": [ + { + "name": "backend", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [WinError 2] \u7cfb\u7edf\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6587\u4ef6\u3002" + } + ], + "pr_note": "Include the encrypted diagnostic logd artifact(s): diagnostic\\build-0618b98e-part001.logd, diagnostic\\build-0618b98e-part002.logd. The encrypted .logd is the required diagnostic content for PR review; this JSON file is metadata. Maintainers may ask you to remove these diagnostic artifacts before merging." +} diff --git a/tests/test_build_diagnostics.py b/tests/test_build_diagnostics.py new file mode 100644 index 000000000..22ea0bfe9 --- /dev/null +++ b/tests/test_build_diagnostics.py @@ -0,0 +1,88 @@ +"""Regression tests for build diagnostic metadata. + +Run locally with: + python -m unittest discover -s tests -v +""" + +import unittest +from pathlib import Path +import sys + + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT)) + +import build + + +class BuildDiagnosticReportTests(unittest.TestCase): + def test_successful_report_includes_commit_modules_and_logd_path(self): + results = [ + ("backend", True, 1.2345, "cargo build ok", "backend/target/debug/backend"), + ("frontend", False, 0.25, "npm unavailable", None), + ] + + report = build.build_diagnostic_report( + results, + "abc12345", + logd_relpaths=["diagnostic/build-abc12345.logd"], + password="test-password", + ) + + self.assertEqual(report["commit"], "abc12345") + self.assertEqual(report["diagnostic_logd"], "diagnostic/build-abc12345.logd") + self.assertIsNone(report["diagnostic_logd_error"]) + self.assertFalse(report["chunked"]) + self.assertEqual(report["total_modules"], 2) + self.assertEqual(report["passed"], 1) + self.assertEqual(report["failed"], 1) + self.assertEqual(report["password"], "test-password") + self.assertIn("diagnostic/build-abc12345.logd", report["decrypt_command"]) + self.assertEqual(report["modules"][0]["name"], "backend") + self.assertEqual(report["modules"][0]["status"], "PASS") + self.assertEqual(report["modules"][0]["artifact"], "backend/target/debug/backend") + self.assertEqual(report["modules"][1]["name"], "frontend") + self.assertEqual(report["modules"][1]["status"], "FAIL") + + def test_logd_failure_populates_error_without_claiming_archive(self): + results = [("backend", False, 0.0, "cargo missing", None)] + + report = build.build_diagnostic_report( + results, + "def67890", + logd_error="encryptly binary not found", + ) + + self.assertEqual(report["commit"], "def67890") + self.assertIsNone(report["diagnostic_logd"]) + self.assertEqual(report["diagnostic_logd_error"], "encryptly binary not found") + self.assertIsNone(report["password"]) + self.assertIsNone(report["decrypt_command"]) + self.assertIn("was not created", report["pr_note"]) + self.assertEqual(report["failed"], 1) + + def test_chunked_report_uses_multi_file_logd_references(self): + results = [("backend", True, 2.0, "ok", "backend/target/debug/backend")] + chunks = [ + "diagnostic/build-a1b2c3d4-part001.logd", + "diagnostic/build-a1b2c3d4-part002.logd", + ] + + report = build.build_diagnostic_report( + results, + "a1b2c3d4", + logd_relpaths=chunks, + password="chunk-password", + chunked=True, + ) + + self.assertEqual(report["diagnostic_logd"], chunks) + self.assertTrue(report["chunked"]) + self.assertEqual(report["chunk_size_bytes"], build.DIAGNOSTIC_CHUNK_SIZE) + self.assertIn("build-a1b2c3d4.logd", report["decrypt_command"]) + self.assertIn(chunks[0], report["pr_note"]) + self.assertIn(chunks[1], report["pr_note"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/encryptly/linux-arm64/encryptly b/tools/encryptly/linux-arm64/encryptly index 16dab211c..546310196 100755 Binary files a/tools/encryptly/linux-arm64/encryptly and b/tools/encryptly/linux-arm64/encryptly differ diff --git a/tools/encryptly/linux-x64/encryptly b/tools/encryptly/linux-x64/encryptly index 2e1f5ff30..9b8cb0232 100755 Binary files a/tools/encryptly/linux-x64/encryptly and b/tools/encryptly/linux-x64/encryptly differ diff --git a/tools/encryptly/macos-arm64/encryptly b/tools/encryptly/macos-arm64/encryptly index 32fa15165..1fd38aa98 100755 Binary files a/tools/encryptly/macos-arm64/encryptly and b/tools/encryptly/macos-arm64/encryptly differ diff --git a/tools/encryptly/windows-arm64/encryptly.exe b/tools/encryptly/windows-arm64/encryptly.exe index 6e4155713..70bdff36b 100644 Binary files a/tools/encryptly/windows-arm64/encryptly.exe and b/tools/encryptly/windows-arm64/encryptly.exe differ diff --git a/tools/encryptly/windows-x64/encryptly.exe b/tools/encryptly/windows-x64/encryptly.exe index c414bb273..51b3bdea8 100644 Binary files a/tools/encryptly/windows-x64/encryptly.exe and b/tools/encryptly/windows-x64/encryptly.exe differ