Skip to content

feat: task eval + training hardening batch (review items 1-10) - #2

Merged
log0u7 merged 6 commits into
mainfrom
feat/training-hardening
Sep 19, 2026
Merged

log0u7 merged 6 commits into
mainfrom
feat/training-hardening

Conversation

@log0u7

@log0u7 log0u7 commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

Carries the phase-2 training feature set (task eval, checkpoints/resume, chat CLI, CPU smoke, holdout leak + cache fixes) rebased onto current main, plus the full 10-item quality/security/functional review batch (TDD red->green, no new dependencies, ruff clean).

Security:

  • case.id allowlist ^[A-Za-z0-9_-]{1,64}$ (path traversal via crafted case files)
  • ProviderConfig.base_url validator: http/https only, rejects link-local + cloud-metadata hosts (SSRF guard); loopback stays allowed
  • Sample config + docs: drop committed MLGW_API_KEY:deadbeef placeholder (empty default, consistent with other providers)

Functional:

  • train prepare default output -> datasets/prepared/ (directory that run/evaluate/task-eval read by default)
  • latest_run_dir: mtime-based, honors configured training.output_dir
  • train run --resume reuses the latest run dir; fails fast with a clear message when no checkpoint exists
  • CLI commands fail with clean messages (no raw tracebacks) on missing files/model paths

Quality:

  • train task-eval CLI path flattens the message list (matches typed generate(str | list[str])); prediction_from_text catches only ProviderError
  • smoke_cpu skips only when torch is missing; missing deps / unreachable HF hub now fail (exit 1)
  • Dead code removed: train chat misleading name_or_path + generate_reply_fn, double dataset read in dataset split
  • run_name gains microsecond precision

Note: replaces feat/phase2-training-hardening (orphaned history after previous squash merge).

Verification

  • ruff check src tests: clean
  • pytest tests/unit: all passed
  • brainforge config schema --check: in sync
  • gitleaks git --all: no leaks found

…ix holdout leak and cache bypass

- split_with_postcutoff: post-cutoff records now exclusive to test_postcutoff
  (no more leakage into train); drop dead min_postcutoff param
- CacheProvider: drop structured() override that bypassed the sqlite cache
- qlora.evaluate: honor quantization setting instead of hardcoded 4-bit
- train evaluate/export/task-eval/chat: --model defaults to latest run dir
- TrainingConfig: save_steps (checkpointing, keep last 2) and seed fields
- train run --resume: TRL native checkpoint resume
- train task-eval: verdict accuracy, FP/FN rates, CWE accuracy on holdout
- train chat: interactive REPL on adapter or merged model
- CI: CPU smoke training job (tiny model, no GPU/bitsandbytes)
@log0u7
log0u7 merged commit db97222 into main Sep 19, 2026
7 checks passed
@log0u7
log0u7 deleted the feat/training-hardening branch September 19, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant