Commit graph

91 commits

Author SHA1 Message Date
Jeremie Fraeys
ef7d19db9b
feat(cli): integrate ProgressBar into sync command
Update progress.zig and integrate into sync command:
- progress.zig: update import from colors.zig to io.zig
- sync.zig: add ProgressBar for multi-run sync operations
- Shows progress bar when syncing 2+ runs (not in JSON mode)
- Updates progress after each successful sync

Benefits:
- Better UX for long-running sync operations
- Visual feedback on sync progress
- Maintains clean output for single runs

All tests pass.
2026-03-04 21:23:16 -05:00
Jeremie Fraeys
94441fdc76
fix(cli): update imports after logging.zig removal
Update files still referencing deleted logging.zig:
- prune.zig: import io.zig, replace logging. with io.
- deps.zig: re-export log from io module

All zig tests now pass.
2026-03-04 21:18:18 -05:00
Jeremie Fraeys
5b0bd83bd7
refactor(cli): remove logging.zig, consolidate into io.zig
Remove redundant logging.zig (28 lines):
- Functions moved to io.zig: printInfo, printSuccess, printWarning, printError, printProgress, confirm
- All functionality preserved with re-exports in utils.zig

Benefits:
- Reduced file count (22 → 21 utils)
- Single source of truth for I/O operations
- No functional changes

Build passes successfully.
2026-03-04 21:14:27 -05:00
Jeremie Fraeys
cf7e82c758
refactor(cli): consolidate JSON utilities into io.zig
Move JSON accessor functions to io.zig:
- jsonGetString, jsonGetInt, jsonGetFloat, jsonGetBool
- json.zig now re-exports from io.zig for backward compatibility

Benefits:
- Single location for all I/O related utilities
- Consistent with terminal/color consolidation
- Reduced file count

Build passes successfully.
2026-03-04 21:07:04 -05:00
Jeremie Fraeys
00ffeb93c8
refactor(cli): add flattened re-exports to utils.zig for cleaner imports
Simplify imports by providing direct re-exports:
- utils.isTTY, utils.getWidth (instead of utils.terminal.isTTY)
- utils.reset, utils.red, utils.green (instead of utils.colors.reset)
- Mark colors, terminal, logging as consolidated into io.zig
- Mark rsync modules as deprecated

Benefits:
- Shorter import paths for common utilities
- Reduced typing: utils.red vs utils.colors.red
- Backward compatibility maintained

Build passes successfully.
2026-03-04 21:06:13 -05:00
Jeremie Fraeys
87cefea9ae
refactor(cli): consolidate terminal and color utilities into io.zig
Consolidate overlapping utilities:
- colors.zig (35 lines) → re-exports from io.zig
- terminal.zig (36 lines) → re-exports from io.zig
- io.zig now contains all terminal, color, and I/O utilities

Benefits:
- Single source of truth for terminal/color logic
- Reduced file count (25 → 23 utils)
- Easier maintenance with all I/O in one place

Build passes successfully.
2026-03-04 21:05:37 -05:00
Jeremie Fraeys
7a6d454174
refactor(cli): modularize queue.zig structure
Move configuration types to queue/mod.zig:
- TrackingConfig with MLflow, TensorBoard, Wandb sub-configs
- QueueOptions with all queue-related options

queue.zig now re-exports from queue/mod.zig for backward compatibility.
Build passes successfully.
2026-03-04 21:00:23 -05:00
Jeremie Fraeys
c17811cf2b
refactor(cli): create modular WebSocket client structure
Break monolithic client.zig (1,558 lines) into focused modules:
- connection.zig: Transport, connection logic, URL parsing, TLS setup
- messaging.zig: MessageBuilder, validation, send methods
- state.zig: ClientState, response handling, error conversion
- mod.zig: Public exports and Client struct composition

Benefits:
- Each module <400 lines (maintainability target)
- Clear separation of concerns
- Easier to test individual components
- Foundation for future client refactoring

Original client.zig kept intact for backward compatibility.
Build passes successfully.
2026-03-04 20:58:11 -05:00
Jeremie Fraeys
fd4c342de0
refactor(cli): implement production-ready TLS and UUID generation
Remove simplified placeholders and implement production versions:
- db.zig: Update UUID comment to reflect crypto RNG is already in use
- tls.zig: Implement proper TLS 1.2 ClientHello message construction
  - Full record layer header with correct version
  - Proper handshake header
  - 32-byte cryptographically secure random bytes
  - SNI extension with hostname
  - ECDHE cipher suites for forward secrecy
  - Correct length calculations for all fields

