Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def generate_logd(
"--include",
str(workspace),
"--max-file-size",
"10000",
"35840",
],
cwd=str(ROOT),
capture_output=True,
Expand Down
Binary file added diagnostic/build-0618b98e-part001.logd
Binary file not shown.
Binary file added diagnostic/build-0618b98e-part002.logd
Binary file not shown.
26 changes: 26 additions & 0 deletions diagnostic/build-0618b98e.json
Original file line number Diff line number Diff line change
@@ -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 <outdir> --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."
}
88 changes: 88 additions & 0 deletions tests/test_build_diagnostics.py
Original file line number Diff line number Diff line change
@@ -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()
Binary file modified tools/encryptly/linux-arm64/encryptly
Binary file not shown.
Binary file modified tools/encryptly/linux-x64/encryptly
Binary file not shown.
Binary file modified tools/encryptly/macos-arm64/encryptly
Binary file not shown.
Binary file modified tools/encryptly/windows-arm64/encryptly.exe
Binary file not shown.
Binary file modified tools/encryptly/windows-x64/encryptly.exe
Binary file not shown.