diff --git a/build.py b/build.py index 07b97c41c..e7429636c 100644 --- a/build.py +++ b/build.py @@ -10,9 +10,10 @@ import subprocess import sys import time +import tempfile from dataclasses import dataclass -from pathlib import Path -from typing import Optional +from pathlib import Path, PurePosixPath, PureWindowsPath +from typing import Any, Optional ROOT = Path(__file__).resolve().parent DIAGNOSTIC_DIR = ROOT / "diagnostic" @@ -20,6 +21,113 @@ ENCRYPTLY_BLOCKER_MESSAGE = "You need to fix your environment so encryptly runs before building." +class DiagnosticValidationError(RuntimeError): + pass + + +def repo_relative_path(path: Path | str) -> str: + """Return a deterministic repo-relative path using forward slashes.""" + path_obj = Path(path) + if not path_obj.is_absolute(): + return str(path).replace("\\", "/") + try: + return path_obj.resolve().relative_to(ROOT.resolve()).as_posix() + except ValueError: + return f"external/{path_obj.name}" + + +def _redaction_tokens() -> list[tuple[str, str]]: + tokens = [ + (str(ROOT), ""), + (str(Path.home()), ""), + (tempfile.gettempdir(), ""), + (platform.node(), ""), + (getpass.getuser(), ""), + ] + for key in ("USERNAME", "USER", "LOGNAME", "COMPUTERNAME"): + value = os.environ.get(key) + if value: + tokens.append((value, f"<{key.lower()}>")) + + expanded: list[tuple[str, str]] = [] + for token, replacement in tokens: + if not token: + continue + expanded.append((token, replacement)) + expanded.append((token.replace("\\", "/"), replacement)) + expanded.append((token.replace("/", "\\"), replacement)) + + expanded.sort(key=lambda item: len(item[0]), reverse=True) + return expanded + + +def redact_diagnostic_text(value: str) -> str: + redacted = value + for token, replacement in _redaction_tokens(): + redacted = redacted.replace(token, replacement) + return redacted + + +def sanitize_diagnostic_value(value: Any) -> Any: + if isinstance(value, dict): + return {key: sanitize_diagnostic_value(item) for key, item in value.items()} + if isinstance(value, list): + return [sanitize_diagnostic_value(item) for item in value] + if isinstance(value, tuple): + return [sanitize_diagnostic_value(item) for item in value] + if isinstance(value, Path): + return repo_relative_path(value) + if isinstance(value, str): + return redact_diagnostic_text(value) + return value + + +def validate_diagnostic_pair( + metadata_path: Path, + expected_logd_paths: Optional[list[Path]] = None, +) -> None: + if not metadata_path.exists(): + raise DiagnosticValidationError( + f"diagnostic metadata JSON missing: {repo_relative_path(metadata_path)}" + ) + + try: + metadata = json.loads(metadata_path.read_text(encoding="utf-8")) + except json.JSONDecodeError as exc: + raise DiagnosticValidationError( + f"diagnostic metadata JSON invalid: {repo_relative_path(metadata_path)}: {exc}" + ) from exc + + logd_value = metadata.get("diagnostic_logd") + if not logd_value: + if metadata.get("diagnostic_logd_error"): + return + raise DiagnosticValidationError( + f"diagnostic_logd missing in {repo_relative_path(metadata_path)}" + ) + + logd_refs = logd_value if isinstance(logd_value, list) else [logd_value] + normalized_refs: list[str] = [] + for ref in logd_refs: + if not isinstance(ref, str) or not ref.strip(): + raise DiagnosticValidationError("diagnostic_logd must contain non-empty path strings") + normalized_ref = ref.replace("\\", "/") + ref_path = Path(normalized_ref) + if ref_path.is_absolute() or PureWindowsPath(ref).is_absolute() or PurePosixPath(ref).is_absolute(): + raise DiagnosticValidationError(f"diagnostic_logd must be repo-relative: {ref}") + artifact_path = ROOT.joinpath(*normalized_ref.split("/")) + if not artifact_path.exists(): + raise DiagnosticValidationError(f"diagnostic .logd missing: {normalized_ref}") + normalized_refs.append(normalized_ref) + + if expected_logd_paths is not None: + expected = [repo_relative_path(path) for path in expected_logd_paths] + if normalized_refs != expected: + raise DiagnosticValidationError( + f"diagnostic_logd mismatch: metadata has {normalized_refs}, expected {expected}" + ) + + def current_commit_id() -> str: """Return the first 4 bytes (8 hex chars) of HEAD for stable per-commit diagnostics.""" try: @@ -222,7 +330,7 @@ def encryptly_platform_help() -> str: return f"detected {detected}; available: {available}" -def check_encryptly_runs(timeout: int = 60) -> tuple[bool, str]: +def check_encryptly_runs(timeout: int = 180) -> tuple[bool, str]: """Verify encryptly can create a diagnostic bundle before doing any build work.""" encryptly_bin = get_encryptly_bin() if encryptly_bin is None: @@ -230,9 +338,14 @@ def check_encryptly_runs(timeout: int = 60) -> tuple[bool, str]: workspace = Path.home() / ".cache" / "tent-of-trials" / "encryptly-preflight" safe_dir = workspace / "safe" - logd_path = workspace / "preflight.logd" + # Keep the output outside the included tree. Some encryptly builds stream the + # destination while walking --include, which can otherwise pack the growing + # .logd into itself and make the preflight hang or balloon. + logd_path = workspace.parent / "preflight.logd" try: shutil.rmtree(workspace, ignore_errors=True) + if logd_path.exists(): + logd_path.unlink() safe_dir.mkdir(parents=True, exist_ok=True) (safe_dir / "preflight.txt").write_text("encryptly preflight\n", encoding="utf-8") result = subprocess.run( @@ -262,6 +375,8 @@ def check_encryptly_runs(timeout: int = 60) -> tuple[bool, str]: return False, str(e) finally: shutil.rmtree(workspace, ignore_errors=True) + if logd_path.exists(): + logd_path.unlink() class Colors: GREEN = "\033[92m" @@ -277,6 +392,43 @@ def color(text: str, code: str) -> str: return text return f"{code}{text}{Colors.RESET}" + +def output_supports(text: str) -> bool: + encoding = (getattr(sys.stdout, "encoding", None) or "utf-8").lower().replace("_", "-") + if encoding not in {"utf-8", "utf8", "cp65001"}: + return False + try: + text.encode(encoding) + return True + except UnicodeEncodeError: + return False + + +def safe_text(text: str, fallback: str) -> str: + return text if output_supports(text) else fallback + + +def mark(symbol: str, fallback: str) -> str: + return safe_text(symbol, fallback) + + +def rule(width: int) -> str: + return safe_text("─" * width, "-" * width) + + +def configure_output_streams() -> None: + for stream in (sys.stdout, sys.stderr): + reconfigure = getattr(stream, "reconfigure", None) + if reconfigure is None: + continue + try: + reconfigure(errors="replace") + except Exception: + pass + + +configure_output_streams() + def check_prerequisites() -> list[str]: required = { "cargo": "Rust", @@ -306,7 +458,7 @@ def build_module( verbose: bool = False, ) -> tuple[bool, float, str]: - print(f"\n {color('▸', Colors.CYAN)} Building {color(module.name, Colors.BOLD)} ({module.language})...") + print(f"\n {color(mark('▸', '>'), Colors.CYAN)} Building {color(module.name, Colors.BOLD)} ({module.language})...") env = os.environ.copy() if module.env: @@ -329,6 +481,8 @@ def build_module( ) if install_result.returncode != 0: return False, time.time() - start, f"npm install failed:\n{install_result.stderr}" + except FileNotFoundError as e: + return False, time.time() - start, f"npm install command not found: {e}" except subprocess.TimeoutExpired: return False, time.time() - start, "npm install TIMEOUT (120s)" @@ -348,7 +502,7 @@ def build_module( except subprocess.TimeoutExpired: return False, time.time() - start, "CMake configure TIMEOUT (120s)" except FileNotFoundError as e: - return False, 0, f"Command not found: {e}" + return False, time.time() - start, f"CMake configure command not found: {e}" if cfg_result.returncode != 0: output_lines = [] if cfg_result.stdout: @@ -397,7 +551,7 @@ def build_module( return success, elapsed, output def clean_module(module: Module, verbose: bool = False) -> bool: - print(f" {color('▸', Colors.YELLOW)} Cleaning {module.name}...") + print(f" {color(mark('▸', '>'), Colors.YELLOW)} Cleaning {module.name}...") try: subprocess.run( module.clean_cmd, @@ -409,7 +563,7 @@ def clean_module(module: Module, verbose: bool = False) -> bool: ) return True except Exception as e: - print(f" {color('✗', Colors.RED)} Clean failed: {e}") + print(f" {color(mark('✗', 'x'), Colors.RED)} Clean failed: {e}") return False def verify_binary(module: Module) -> Optional[str]: @@ -490,6 +644,9 @@ def build_diagnostic_report( chunked: bool = False, message_blocker: Optional[str] = None, ) -> dict: + if logd_relpaths: + logd_relpaths = [repo_relative_path(path) for path in logd_relpaths] + diagnostic_logd: Optional[str | list[str]] if not logd_relpaths: diagnostic_logd = None @@ -500,7 +657,7 @@ def build_diagnostic_report( decrypt_target = logd_relpaths[0] if logd_relpaths and len(logd_relpaths) == 1 else None if logd_relpaths and len(logd_relpaths) > 1: - decrypt_target = str((DIAGNOSTIC_DIR / f"build-{commit_id}.logd").relative_to(ROOT)) + decrypt_target = repo_relative_path(DIAGNOSTIC_DIR / f"build-{commit_id}.logd") report = { "generated_at": datetime.datetime.now(datetime.timezone.utc).isoformat(), @@ -523,8 +680,8 @@ def build_diagnostic_report( "name": name, "status": "PASS" if success else "FAIL", "elapsed_seconds": round(elapsed, 3), - "artifact": binary, - "output": output, + "artifact": repo_relative_path(binary) if binary else None, + "output": redact_diagnostic_text(output), } for name, success, elapsed, output, binary in results ], @@ -534,12 +691,12 @@ def build_diagnostic_report( + "Maintainers may ask you to remove these diagnostic artifacts before merging." ), } - return report + return sanitize_diagnostic_value(report) def write_diagnostic_report(metadata_path: Path, report: dict) -> None: metadata_path.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8") - print(f" {color('✓', Colors.GREEN)} {metadata_path.relative_to(ROOT)} created") + print(f" {color(mark('✓', '+'), Colors.GREEN)} {metadata_path.relative_to(ROOT)} created") def commit_diagnostic_artifacts(paths: list[Path], commit_id: str) -> bool: @@ -597,7 +754,7 @@ def generate_logd( ) -> bool: logd_path, metadata_path, commit_id = diagnostic_paths_for_commit() display_logd = logd_path.relative_to(ROOT) - print(f"\n {color('▸', Colors.CYAN)} Finalizing diagnostics for {color(str(display_logd), Colors.BOLD)}...") + print(f"\n {color(mark('▸', '>'), Colors.CYAN)} Finalizing diagnostics for {color(str(display_logd), Colors.BOLD)}...") # Always write the JSON report first. The encrypted .logd is useful, but the # report is required even when the build failed before compilation started or @@ -607,7 +764,7 @@ def generate_logd( encryptly_bin = get_encryptly_bin() if encryptly_bin is None: error = f"encryptly binary not found ({encryptly_platform_help()}); cannot create {display_logd}" - print(f" {color('✗', Colors.RED)} {error}") + print(f" {color(mark('✗', 'x'), Colors.RED)} {error}") write_diagnostic_report( metadata_path, build_diagnostic_report( @@ -631,7 +788,7 @@ def generate_logd( safe_dir.mkdir(parents=True, exist_ok=True) (safe_dir / "system-info.txt").write_text( - collect_system_info(), encoding="utf-8" + redact_diagnostic_text(collect_system_info()), encoding="utf-8" ) summary_lines = [ @@ -647,7 +804,7 @@ def generate_logd( for name, success, elapsed, _, binary in results: summary_lines.append( f" {name}: {'PASS' if success else 'FAIL'} ({elapsed:.2f}s)" - f"{f' [{binary}]' if binary else ''}" + f"{f' [{repo_relative_path(binary)}]' if binary else ''}" ) (safe_dir / "build-summary.txt").write_text( "\n".join(summary_lines), encoding="utf-8" @@ -660,9 +817,9 @@ def generate_logd( f"{'=' * 50}" ) if binary: - log_lines.append(f"artifact: {binary}") + log_lines.append(f"artifact: {repo_relative_path(binary)}") if output: - log_lines.append(output) + log_lines.append(redact_diagnostic_text(output)) (safe_dir / "build.log").write_text("\n".join(log_lines), encoding="utf-8") sr = subprocess.run( @@ -683,7 +840,7 @@ def generate_logd( if sr.returncode != 0: error = sr.stderr.strip() or sr.stdout.strip() or "encryptly pack failed" print( - f" {color('✗', Colors.RED)} {logd_path.relative_to(ROOT)} creation failed: " + f" {color(mark('✗', 'x'), Colors.RED)} {logd_path.relative_to(ROOT)} creation failed: " f"{error}" ) if logd_path.exists(): @@ -703,8 +860,8 @@ def generate_logd( safe_pw = sr.stdout.strip() logd_files = split_diagnostic_logd(logd_path) - logd_relpaths = [str(path.relative_to(ROOT)) for path in logd_files] - decrypt_target = logd_relpaths[0] if len(logd_relpaths) == 1 else str(logd_path.relative_to(ROOT)) + logd_relpaths = [repo_relative_path(path) for path in logd_files] + decrypt_target = logd_relpaths[0] if len(logd_relpaths) == 1 else repo_relative_path(logd_path) write_diagnostic_report( metadata_path, build_diagnostic_report( @@ -719,12 +876,13 @@ def generate_logd( for path in logd_files: size_kb = path.stat().st_size / 1024.0 print( - f" {color('✓', Colors.GREEN)} {path.relative_to(ROOT)} created " + f" {color(mark('✓', '+'), Colors.GREEN)} {path.relative_to(ROOT)} created " f"({size_kb:.1f} KiB)" ) + validate_diagnostic_pair(metadata_path, expected_logd_paths=logd_files) if len(logd_files) > 1: print( - f" {color('✓', Colors.GREEN)} split oversized diagnostic log into " + f" {color(mark('✓', '+'), Colors.GREEN)} split oversized diagnostic log into " f"{len(logd_files)} chunks of at most {DIAGNOSTIC_CHUNK_SIZE // (1024 * 1024)} MiB" ) if not commit_diagnostic_artifacts([metadata_path, *logd_files], commit_id): @@ -737,7 +895,7 @@ def generate_logd( print(f" diagnostic log file(s) and metadata file with this password.") if len(logd_files) > 1: print(f" Reassemble chunks in order before unpacking:") - print(f" cat {' '.join(logd_relpaths)} > {logd_path.relative_to(ROOT)}") + print(f" cat {' '.join(logd_relpaths)} > {repo_relative_path(logd_path)}") print(f" {color(safe_pw, Colors.CYAN)}") print(f" {color(f'encryptly unpack {decrypt_target} --password {safe_pw}', Colors.GRAY)}") return True @@ -755,13 +913,13 @@ def print_summary(results: list[tuple[str, bool, float, str, Optional[str]]]): total_time = sum(t for _, _, t, _, _ in results) for name, success, elapsed, output, binary in results: - status_icon = color("✓", Colors.GREEN) if success else color("✗", Colors.RED) + status_icon = color(mark("✓", "+"), Colors.GREEN) if success else color(mark("✗", "x"), Colors.RED) status_text = color("PASS", Colors.GREEN) if success else color("FAIL", Colors.RED) time_str = f"{elapsed:.1f}s" if elapsed < 60 else f"{elapsed / 60:.1f}m" print(f"\n {status_icon} {color(name + ':', Colors.BOLD)} {status_text} ({time_str})") if binary: - print(f" artifact: {color(binary, Colors.GRAY)}") + print(f" artifact: {color(repo_relative_path(binary), Colors.GRAY)}") if not success and output: lines = output.strip().split("\n") @@ -769,7 +927,7 @@ def print_summary(results: list[tuple[str, bool, float, str, Optional[str]]]): for line in lines[-5:]: print(f" {color(line, Colors.GRAY)}") - print(f"\n {color('─' * 40, Colors.GRAY)}") + print(f"\n {color(rule(40), Colors.GRAY)}") print(f" {color('Total:', Colors.BOLD)} {total} modules, " f"{color(str(passed) + ' passed', Colors.GREEN)}, " f"{color(str(failed) + ' failed', Colors.RED)}, " @@ -831,14 +989,14 @@ def main(): print(f" {color('Checking prerequisites...', Colors.GRAY)}") missing = check_prerequisites() if missing: - print(f"\n {color('⚠ Some tools missing - will try anyway:', Colors.YELLOW)}") + print(f"\n {color(safe_text('⚠ Some tools missing - will try anyway:', 'WARNING Some tools missing - will try anyway:'), Colors.YELLOW)}") for m in missing: print(f" {m}") msg = "Not all modules will build. That's fine." print(f" {color(msg, Colors.GRAY)}") else: - print(f" {color('✓ All prerequisites found', Colors.GREEN)}") + print(f" {color(safe_text('✓ All prerequisites found', '+ All prerequisites found'), Colors.GREEN)}") if args.module == "all": selected = MODULES else: @@ -846,7 +1004,7 @@ def main(): selected = [m for m in MODULES if m.name in names] not_found = set(names) - {m.name for m in MODULES} if not_found: - print(f" {color('✗ Unknown modules:', Colors.RED)} {', '.join(not_found)}") + print(f" {color(safe_text('✗ Unknown modules:', 'x Unknown modules:'), Colors.RED)} {', '.join(not_found)}") print(f" Available: {', '.join(m.name for m in MODULES)}") return 1 @@ -871,7 +1029,7 @@ def main(): shutil.rmtree(artifact) else: artifact.unlink() - print(f" {color('▸', Colors.YELLOW)} Removed {artifact.relative_to(ROOT)}") + print(f" {color(mark('▸', '>'), Colors.YELLOW)} Removed {artifact.relative_to(ROOT)}") print(f"\n {color('Clean complete.', Colors.GREEN)}") return 0 diff --git a/diagnostic/build-0c8d9252.json b/diagnostic/build-0c8d9252.json new file mode 100644 index 000000000..617d53c34 --- /dev/null +++ b/diagnostic/build-0c8d9252.json @@ -0,0 +1,87 @@ +{ + "generated_at": "2026-06-19T19:29:25.166954+00:00", + "commit": "0c8d9252", + "diagnostic_logd": "diagnostic/build-0c8d9252.logd", + "diagnostic_logd_error": null, + "message_blocker": null, + "chunked": false, + "chunk_size_bytes": null, + "password": "a09244f378b549c6b6e6", + "decrypt_command": "encryptly unpack diagnostic/build-0c8d9252.logd --password a09244f378b549c6b6e6", + "total_modules": 10, + "passed": 7, + "failed": 3, + "modules": [ + { + "name": "backend", + "status": "PASS", + "elapsed_seconds": 134.992, + "artifact": "backend/target", + "output": "\u001b[1m\u001b[92m Updating\u001b[0m crates.io index\n\u001b[1m\u001b[92m Downloading\u001b[0m crates ...\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstyle-parse v1.0.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstyle v1.0.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstream v1.0.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m aho-corasick v1.1.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m autocfg v1.5.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m errno v0.3.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m colorchoice v1.0.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m block-buffer v0.10.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m either v1.16.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m cfg-if v1.0.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m anyhow v1.0.102\n\u001b[1m\u001b[92m Downloaded\u001b[0m bitflags v2.13.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-executor v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap_builder v4.6.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m http-body v1.0.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper-tls v0.6.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m async-trait v0.1.89\n\u001b[1m\u001b[92m Downloaded\u001b[0m indexmap v2.14.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m getrandom v0.4.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost-build v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_provider v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m atomic-waker v1.1.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_normalizer_data v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_collections v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m potential_utf v0.1.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m find-msvc-tools v0.1.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m crossbeam-utils v0.8.21\n\u001b[1m\u001b[92m Downloaded\u001b[0m hashbrown v0.17.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m idna_adapter v1.2.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap_derive v4.6.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m once_cell v1.21.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m mime v0.3.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m foreign-types v0.3.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m lazy_static v1.5.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper-rustls v0.27.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m idna v1.1.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m form_urlencoded v1.2.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m digest v0.10.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-core v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m fastrand v2.4.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m crypto-common v0.1.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m prettyplease v0.2.37\n\u001b[1m\u001b[92m Downloaded\u001b[0m displaydoc v0.2.6\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-task v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m is_terminal_polyfill v1.70.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl-probe v0.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl-macros v0.1.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m equivalent v1.0.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m percent-encoding v2.3.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_urlencoded v0.7.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m stable_deref_trait v1.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m multimap v0.10.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost-derive v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m parking_lot_core v0.9.12\n\u001b[1m\u001b[92m Downloaded\u001b[0m nu-ansi-term v0.50.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m pin-project-lite v0.2.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m slab v0.4.12\n\u001b[1m\u001b[92m Downloaded\u001b[0m num-traits v0.2.19\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-serde v0.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m shlex v2.0.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m memchr v2.8.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m sha2 v0.10.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-native-tls v0.3.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m prost-types v0.13.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_properties_data v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m strsim v0.11.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m proc-macro2 v1.0.106\n\u001b[1m\u001b[92m Downloaded\u001b[0m socket2 v0.6.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml_write v0.1.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower-service v0.3.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower-layer v0.3.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl v0.10.81\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-macros v2.7.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m sync_wrapper v1.0.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml_datetime v0.6.11\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_core v1.0.228\n\u001b[1m\u001b[92m Downloaded\u001b[0m thiserror-impl v2.0.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m thiserror v2.0.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m synstructure v0.13.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde v1.0.228\n\u001b[1m\u001b[92m Downloaded\u001b[0m ryu v1.0.23\n\u001b[1m\u001b[92m Downloaded\u001b[0m encoding_rs v0.8.35\n\u001b[1m\u001b[92m Downloaded\u001b[0m petgraph v0.7.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-log v0.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m tempfile v3.27.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m sharded-slab v0.1.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerofrom-derive v0.1.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerovec-derive v0.11.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m zmij v1.0.21\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower v0.5.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m yoke v0.8.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m uuid v1.23.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerotrie v0.2.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m typenum v1.20.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m url v2.5.8\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerovec v0.11.6\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-subscriber v0.3.23\n\u001b[1m\u001b[92m Downloaded\u001b[0m tower-http v0.6.11\n\u001b[1m\u001b[92m Downloaded\u001b[0m winnow v0.7.15\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-util v0.7.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m unicode-ident v1.0.24\n\u001b[1m\u001b[92m Downloaded\u001b[0m vcpkg v0.2.15\n\u001b[1m\u001b[92m Downloaded\u001b[0m regex-syntax v0.8.11\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustls v0.23.40\n\u001b[1m\u001b[92m Downloaded\u001b[0m syn v2.0.117\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_json v1.0.150\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustix v1.1.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m regex v1.12.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m libc v0.2.186\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing v0.1.44\n\u001b[1m\u001b[92m Downloaded\u001b[0m zeroize v1.9.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m writeable v0.6.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m untrusted v0.9.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m reqwest v0.12.28\n\u001b[1m\u001b[92m Downloaded\u001b[0m zerofrom v0.1.8\n\u001b[1m\u001b[92m Downloaded\u001b[0m regex-automata v0.4.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m yoke-derive v0.8.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m want v0.3.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m version_check v0.9.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m utf8parse v0.2.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m utf8_iter v1.0.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m try-lock v0.2.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-core v0.1.36\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml_edit v0.22.27\n\u001b[1m\u001b[92m Downloaded\u001b[0m tracing-attributes v0.1.31\n\u001b[1m\u001b[92m Downloaded\u001b[0m tonic-build v0.12.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m toml v0.8.23\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio-rustls v0.26.4\n\u001b[1m\u001b[92m Downloaded\u001b[0m tinystr v0.8.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m thread_local v1.1.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m smallvec v1.15.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustls-webpki v0.103.13\n\u001b[1m\u001b[92m Downloaded\u001b[0m chrono v0.4.45\n\u001b[1m\u001b[92m Downloaded\u001b[0m tokio v1.52.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m pkg-config v0.3.33\n\u001b[1m\u001b[92m Downloaded\u001b[0m subtle v2.6.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_derive v1.0.228\n\u001b[1m\u001b[92m Downloaded\u001b[0m hashbrown v0.14.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m h2 v0.4.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m itertools v0.14.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper v1.10.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m rustls-pki-types v1.14.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m mio v1.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m http v1.4.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m hyper-util v0.1.20\n\u001b[1m\u001b[92m Downloaded\u001b[0m scopeguard v1.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m quote v1.0.45\n\u001b[1m\u001b[92m Downloaded\u001b[0m openssl-sys v0.9.117\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_normalizer v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_properties v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m signal-hook-registry v1.4.8\n\u001b[1m\u001b[92m Downloaded\u001b[0m litemap v0.8.2\n\u001b[1m\u001b[92m Downloaded\u001b[0m iana-time-zone v0.1.65\n\u001b[1m\u001b[92m Downloaded\u001b[0m httparse v1.10.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m getrandom v0.2.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap v4.6.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m cc v1.2.64\n\u001b[1m\u001b[92m Downloaded\u001b[0m parking_lot v0.12.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m ipnet v2.12.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m native-tls v0.2.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m lock_api v0.4.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m matchers v0.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m serde_spanned v0.6.9\n\u001b[1m\u001b[92m Downloaded\u001b[0m heck v0.5.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m log v0.4.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m icu_locale_core v2.2.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m http-body-util v0.1.3\n\u001b[1m\u001b[92m Downloaded\u001b[0m ring v0.17.14\n\u001b[1m\u001b[92m Downloaded\u001b[0m itoa v1.0.18\n\u001b[1m\u001b[92m Downloaded\u001b[0m cpufeatures v0.2.17\n\u001b[1m\u001b[92m Downloaded\u001b[0m clap_lex v1.1.0\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-util v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-macro v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-io v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m base64 v0.22.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m generic-array v0.14.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m linux-raw-sys v0.12.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m fnv v1.0.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-sink v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m futures-channel v0.3.32\n\u001b[1m\u001b[92m Downloaded\u001b[0m anstyle-query v1.1.5\n\u001b[1m\u001b[92m Downloaded\u001b[0m foreign-types-shared v0.1.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m fixedbitset v0.5.7\n\u001b[1m\u001b[92m Downloaded\u001b[0m dashmap v6.2.1\n\u001b[1m\u001b[92m Downloaded\u001b[0m bytes v1.11.1\n\u001b[1m\u001b[92m Compiling\u001b[0m libc v0.2.186\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_core v1.0.228\n\u001b[1m\u001b[92m Compiling\u001b[0m serde v1.0.228\n\u001b[1m\u001b[92m Compiling\u001b[0m synstructure v0.13.2\n\u001b[1m\u001b[92m Compiling\u001b[0m zerovec-derive v0.11.3\n\u001b[1m\u001b[92m Compiling\u001b[0m displaydoc v0.2.6\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio-macros v2.7.0\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_derive v1.0.228\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-macro v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl-sys v0.9.117\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-attributes v0.1.31\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl-macros v0.1.1\n\u001b[1m\u001b[92m Compiling\u001b[0m generic-array v0.14.7\n\u001b[1m\u001b[92m Compiling\u001b[0m zmij v1.0.21\n\u001b[1m\u001b[92m Compiling\u001b[0m regex-automata v0.4.14\n\u001b[1m\u001b[92m Compiling\u001b[0m getrandom v0.4.2\n\u001b[1m\u001b[92m Compiling\u001b[0m crossbeam-utils v0.8.21\n\u001b[1m\u001b[92m Compiling\u001b[0m openssl v0.10.81\n\u001b[1m\u001b[92m Compiling\u001b[0m native-tls v0.2.18\n\u001b[1m\u001b[92m Compiling\u001b[0m num-traits v0.2.19\n\u001b[1m\u001b[92m Compiling\u001b[0m strsim v0.11.1\n\u001b[1m\u001b[92m Compiling\u001b[0m ryu v1.0.23\n\u001b[1m\u001b[92m Compiling\u001b[0m block-buffer v0.10.4\n\u001b[1m\u001b[92m Compiling\u001b[0m crypto-common v0.1.7\n\u001b[1m\u001b[92m Compiling\u001b[0m winnow v0.7.15\n\u001b[1m\u001b[92m Compiling\u001b[0m heck v0.5.0\n\u001b[1m\u001b[92m Compiling\u001b[0m toml_write v0.1.2\n\u001b[1m\u001b[92m Compiling\u001b[0m thiserror v2.0.18\n\u001b[1m\u001b[92m Compiling\u001b[0m digest v0.10.7\n\u001b[1m\u001b[92m Compiling\u001b[0m parking_lot_core v0.9.12\n\u001b[1m\u001b[92m Compiling\u001b[0m errno v0.3.14\n\u001b[1m\u001b[92m Compiling\u001b[0m zerofrom-derive v0.1.7\n\u001b[1m\u001b[92m Compiling\u001b[0m yoke-derive v0.8.2\n\u001b[1m\u001b[92m Compiling\u001b[0m mio v1.2.1\n\u001b[1m\u001b[92m Compiling\u001b[0m socket2 v0.6.4\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-util v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m signal-hook-registry v1.4.8\n\u001b[1m\u001b[92m Compiling\u001b[0m parking_lot v0.12.5\n\u001b[1m\u001b[92m Compiling\u001b[0m clap_derive v4.6.1\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_json v1.0.150\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing v0.1.44\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio v1.52.3\n\u001b[1m\u001b[92m Compiling\u001b[0m clap_builder v4.6.0\n\u001b[1m\u001b[92m Compiling\u001b[0m sharded-slab v0.1.7\n\u001b[1m\u001b[92m Compiling\u001b[0m rustls-pki-types v1.14.1\n\u001b[1m\u001b[92m Compiling\u001b[0m anyhow v1.0.102\n\u001b[1m\u001b[92m Compiling\u001b[0m matchers v0.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m thiserror-impl v2.0.18\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-log v0.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m thread_local v1.1.9\n\u001b[1m\u001b[92m Compiling\u001b[0m zerofrom v0.1.8\n\u001b[1m\u001b[92m Compiling\u001b[0m encoding_rs v0.8.35\n\u001b[1m\u001b[92m Compiling\u001b[0m mime v0.3.17\n\u001b[1m\u001b[92m Compiling\u001b[0m yoke v0.8.3\n\u001b[1m\u001b[92m Compiling\u001b[0m iana-time-zone v0.1.65\n\u001b[1m\u001b[92m Compiling\u001b[0m cpufeatures v0.2.17\n\u001b[1m\u001b[92m Compiling\u001b[0m nu-ansi-term v0.50.3\n\u001b[1m\u001b[92m Compiling\u001b[0m hashbrown v0.14.5\n\u001b[1m\u001b[92m Compiling\u001b[0m sha2 v0.10.9\n\u001b[1m\u001b[92m Compiling\u001b[0m zerovec v0.11.6\n\u001b[1m\u001b[92m Compiling\u001b[0m zerotrie v0.2.4\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_spanned v0.6.9\n\u001b[1m\u001b[92m Compiling\u001b[0m toml_datetime v0.6.11\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-serde v0.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m serde_urlencoded v0.7.1\n\u001b[1m\u001b[92m Compiling\u001b[0m toml_edit v0.22.27\n\u001b[1m\u001b[92m Compiling\u001b[0m tinystr v0.8.3\n\u001b[1m\u001b[92m Compiling\u001b[0m potential_utf v0.1.5\n\u001b[1m\u001b[92m Compiling\u001b[0m futures-executor v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m tracing-subscriber v0.3.23\n\u001b[1m\u001b[92m Compiling\u001b[0m dashmap v6.2.1\n\u001b[1m\u001b[92m Compiling\u001b[0m chrono v0.4.45\n\u001b[1m\u001b[92m Compiling\u001b[0m clap v4.6.1\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_collections v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_locale_core v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m futures v0.3.32\n\u001b[1m\u001b[92m Compiling\u001b[0m regex v1.12.4\n\u001b[1m\u001b[92m Compiling\u001b[0m uuid v1.23.3\n\u001b[1m\u001b[92m Compiling\u001b[0m async-trait v0.1.89\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_provider v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m toml v0.8.23\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio-util v0.7.18\n\u001b[1m\u001b[92m Compiling\u001b[0m tower v0.5.3\n\u001b[1m\u001b[92m Compiling\u001b[0m tokio-native-tls v0.3.1\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_properties v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m icu_normalizer v2.2.0\n\u001b[1m\u001b[92m Compiling\u001b[0m h2 v0.4.14\n\u001b[1m\u001b[92m Compiling\u001b[0m idna_adapter v1.2.2\n\u001b[1m\u001b[92m Compiling\u001b[0m hyper v1.10.1\n\u001b[1m\u001b[92m Compiling\u001b[0m idna v1.1.0\n\u001b[1m\u001b[92m Compiling\u001b[0m url v2.5.8\n\u001b[1m\u001b[92m Compiling\u001b[0m hyper-util v0.1.20\n\u001b[1m\u001b[92m Compiling\u001b[0m tower-http v0.6.11\n\u001b[1m\u001b[92m Compiling\u001b[0m hyper-tls v0.6.0\n\u001b[1m\u001b[92m Compiling\u001b[0m reqwest v0.12.28\n\u001b[1m\u001b[92m Compiling\u001b[0m tent-backend v0.1.0 (/backend)\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `warn`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/embeddings.rs:28:28\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use tracing::{debug, info, warn};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `error`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:25:22\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use tracing::{debug, error, info, warn};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `error` and `warn`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:40:22\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m40\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use tracing::{debug, error, info, warn};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `c_int` and `c_uint`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:38:20\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m38\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::os::raw::{c_int, c_uint, c_ulong};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `std::ffi::CString`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/legacy.rs:35:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m35\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::ffi::CString;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `c_char`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/legacy.rs:36:20\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m36\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::os::raw::{c_char, c_ulong};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `CStr`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/types.rs:27:16\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::ffi::{CStr, CString};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `c_double` and `c_long`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/types.rs:29:28\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m29\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::os::raw::{c_char, c_double, c_int, c_uint, c_void, c_long, c_ulong};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `AtomicBool`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:14:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m14\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `EntityKind` and `legacy_normalize_phone_number`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/v1_compat.rs:8:47\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m8\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use crate::legacy::deprecations::{LegacyUuid, EntityKind, LegacyPagination, legacy_normalize_phone_number};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `super::ProtocolError`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/validate.rs:27:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use super::ProtocolError;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `MAX_MESSAGE_SIZE`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/codec.rs:25:38\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use crate::protocol::{ProtocolError, MAX_MESSAGE_SIZE, MIN_COMPATIBLE_VERSION, PROTOCOL_VERSION};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `Write`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/codec.rs:26:29\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m26\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::io::{Cursor, Read, Write};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `Ordering`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:25:36\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m25\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::sync::atomic::{AtomicU64, Ordering};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `Duration` and `Instant`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:27:17\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m27\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use std::time::{Duration, Instant};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `Deserialize` and `Serialize`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:28:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use serde::{Deserialize, Serialize};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused import: `MAX_MESSAGE_SIZE`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:31:28\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m31\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use super::{ProtocolError, MAX_MESSAGE_SIZE, DEFAULT_TIMEOUT_MS};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused imports: `FrameDecoder` and `FrameEncoder`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:32:27\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m32\u001b[0m \u001b[1m\u001b[94m|\u001b[0m use super::codec::{Frame, FrameEncoder, FrameDecoder, FLAG_REQUIRES_ACK};\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Team`: Teams are now Organizations. Use Organization instead.\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:244:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m244\u001b[0m \u001b[1m\u001b[94m|\u001b[0m EntityKind::Team => \"org\", // Legacy mapping\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(deprecated)]` on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Project`: Projects were removed in the Platform v2 migration\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:245:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m245\u001b[0m \u001b[1m\u001b[94m|\u001b[0m EntityKind::Project => \"workspace\", // Legacy mapping\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Team`: Teams are now Organizations. Use Organization instead.\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:266:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m266\u001b[0m \u001b[1m\u001b[94m|\u001b[0m EntityKind::Team\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: use of deprecated unit variant `legacy::deprecations::EntityKind::Project`: Projects were removed in the Platform v2 migration\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:267:31\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m267\u001b[0m \u001b[1m\u001b[94m|\u001b[0m | EntityKind::Project\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: variable does not need to be mutable\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:317:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m317\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let mut buffer = unsafe { &mut *c_buffer };\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m----\u001b[0m\u001b[1m\u001b[33m^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94mhelp: remove this `mut`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `initialized`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:440:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m440\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let initialized = Arc::new(AtomicBool::new(true));\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_initialized`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: variable does not need to be mutable\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/legacy.rs:267:13\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m267\u001b[0m \u001b[1m\u001b[94m|\u001b[0m let mut buffer = unsafe { &mut *c_buffer };\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m----\u001b[0m\u001b[1m\u001b[33m^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94mhelp: remove this `mut`\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `value`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/legacy/deprecations.rs:508:15\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m508\u001b[0m \u001b[1m\u001b[94m|\u001b[0m for (key, value) in configs {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_value`\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: unused variable: `obj`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/validate.rs:282:25\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m282\u001b[0m \u001b[1m\u001b[94m|\u001b[0m if let Some(obj) = value.as_object() {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^\u001b[0m \u001b[1m\u001b[33mhelp: if this is intentional, prefix it with an underscore: `_obj`\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: type `BridgeStats` is more private than the item `ConnectorBridge::stats`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:415:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m415\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn stats(&self) -> BridgeStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33mmethod `ConnectorBridge::stats` is reachable at visibility `pub`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[92mnote\u001b[0m: but type `BridgeStats` is only usable at visibility `pub(self)`\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:225:1\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m225\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct BridgeStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(private_interfaces)]` on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: type `CircuitState` is more private than the item `ConnectorBridge::circuit_state`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:423:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m423\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub fn circuit_state(&self) -> CircuitState {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m \u001b[1m\u001b[33mmethod `ConnectorBridge::circuit_state` is reachable at visibility `pub`\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[92mnote\u001b[0m: but type `CircuitState` is only usable at visibility `pub(self)`\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:79:1\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m 79\u001b[0m \u001b[1m\u001b[94m|\u001b[0m enum CircuitState {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[92m^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `NCP_TEMPERATURE` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:53:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m53\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const NCP_TEMPERATURE: f64 = 0.42;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `MIN_CONFIDENCE_THRESHOLD` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:61:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m61\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const MIN_CONFIDENCE_THRESHOLD: f64 = 0.65;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `MAX_INFERENCE_RETRIES` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:65:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m65\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const MAX_INFERENCE_RETRIES: u32 = 5;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `discovery`, `broker`, and `registry` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/mod.rs:173:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m171\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct AiOrchestrator {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m172\u001b[0m \u001b[1m\u001b[94m|\u001b[0m /// Reference to the service discovery subsystem\n\u001b[1m\u001b[94m173\u001b[0m \u001b[1m\u001b[94m|\u001b[0m discovery: Arc>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m174\u001b[0m \u001b[1m\u001b[94m|\u001b[0m /// Reference to the message broker subsystem\n\u001b[1m\u001b[94m175\u001b[0m \u001b[1m\u001b[94m|\u001b[0m broker: Arc>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\u001b[1m\u001b[94m176\u001b[0m \u001b[1m\u001b[94m|\u001b[0m /// Reference to the service registry subsystem\n\u001b[1m\u001b[94m177\u001b[0m \u001b[1m\u001b[94m|\u001b[0m registry: Arc>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `window_start` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/embeddings.rs:661:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m658\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ContextWindowManager {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m--------------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m661\u001b[0m \u001b[1m\u001b[94m|\u001b[0m window_start: Instant,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `MAX_RETRIES` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:41:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m41\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const MAX_RETRIES: u32 = 3;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `RETRY_BASE_DELAY_MS` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:44:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m44\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const RETRY_BASE_DELAY_MS: u64 = 1000;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `api_key`, `base_url`, and `client` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:453:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m452\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct AnthropicClient {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m453\u001b[0m \u001b[1m\u001b[94m|\u001b[0m api_key: String,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m454\u001b[0m \u001b[1m\u001b[94m|\u001b[0m base_url: String,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m455\u001b[0m \u001b[1m\u001b[94m|\u001b[0m models: Vec,\n\u001b[1m\u001b[94m456\u001b[0m \u001b[1m\u001b[94m|\u001b[0m client: reqwest::Client,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `AnthropicClient` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `routing_table` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:719:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m716\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ModelRouter {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-----------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m719\u001b[0m \u001b[1m\u001b[94m|\u001b[0m routing_table: RwLock>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `ModelRouter` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `cost_history` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/ai/inference.rs:951:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m947\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct TokenCounter {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m951\u001b[0m \u001b[1m\u001b[94m|\u001b[0m cost_history: RwLock>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: constant `HEALTH_CHECK_TIMEOUT_MS` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:64:7\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m64\u001b[0m \u001b[1m\u001b[94m|\u001b[0m const HEALTH_CHECK_TIMEOUT_MS: u64 = 1000;\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `id` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:152:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m151\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct PoolEntry {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m152\u001b[0m \u001b[1m\u001b[94m|\u001b[0m id: usize,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: method `stats` is never used\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:195:8\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m163\u001b[0m \u001b[1m\u001b[94m|\u001b[0m impl ConnectionPool {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-------------------\u001b[0m \u001b[1m\u001b[94mmethod in this implementation\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m195\u001b[0m \u001b[1m\u001b[94m|\u001b[0m fn stats(&self) -> PoolStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: struct `PoolStats` is never constructed\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:203:8\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m203\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct PoolStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `circuit_breaker_trips` and `health_check_failures` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/connector/bridge.rs:229:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m225\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct BridgeStats {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-----------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m229\u001b[0m \u001b[1m\u001b[94m|\u001b[0m circuit_breaker_trips: u64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m230\u001b[0m \u001b[1m\u001b[94m|\u001b[0m health_check_failures: u64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `BridgeStats` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `consumers` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/messaging/mod.rs:38:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m35\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct MessageBroker {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m38\u001b[0m \u001b[1m\u001b[94m|\u001b[0m consumers: DashMap>>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `version` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/messages.rs:293:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m291\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct MessageRegistry {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m292\u001b[0m \u001b[1m\u001b[94m|\u001b[0m handlers: HashMap,\n\u001b[1m\u001b[94m293\u001b[0m \u001b[1m\u001b[94m|\u001b[0m version: u32,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `version` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/serialize.rs:258:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m255\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct Schema {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m258\u001b[0m \u001b[1m\u001b[94m|\u001b[0m version: u32,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `required` and `default_value` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/serialize.rs:264:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m261\u001b[0m \u001b[1m\u001b[94m|\u001b[0m struct SchemaField {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m-----------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m264\u001b[0m \u001b[1m\u001b[94m|\u001b[0m required: bool,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m265\u001b[0m \u001b[1m\u001b[94m|\u001b[0m default_value: Option,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: variant `Custom` is never constructed\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/serialize.rs:276:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m269\u001b[0m \u001b[1m\u001b[94m|\u001b[0m enum FieldValidation {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mvariant in this enum\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m276\u001b[0m \u001b[1m\u001b[94m|\u001b[0m Custom(String),\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: fields `next_request_id`, `pending_requests`, `serializer`, and `timeout_ms` are never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:218:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m217\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct RpcClient {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------\u001b[0m \u001b[1m\u001b[94mfields in this struct\u001b[0m\n\u001b[1m\u001b[94m218\u001b[0m \u001b[1m\u001b[94m|\u001b[0m next_request_id: AtomicU64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m219\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pending_requests: Arc, RpcError>>>>>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m220\u001b[0m \u001b[1m\u001b[94m|\u001b[0m serializer: Serializer,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\u001b[1m\u001b[94m221\u001b[0m \u001b[1m\u001b[94m|\u001b[0m timeout_ms: u64,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `serializer` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/protocol/rpc.rs:271:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m269\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct RpcServer {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m270\u001b[0m \u001b[1m\u001b[94m|\u001b[0m handlers: HashMap,\n\u001b[1m\u001b[94m271\u001b[0m \u001b[1m\u001b[94m|\u001b[0m serializer: Serializer,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: field `events` is never read\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/registry/mod.rs:31:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m28\u001b[0m \u001b[1m\u001b[94m|\u001b[0m pub struct ServiceRegistry {\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[94m---------------\u001b[0m \u001b[1m\u001b[94mfield in this struct\u001b[0m\n\u001b[1m\u001b[94m...\u001b[0m\n\u001b[1m\u001b[94m31\u001b[0m \u001b[1m\u001b[94m|\u001b[0m events: Arc>>,\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^\u001b[0m\n\n\u001b[1m\u001b[33mwarning\u001b[0m: `tent-backend` (lib) generated 52 warnings (run `cargo fix --lib -p tent-backend` to apply 23 suggestions)\n\u001b[1m\u001b[92m Finished\u001b[0m `dev` profile [unoptimized + debuginfo] target(s) in 2m 14s" + }, + { + "name": "frontend", + "status": "PASS", + "elapsed_seconds": 29.334, + "artifact": "frontend/dist", + "output": "> tent-frontend@0.0.0 build\n> tsc -b && vite build\n\nvite v6.4.3 building for production...\ntransforming...\n\u2713 100 modules transformed.\nrendering chunks...\ncomputing gzip size...\ndist/index.html 0.63 kB \u2502 gzip: 0.35 kB\ndist/assets/state-BkjSKDbY.js 8.91 kB \u2502 gzip: 3.54 kB \u2502 map: 57.15 kB\ndist/assets/vendor-CREcWLHI.js 48.93 kB \u2502 gzip: 17.25 kB \u2502 map: 481.27 kB\ndist/assets/index-CyxcoTyU.js 231.32 kB \u2502 gzip: 72.16 kB \u2502 map: 1,045.57 kB\n\u2713 built in 5.86s\nnpm notice\nnpm notice New major version of npm available! 10.9.4 -> 11.17.0\nnpm notice Changelog: https://github.com/npm/cli/releases/tag/v11.17.0\nnpm notice To update run: npm install -g npm@11.17.0\nnpm notice" + }, + { + "name": "market", + "status": "PASS", + "elapsed_seconds": 7.504, + "artifact": "market/market", + "output": "go: downloading go.uber.org/zap v1.27.0\ngo: downloading github.com/shopspring/decimal v1.4.0\ngo: downloading github.com/google/uuid v1.6.0\ngo: downloading github.com/gorilla/websocket v1.5.3\ngo: downloading go.uber.org/multierr v1.10.0" + }, + { + "name": "frailbox", + "status": "FAIL", + "elapsed_seconds": 0.509, + "artifact": null, + "output": "gcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude -MMD -MP -c src/arena.c -o build/src/arena.o\nsrc/arena.c: In function 'region_alloc':\nsrc/arena.c:13:36: error: 'MAP_ANONYMOUS' undeclared (first use in this function)\n 13 | int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;\n | ^~~~~~~~~~~~~\nsrc/arena.c:13:36: note: each undeclared identifier is reported only once for each function it appears in\nsrc/arena.c:17:23: error: 'MAP_HUGETLB' undeclared (first use in this function)\n 17 | mmap_flags |= MAP_HUGETLB;\n | ^~~~~~~~~~~\nsrc/arena.c: In function 'arena_contains':\nsrc/arena.c:179:17: warning: comparison of distinct pointer types lacks a cast\n 179 | ptr < (char *)region->start + region->size) {\n | ^\nmake: *** [Makefile:27: build/src/arena.o] Error 1" + }, + { + "name": "engine", + "status": "FAIL", + "elapsed_seconds": 5.289, + "artifact": null, + "output": "[ 11%] Building CXX object CMakeFiles/trial-engine.dir/main.cpp.o\n/frailbox/engine/main.cpp:12:10: fatal error: format: No such file or directory\n 12 | #include \n | ^~~~~~~~\ncompilation terminated.\ngmake[2]: *** [CMakeFiles/trial-engine.dir/build.make:76: CMakeFiles/trial-engine.dir/main.cpp.o] Error 1\ngmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/trial-engine.dir/all] Error 2\ngmake: *** [Makefile:136: all] Error 2" + }, + { + "name": "compliance", + "status": "PASS", + "elapsed_seconds": 2.001, + "artifact": "compliance/build", + "output": "" + }, + { + "name": "v2-market-stream", + "status": "PASS", + "elapsed_seconds": 0.028, + "artifact": null, + "output": "Syntax OK\nruby: warning: shebang line ending with \\r may cause problems" + }, + { + "name": "nfc-scanner", + "status": "PASS", + "elapsed_seconds": 0.006, + "artifact": null, + "output": "" + }, + { + "name": "openapi-haskell", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [Errno 2] No such file or directory: 'ghc'" + }, + { + "name": "openapi-tools", + "status": "PASS", + "elapsed_seconds": 0.018, + "artifact": null, + "output": "" + } + ], + "pr_note": "Include the encrypted diagnostic logd artifact(s): diagnostic/build-0c8d9252.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/diagnostic/build-0c8d9252.logd b/diagnostic/build-0c8d9252.logd new file mode 100644 index 000000000..d51fccdf4 Binary files /dev/null and b/diagnostic/build-0c8d9252.logd differ diff --git a/tests/test_diagnostic_regression.py b/tests/test_diagnostic_regression.py new file mode 100644 index 000000000..3e0df3954 --- /dev/null +++ b/tests/test_diagnostic_regression.py @@ -0,0 +1,299 @@ +import importlib.util +import json +import os +import tempfile +import unittest +import time +from pathlib import Path +from unittest import mock + + +REPO_ROOT = Path(__file__).resolve().parents[1] +BUILD_PY = REPO_ROOT / "build.py" + +spec = importlib.util.spec_from_file_location("build", BUILD_PY) +build = importlib.util.module_from_spec(spec) +assert spec.loader is not None +spec.loader.exec_module(build) + + +class DiagnosticRedactionTests(unittest.TestCase): + def test_metadata_paths_are_repo_relative_and_sensitive_values_are_redacted(self): + output = "\n".join( + [ + f"repo={build.ROOT}", + f"home={Path.home()}", + f"temp={tempfile.gettempdir()}", + f"machine={build.platform.node()}", + f"user={build.getpass.getuser()}", + ] + ) + artifact = build.ROOT / "backend" / "target" / "debug" / "backend" + + report = build.build_diagnostic_report( + [("backend", True, 1.25, output, str(artifact))], + "deadbeef", + logd_relpaths=["diagnostic/build-deadbeef.logd"], + password="test-password", + ) + + self.assertEqual(report["diagnostic_logd"], "diagnostic/build-deadbeef.logd") + self.assertEqual( + build.repo_relative_path(r"diagnostic\build-deadbeef.logd"), + "diagnostic/build-deadbeef.logd", + ) + self.assertEqual( + report["decrypt_command"], + "encryptly unpack diagnostic/build-deadbeef.logd --password test-password", + ) + self.assertEqual(report["modules"][0]["artifact"], "backend/target/debug/backend") + + encoded = json.dumps(report, sort_keys=True) + self.assertNotIn(str(build.ROOT), encoded) + self.assertNotIn(str(build.ROOT).replace("\\", "/"), encoded) + self.assertNotIn(str(Path.home()), encoded) + self.assertNotIn(str(Path.home()).replace("\\", "/"), encoded) + self.assertNotIn(tempfile.gettempdir(), encoded) + self.assertNotIn(build.platform.node(), encoded) + self.assertNotIn(build.getpass.getuser(), encoded) + + def test_chunked_decrypt_command_uses_forward_slash_paths(self): + report = build.build_diagnostic_report( + [("backend", True, 1.25, "", None)], + "deadbeef", + logd_relpaths=[ + r"diagnostic\build-deadbeef-part001.logd", + r"diagnostic\build-deadbeef-part002.logd", + ], + password="test-password", + chunked=True, + ) + + self.assertEqual( + report["diagnostic_logd"], + [ + "diagnostic/build-deadbeef-part001.logd", + "diagnostic/build-deadbeef-part002.logd", + ], + ) + self.assertEqual( + report["decrypt_command"], + "encryptly unpack diagnostic/build-deadbeef.logd --password test-password", + ) + self.assertNotIn("\\", json.dumps(report, sort_keys=True)) + + def test_logd_reference_must_match_generated_artifact(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + logd_path = diagnostic_dir / "build-deadbeef.logd" + logd_path.write_bytes(b"logd") + metadata_path.write_text( + json.dumps({"diagnostic_logd": "diagnostic/build-deadbeef.logd"}), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + build.validate_diagnostic_pair(metadata_path, expected_logd_paths=[logd_path]) + + def test_missing_json_fails_clearly(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + metadata_path = diagnostic_dir / "missing.json" + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "metadata JSON missing"): + build.validate_diagnostic_pair(metadata_path) + + def test_missing_logd_fails_clearly(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + metadata_path.write_text( + json.dumps({"diagnostic_logd": "diagnostic/build-deadbeef.logd"}), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "diagnostic \\.logd missing"): + build.validate_diagnostic_pair(metadata_path) + + def test_mismatched_logd_reference_fails_clearly(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + actual_logd = diagnostic_dir / "build-deadbeef.logd" + expected_logd = diagnostic_dir / "build-cafebabe.logd" + actual_logd.write_bytes(b"logd") + expected_logd.write_bytes(b"logd") + metadata_path.write_text( + json.dumps({"diagnostic_logd": "diagnostic/build-deadbeef.logd"}), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "diagnostic_logd mismatch"): + build.validate_diagnostic_pair(metadata_path, expected_logd_paths=[expected_logd]) + + def test_windows_absolute_logd_reference_fails_clearly(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + metadata_path.write_text( + json.dumps({"diagnostic_logd": r"C:\Users\builder\build-deadbeef.logd"}), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "repo-relative"): + build.validate_diagnostic_pair(metadata_path) + + def test_posix_absolute_logd_reference_fails_clearly_on_every_platform(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + metadata_path.write_text( + json.dumps({"diagnostic_logd": "/tmp/build-deadbeef.logd"}), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "repo-relative"): + build.validate_diagnostic_pair(metadata_path) + + def test_empty_logd_list_entry_fails_clearly(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + (diagnostic_dir / "build-deadbeef-part001.logd").write_bytes(b"logd") + metadata_path.write_text( + json.dumps({"diagnostic_logd": ["diagnostic/build-deadbeef-part001.logd", ""]}), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "non-empty"): + build.validate_diagnostic_pair(metadata_path) + + def test_chunked_logd_reference_requires_every_part(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + diagnostic_dir = root / "diagnostic" + diagnostic_dir.mkdir() + metadata_path = diagnostic_dir / "build-deadbeef.json" + (diagnostic_dir / "build-deadbeef-part001.logd").write_bytes(b"logd") + metadata_path.write_text( + json.dumps( + { + "diagnostic_logd": [ + "diagnostic/build-deadbeef-part001.logd", + "diagnostic/build-deadbeef-part002.logd", + ] + } + ), + encoding="utf-8", + ) + + with patched_diagnostic_root(root, diagnostic_dir): + with self.assertRaisesRegex(build.DiagnosticValidationError, "part002"): + build.validate_diagnostic_pair(metadata_path) + + def test_external_artifact_path_is_reduced_to_filename(self): + outside_artifact = Path(tempfile.gettempdir()) / "outside" / "service.bin" + report = build.build_diagnostic_report( + [("backend", True, 1.25, "", str(outside_artifact))], + "deadbeef", + logd_relpaths=["diagnostic/build-deadbeef.logd"], + password="test-password", + ) + + self.assertEqual(report["modules"][0]["artifact"], "external/service.bin") + self.assertNotIn(tempfile.gettempdir(), json.dumps(report, sort_keys=True)) + + def test_non_utf8_output_uses_ascii_fallbacks(self): + fake_stdout = FakeStdout("gbk") + with mock.patch.object(build.sys, "stdout", fake_stdout): + warning = build.safe_text( + "\u26a0 Some tools missing - will try anyway:", + "WARNING Some tools missing - will try anyway:", + ) + status = build.mark("\u2713", "+") + separator = build.rule(8) + + warning.encode("gbk") + status.encode("gbk") + separator.encode("gbk") + self.assertEqual(warning, "WARNING Some tools missing - will try anyway:") + self.assertEqual(status, "+") + self.assertEqual(separator, "--------") + + def test_frontend_npm_install_missing_returns_failure(self): + with tempfile.TemporaryDirectory() as tmp: + module = build.Module( + name="frontend", + language="TypeScript", + dir=Path(tmp), + build_cmd=["npm", "run", "build"], + clean_cmd=[], + ) + + def fake_run(*args, **kwargs): + raise FileNotFoundError("npm") + + with mock.patch.object(build.subprocess, "run", side_effect=fake_run): + with mock.patch.object(time, "time", side_effect=[100.0, 101.25]): + success, elapsed, output = build.build_module(module) + + self.assertFalse(success) + self.assertEqual(elapsed, 1.25) + self.assertIn("npm install command not found", output) + + def test_engine_cmake_missing_returns_failure(self): + with tempfile.TemporaryDirectory() as tmp: + module = build.Module( + name="engine", + language="C++", + dir=Path(tmp), + build_cmd=["cmake", "--build", "build"], + clean_cmd=[], + ) + + def fake_run(*args, **kwargs): + raise FileNotFoundError("cmake") + + with mock.patch.object(build.subprocess, "run", side_effect=fake_run): + with mock.patch.object(time, "time", side_effect=[200.0, 202.5]): + success, elapsed, output = build.build_module(module) + + self.assertFalse(success) + self.assertEqual(elapsed, 2.5) + self.assertIn("CMake configure command not found", output) + + +def patched_diagnostic_root(root: Path, diagnostic_dir: Path): + return mock.patch.multiple(build, ROOT=root, DIAGNOSTIC_DIR=diagnostic_dir) + + +class FakeStdout: + def __init__(self, encoding: str): + self.encoding = encoding + + def isatty(self): + return False + + +if __name__ == "__main__": + unittest.main()