Commit graph

3 commits

Author SHA1 Message Date
Devin AI
f6f9122d24 fix(infra): write_jsonl mkdir+sort_keys, q16_div raise on zero
- write_jsonl: add path.parent.mkdir(parents=True, exist_ok=True) to
  prevent FileNotFoundError when output dir doesn't exist
- write_jsonl: add sort_keys=True to match original callers' deterministic
  output behavior (AGENTS.md: identical SHA256 on consecutive runs)
- q16_div: raise ZeroDivisionError instead of silently returning 0,
  matching the original fractal_dimension.py semantics

Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
2026-06-16 01:20:56 +00:00
Devin AI
a496d8d3ce fix(infra): Q16_SCALE int not float, add missing Path/sys imports
- Q16_SCALE: float → int in lib/q16.py (int // float returns float,
  breaking Q16_16 integer contract in gccl_waveprobe, vcn_famm_transport)
- qr_spatial_hash.py: sys → _sys (only _sys was imported)
- Add missing 'from pathlib import Path' to 7 files that use Path()
  without importing it: test_fpga, compare_tier1_vs_tier2,
  generate_avm_gold_trace, burgers_triad_core, hot_path_cold_path,
  sabotage_prevention, generate_diat_tables
- hot_path_cold_path.py: also add missing 'import sys'

Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
2026-06-16 01:16:31 +00:00
Devin AI
e5f04ee6c3 refactor(infra): extract shared utilities from duplicated code patterns
Create 4-Infrastructure/lib/ with canonical implementations of:
- hashing.py: sha256_bytes, sha256_text, sha256_file
- q16.py: Q16_16 fixed-point constants and arithmetic
- jsonl.py: load_json, load_jsonl, write_jsonl, stable_json, canonical_json_bytes
- fraction_utils.py: Fraction serialization helpers for hardware probes

Refactor 66 files across 4-Infrastructure/{hardware,shim,infra} and
5-Applications/{scripts,tools-scripts,hutter_prize,text-to-cad} to import
from the shared library instead of maintaining local copies.

4-Infrastructure/auto/lib/q16.py now re-exports from lib.q16.

Net: -743 lines (490 added, 1233 removed)

Build: not applicable (Python-only change, py_compile verified on all 71 files)
Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
2026-06-15 02:26:45 +00:00