Build passes successfully with production implementations.
2026-03-04 20:41:15 -05:00
Jeremie Fraeys
bb584b3410
test(cli): fix and update hash tests for current architecture
Fix broken hash tests to work with current CLI architecture:
- Update import to use @import(src) module system
- Add hash module export to utils.zig
- Make validatePath() public for testing
- Fix Zig 0.15 API: writeFile options struct, var tmp_dir for cleanup
- Fix file paths: use tmp_dir realpath for hashFile
- Replace std.fs.MAX_PATH_BYTES with 4096 buffer

All hash tests now passing.
2026-03-04 20:35:19 -05:00
Jeremie Fraeys
69951ce5a1
test: update test infrastructure and documentation
Update tests and documentation:
- native/README.md: document C++ native library plans
- restart_recovery_test.go: scheduler restart/recovery tests
- scheduler_fixture.go: test fixtures for scheduler
- hash_test.zig: SHA-NI hash tests (WIP)

Improves test coverage and documentation.
2026-03-04 20:25:48 -05:00
Jeremie Fraeys
dbecb2b521
refactor(cli): update protocol and main entry point
Update core protocol and application structure:
- protocol.zig: enhanced binary protocol handling
- main.zig: updated entry point for new command structure
- manifest.zig: improved manifest handling

Part of CLI hardening architecture improvements.
2026-03-04 20:25:40 -05:00
Jeremie Fraeys
89635b1d8c
build(cli): update build configuration
Update build system for new modules:
- Makefile: add build targets for new components
- build.zig: include new source files in build graph

Supports new CLI architecture.
2026-03-04 20:25:31 -05:00
Jeremie Fraeys
6a0555207e
refactor(cli): remove deprecated native hash modules
Remove obsolete native hash implementation files:
- Delete native/hash.zig (superseded by utils/hash.zig)
- Delete utils/native_bridge.zig (replaced by direct TLS)
- Delete utils/native_hash.zig (consolidated into utils/hash.zig)

Cleanup as part of CLI hardening.
2026-03-04 20:25:25 -05:00
Jeremie Fraeys
4c2af17ad6
feat(cli): consolidate and improve command implementations
Update command structure with improved implementations:
- exec.zig: consolidated command execution
- queue.zig: improved job queuing with narrative support
- run.zig: enhanced local run execution
- dataset.zig, dataset_hash.zig: improved dataset management

Part of CLI hardening for better UX and reliability.
2026-03-04 20:24:28 -05:00
Jeremie Fraeys
f1965b99bd
feat(cli): add progress tracking and sync management
Add progress reporting and offline sync infrastructure:
- progress.zig: progress bars and status reporting
- sync_manager.zig: offline run synchronization manager

Supports resilient operation with server connectivity issues.
2026-03-04 20:23:17 -05:00
Jeremie Fraeys
524f440fe4
feat(cli): add core system components for CLI hardening
Add signal handling, environment detection, and secrets management:
- signals.zig: graceful Ctrl+C handling and signal management
- environment.zig: user environment detection for telemetry
- secrets.zig: secrets redaction for secure logging

Improves CLI reliability and security posture.
2026-03-04 20:23:12 -05:00
Jeremie Fraeys
8ae0875800
feat(cli): add synced column support to experiment commands
Update experiment creation to track sync status:
- Insert experiments with synced=0 (not synced to server)
- Align with schema update in db.zig for offline tracking

Part of offline run synchronization feature.
2026-03-04 20:23:06 -05:00
Jeremie Fraeys
303f17d3b2
feat(cli): implement sync tracking for offline run synchronization
Add SQLite-based sync tracking infrastructure:
- Add synced column to ml_experiments schema (0=not synced, 1=synced)
- Implement SyncDB with initOrOpenSyncDB for sync_pending table
- Add markForSync, markAsSynced, getPendingRuns functions
- Fix SQLite error handling for Zig 0.15 compatibility

Enables tracking experiments that need server synchronization when offline.
2026-03-04 20:22:56 -05:00
Jeremie Fraeys
fedaba2409
feat(cli): implement CPUID-based SHA-NI detection for hash operations
Add hardware-accelerated hash detection:
- Implement hasShaNi() using CPUID inline assembly for x86_64
- Detect SHA-NI support (bit 29 of EBX in leaf 7, subleaf 0)
- Cross-platform fallback for non-x86_64 architectures
- Enables hardware-accelerated SHA-256 when available

Improves hashing performance on modern Intel/AMD CPUs.
2026-03-04 20:22:21 -05:00
Jeremie Fraeys
cce3ab83ee
feat(cli): implement TLS/WSS support for WebSocket connections
Add TLS transport abstraction for secure WebSocket connections:
- Create tls.zig module with TlsStream struct for TLS-encrypted sockets
- Implement Transport union in client.zig supporting both TCP and TLS
- Update frame.zig and handshake.zig to use Transport abstraction
- Add TLS handshake, read, write, flush, and close operations
- Support TLS 1.2/1.3 protocol versions with error handling
- Zig 0.15 compatible ArrayList API usage

Enables wss:// protocol support for encrypted server communication.
2026-03-04 20:22:12 -05:00
Jeremie Fraeys
743bc4be3b
cli: update Zig CLI build and native hash integration
- Update build.zig configuration
- Improve queue command implementation
- Enhance native hash support
2026-03-04 13:23:30 -05:00
Jeremie Fraeys
54ddab887e
build: update Makefile and Zig build for new targets
**Makefile:**
- Add native build targets and test infrastructure
- Update benchmark and CI test commands

**cli/build.zig:**
- Build configuration updates for CLI compilation
2026-02-23 18:03:47 -05:00
Jeremie Fraeys
7d1ba75092
chore: Update security scan workflow and SQLite build script 2026-02-23 14:24:00 -05:00
Jeremie Fraeys
6faa13aabf
refactor(cli): Remove progress UI and update native/server code
Delete cli/src/ui/progress.zig (removing progress bars/spinners)

Update native GPU detection modules

Update server experiment API
2026-02-23 14:12:48 -05:00
Jeremie Fraeys
fd317c9791
refactor(cli): Update network handlers and info command
Replace Unicode symbols with ASCII in handshake.zig

Add [OK]/[FAIL] status indicators in response_handlers.zig

Simplify info.zig output formatting
2026-02-23 14:12:22 -05:00
Jeremie Fraeys
2b7319dc2e
refactor(cli): Simplify output system and add terminal utilities
Remove colors dependency from output.zig

Add terminal.zig for TTY detection and terminal width

Update flags.zig with color flag support

Simplify colors.zig to basic ANSI codes

Update main.zig and utils.zig exports
2026-02-23 14:11:59 -05:00
Jeremie Fraeys
a1988de8b1
style(cli): Standardize printUsage() formatting with tabs and ASCII symbols
Replace space-padding with consistent tab (\t) alignment in all printUsage() functions.

Add ligature-friendly ASCII symbols:

  - => for results/outcomes (renders as ⇒ with ligatures)

  - ~> for modifications/changes (renders as ~> with ligatures)

  - -> for state transitions (renders as → with ligatures)

  - [OK] / [FAIL] for status indicators

All symbols use ASCII 32-126 for xargs-safe, copy-pasteable output.
2026-02-23 14:09:49 -05:00
Jeremie Fraeys
3b194ff2e8
feat: GPU detection transparency and artifact scanner improvements
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 6s
CI/CD Pipeline / Test (push) Failing after 1s
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been skipped
CI/CD Pipeline / Build (push) Has been skipped
CI/CD Pipeline / Test Scripts (push) Has been skipped
CI/CD Pipeline / Test Native Libraries (push) Has been skipped
CI/CD Pipeline / GPU Golden Test Matrix (push) Has been skipped
Documentation / build-and-publish (push) Failing after 39s
CI/CD Pipeline / Docker Build (push) Has been skipped
- Surface GPUDetectionInfo from parseGPUCountFromConfig for detection metadata
- Document FETCH_ML_TOTAL_CPU and FETCH_ML_GPU_SLOTS_PER_GPU env vars
- Add debug logging for all env var overrides to stderr
- Track config-layer auto-detection in GPUDetectionInfo.ConfigLayerAutoDetected
- Add --include-all flag to artifact scanner (includeAll parameter)
- Add AMD production mode enforcement (error in non-local mode)
- Add GPU detector unit tests for env overrides and AMD aliasing
2026-02-23 12:29:34 -05:00
Jeremie Fraeys
ec568b4c85
fix(build): link libc for Zig tests using C imports
Some checks failed
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been cancelled
CI/CD Pipeline / Build (push) Has been cancelled
CI/CD Pipeline / Test Scripts (push) Has been cancelled
CI/CD Pipeline / Test Native Libraries (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Has been cancelled
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Has been cancelled
Build CLI with Embedded SQLite / build-macos (arm64) (push) Has been cancelled
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Has been cancelled
2026-02-21 21:19:09 -05:00
Jeremie Fraeys
03ed1a05bf
fix(build): add iterate permission for test directory
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI/CD Pipeline / Test (push) Failing after 5m50s
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been skipped
CI/CD Pipeline / Build (push) Has been skipped
CI/CD Pipeline / Test Scripts (push) Has been skipped
CI/CD Pipeline / Test Native Libraries (push) Has been skipped
Documentation / build-and-publish (push) Failing after 41s
CI/CD Pipeline / Docker Build (push) Has been skipped
Zig 0.15 requires .iterate = true flag when opening directories for iteration

Fixes panic: reached unreachable code in std.fs.Dir.iterate
2026-02-21 21:10:48 -05:00
Jeremie Fraeys
39bf466737
refactor(build): fetch SHA256 from official sources
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been cancelled
CI/CD Pipeline / Build (push) Has been cancelled
CI/CD Pipeline / Test Scripts (push) Has been cancelled
CI/CD Pipeline / Test Native Libraries (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
- SQLite: fetch from sqlite.org/<YEAR>/<file>.zip.sha256 with embedded fallback

- Rsync: fetch from download.samba.org/.../<file>.tar.gz.sha256 with embedded fallback

- Remove hardcoded SHA256 requirement when official checksums available
2026-02-21 21:00:23 -05:00
Jeremie Fraeys
2d66a85abc
ci: add SHA256 verification for SQLite and fix CLI build
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been cancelled
CI/CD Pipeline / Build (push) Has been cancelled
CI/CD Pipeline / Test Scripts (push) Has been cancelled
CI/CD Pipeline / Test Native Libraries (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
- Add SHA256 verification to build_sqlite.sh (SQLite 3.48.0)

- Add build-sqlite and CLI build steps to ci.yml build job

- Remove cache from benchmark-metrics.yml
2026-02-21 20:58:08 -05:00
Jeremie Fraeys
f6c3e650b5
fix(build): disable openssl in rsync build to fix missing headers
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI with Native Libraries / Check Build Environment (push) Successful in 11s
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been cancelled
CI/CD Pipeline / Build (push) Has been cancelled
CI/CD Pipeline / Test Scripts (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
CI with Native Libraries / Build Release Libraries (push) Has been cancelled
CI with Native Libraries / Build and Test Native Libraries (push) Has been cancelled
rsync configure requires --disable-openssl when OpenSSL dev headers unavailable

Also removes dependency on openssl/md4.h and openssl/md5.h
2026-02-21 20:48:13 -05:00
Jeremie Fraeys
2e2bba47a2
fix(build): disable pipefail around tar head pipe to prevent SIGPIPE
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
CI with Native Libraries / Build and Test Native Libraries (push) Blocked by required conditions
CI with Native Libraries / Build Release Libraries (push) Blocked by required conditions
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI with Native Libraries / Check Build Environment (push) Successful in 11s
CI/CD Pipeline / Test (push) Failing after 1m3s
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been skipped
CI/CD Pipeline / Build (push) Has been skipped
CI/CD Pipeline / Test Scripts (push) Has been skipped
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
The tar | head -n 1 | cut pipeline causes SIGPIPE (error 141)

when head closes the pipe before tar finishes writing
2026-02-21 20:46:15 -05:00
Jeremie Fraeys
7bc1c8a982
fix(build): avoid SIGPIPE in rsync SHA256 verification
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
CI with Native Libraries / Build and Test Native Libraries (push) Blocked by required conditions
CI with Native Libraries / Build Release Libraries (push) Blocked by required conditions
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI with Native Libraries / Check Build Environment (push) Successful in 11s
CI/CD Pipeline / Test (push) Failing after 1m3s
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been skipped
CI/CD Pipeline / Build (push) Has been skipped
CI/CD Pipeline / Test Scripts (push) Has been skipped
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
Replace echo | sha256sum -c - pipeline with direct comparison

Fixes error 141 (SIGPIPE) caused by pipefail with early pipe close
2026-02-21 20:44:27 -05:00
Jeremie Fraeys
97c066af4f
fix(build): add rsync SHA256 hash to skip GPG verification
Some checks failed
Build CLI with Embedded SQLite / build (arm64, aarch64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build (x86_64, x86_64-linux) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (arm64) (push) Waiting to run
Build CLI with Embedded SQLite / build-macos (x86_64) (push) Waiting to run
CI with Native Libraries / Build and Test Native Libraries (push) Blocked by required conditions
CI with Native Libraries / Build Release Libraries (push) Blocked by required conditions
Documentation / build-and-publish (push) Waiting to run
Security Scan / Security Analysis (push) Waiting to run
Security Scan / Native Library Security (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI with Native Libraries / Check Build Environment (push) Successful in 11s
CI/CD Pipeline / Test (push) Failing after 1m3s
CI/CD Pipeline / Dev Compose Smoke Test (push) Has been skipped
CI/CD Pipeline / Build (push) Has been skipped
CI/CD Pipeline / Test Scripts (push) Has been skipped
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build (push) Has been cancelled
Add SHA256 for rsync 3.3.0: 7399e9a6708c32d678a72a63219e96f23be0be2336e50fd1348498d07041df90

This allows the build to proceed without requiring GPG keyring setup in CI
2026-02-21 20:42:35 -05:00
Jeremie Fraeys
be39b37aec
feat: native GPU detection and NVML bridge for macOS and Linux
- Add dynamic NVML loading for Linux GPU detection
- Add macOS GPU detection via IOKit framework
- Add Zig NVML wrapper for cross-platform GPU queries
- Update native bridge to support platform-specific GPU libs
- Add CMake support for NVML dynamic library
2026-02-21 17:59:59 -05:00
Jeremie Fraeys
1a1844e9e9
fix(cli): remaining ArrayList API fixes in dataset and queue commands 2026-02-21 17:59:51 -05:00
Jeremie Fraeys
b1c9bc97fc
fix(cli): CLI structure, manifest, and asset fixes
- Fix commands.zig imports (logs.zig → log.zig, remove missing modules)
- Fix manifest.writeManifest to accept allocator param
- Add db.Stmt type alias for sqlite3_stmt
- Fix rsync placeholder to be valid shell script (#!/bin/sh)
2026-02-21 17:59:20 -05:00
Jeremie Fraeys
382c67edfc
fix(cli): WebSocket protocol and sync command fixes
- Add sendSyncRun method for run synchronization
- Add sendRerunRequest method for queue rerun
- Add sync_run (0x26) and rerun_request (0x27) opcodes
- Fix protocol import path to relative path
- Fix db.Stmt type alias usage in sync.zig
2026-02-21 17:59:14 -05:00
Jeremie Fraeys
ccd1dd7a4d
fix(cli): Zig 0.15 core API changes
- ArrayList: .init(allocator) → .empty, add allocator param to append/deinit/toOwnedSlice
- Atomic: std.atomic.Atomic → std.atomic.Value, lowercase order names (.seq_cst)
- Process: execvp instead of execvpe, inline wait status macros for macOS
- Time: std.time.sleep → std.Thread.sleep
- Error handling: fix isProcessRunning error union comparison
2026-02-21 17:59:05 -05:00
Jeremie Fraeys
d1ac558107
perf: implement context reuse
Go Worker (internal/worker/native_bridge_libs.go):
- Add global hashCtx with sync.Once for lazy initialization
- Eliminates 5-20ms fh_init/fh_cleanup per hash operation
- Uses runtime.NumCPU() for optimal thread count
- Log initialization time for observability

Zig CLI (cli/src/native/hash.zig):
- Add global_ctx with atomic flag and mutex
- Thread-safe initialization with double-check pattern
- Idempotent init() callable from multiple threads
- Log init time for debugging
2026-02-21 14:19:14 -05:00
Jeremie Fraeys
25ae791b5c
refactor: make dataset hash automatic in verify command
- Remove separate 'hash' subcommand
- Integrate native SHA256 hash into 'dataset verify'
- Hash is now computed automatically when verifying datasets
- Shows hash in output (JSON, CSV, and text formats)
- Help text updated to indicate auto-hashing
2026-02-21 14:09:44 -05:00
Jeremie Fraeys
1a35c54300
feat: integrate native library into Zig CLI
- Add cli/src/native/hash.zig - C ABI wrapper for dataset_hash
- Update cli/src/commands/dataset.zig - Add 'hash' subcommand
- Update cli/build.zig - Link against libdataset_hash.so
- Fix pre-existing CLI errors in experiment.zig (errorMsg signatures, columnInt64)

Usage: ml dataset hash <path>

Note: Additional pre-existing CLI errors remain in sync.zig
2026-02-21 14:08:07 -05:00
Jeremie Fraeys
7efe8bbfbf
native: security hardening, research trustworthiness, and CVE mitigations
Security Fixes:
- CVE-2024-45339: Add O_EXCL flag to temp file creation in storage_write_entries()
  Prevents symlink attacks on predictable .tmp file paths
- CVE-2025-47290: Use openat_nofollow() in storage_open()
  Closes TOCTOU race condition via path_sanitizer infrastructure
- CVE-2025-0838: Add MAX_BATCH_SIZE=10000 to add_tasks()
  Prevents integer overflow in batch operations

Research Trustworthiness (dataset_hash):
- Deterministic file ordering: std::sort after collect_files()
- Recursive directory traversal: depth-limited with cycle detection
- Documented exclusions: hidden files and special files noted in API

Bug Fixes:
- R1: storage_init path validation for non-existent directories
- R2: safe_strncpy return value check before strcat
- R3: parallel_hash 256-file cap replaced with std::vector
- R4: wire qi_compact_index/qi_rebuild_index stubs
- R5: CompletionLatch race condition fix (hold mutex during decrement)
- R6: ARMv8 SHA256 transform fix (save abcd_pre before vsha256hq_u32)
- R7: fuzz_index_storage header format fix
- R8: enforce null termination in add_tasks/update_tasks
- R9: use 64 bytes (not 65) in combined hash to exclude null terminator
- R10: status field persistence in save()

New Tests:
- test_recursive_dataset.cpp: Verify deterministic recursive hashing
- test_storage_symlink_resistance.cpp: Verify CVE-2024-45339 fix
- test_queue_index_batch_limit.cpp: Verify CVE-2025-0838 fix
- test_sha256_arm_kat.cpp: ARMv8 known-answer tests
- test_storage_init_new_dir.cpp: F1 verification
- test_parallel_hash_large_dir.cpp: F3 verification
- test_queue_index_compact.cpp: F4 verification

All 8 native tests passing. Library ready for research lab deployment.
2026-02-21 13:33:45 -05:00
Jeremie Fraeys
201cb66f56
fix(cli): Standardize WebSocket client imports
- Change from deps.zig indirect imports to direct @import() calls
- Improves build compatibility and clarity
- Aligns with Zig idiomatic import style
2026-02-20 21:41:51 -05:00
Jeremie Fraeys
a3b957dcc0
refactor(cli): Update build system and core infrastructure
- Makefile: Update build targets for native library integration
- build.zig: Add SQLite linking and native hash library support
- scripts/build_rsync.sh: Update rsync embedded binary build process
- scripts/build_sqlite.sh: Add SQLite constants generation script
- src/assets/README.md: Document embedded asset structure
- src/utils/rsync_embedded_binary.zig: Update for new build layout
2026-02-20 21:39:51 -05:00
Jeremie Fraeys
04ac745b01
refactor(cli): Rename note to annotate and re-add experiment command
- Renamed note.zig to annotate.zig (preserves user's preferred naming)
- Updated all references from 'ml note' to 'ml annotate'
- Re-added experiment.zig with create/list/show subcommands
- Updated main.zig dispatch: 'a' for annotate, 'e' for experiment
- Updated printUsage and test block to reflect changes
2026-02-20 21:32:01 -05:00
Jeremie Fraeys
adf4c2a834
refactor(cli): Update main.zig and remove deprecated commands
- main.zig: Update command dispatch and usage text
  - Wire up new commands: note, logs, sync, cancel, watch
  - Remove deprecated command references
  - Updated usage reflects unified command structure
- Delete deprecated command files:
  - annotate.zig (replaced by note.zig)
  - experiment.zig (functionality in run/note/logs)
  - logs.zig (old version, replaced)
  - monitor.zig (unused)
  - narrative.zig (replaced by note --hypothesis/context)
  - outcome.zig (replaced by note --outcome)
  - privacy.zig (replaced by note --privacy)
  - requeue.zig (functionality merged into queue --rerun)
2026-02-20 21:28:42 -05:00