File size: 6,211 Bytes
0109502
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Changelog

## v0.4 — multi-day resumability + dedupe-before-execution

### Added
- **Real cross-run resumability.** `runner.run()` now persists a row cursor
  (`rows_completed`) and cumulative stats in `data/metadata/checkpoint.json`,
  and skips already-consumed rows on the next invocation
  (`IterableDataset.skip(n)`). Previously `checkpoint.json` only stored
  end-of-run stats and had no effect on where the *next* run started — every
  run always began at row 0. This is what makes "run it once a day for a few
  weeks" actually work instead of reprocessing the same rows every time.
- **Graceful stop + crash/power-loss recovery.** `Ctrl+C` (SIGINT) and
  SIGTERM now finish the in-flight record, write a checkpoint, and exit
  cleanly instead of dying mid-write. Checkpointing happens after every
  single row (atomic temp-file-plus-`os.replace` write), so a hard crash or
  power loss can lose at most the one row that was in flight.
- `main.py --no-resume` to deliberately restart a source from row 0.
- `scripts/setup.sh` / `setup.ps1` and `scripts/run_daily.sh` / `run_daily.ps1`:
  isolated-venv setup and a daily-run wrapper that keeps dependencies in sync
  with `requirements.txt` automatically, without touching system Python.

### Fixed
- **Sandbox execution no longer runs on records already known to be
  duplicates.** Duplicate detection (`Deduper.check_and_add`) was already
  computed before execution, but the result wasn't checked until after the
  sandbox subprocess had already run. `runner.py` now gates execution on
  `not duplicate`, so an exact/structural/near-duplicate skips straight to
  its `skip` decision without spending sandbox time (or, for tiers with NIM
  review, an API request) on code that's going to be discarded anyway.

## v0.3 — code review fixes

### Fixed (were blockers before any real run)
- **Gitleaks fail-closed is now actually implemented.** `secret_scan.py` reads
  `ALLOW_MISSING_GITLEAKS` and `runner.run()` calls a startup check
  (`ensure_secret_scanner_ready()`) that raises immediately if Gitleaks is
  missing and the override isn't `1`. Previously the README/`.env.example`
  claimed this behavior but the code silently passed every record through.
- **NIM retry logic no longer burns retries on non-retryable errors.**
  `nim_reviewer.py` now checks `r.status_code` explicitly: 429 and 5xx retry
  with backoff, everything else `>= 400` (bad request, bad API key, forbidden,
  etc.) raises immediately with the real HTTP status and body instead of
  retrying 3 times and surfacing a generic `nim_retry_exhausted`.
- **The regression test now tests the actual code.** `test_runner_regressions.py`
  previously asserted on hand-built dicts and never imported `pipeline.runner`
  — it would have stayed green even with the exact `NameError` crash
  reintroduced. It now mocks `stream_hf_dataset` and calls `runner.run()`
  end-to-end for several scenarios (valid code, syntax error, execution
  failure, tier classification).

### Improved (were flagged as real but non-blocking risks)
- **Near-duplicate dedupe no longer scans the whole index per record.**
  `dedupe.py` now uses MinHash/LSH banding for near-duplicate candidate
  lookup (exact/structural checks were already O(1) via dict lookup, now
  made explicit). See README "Deduplication at scale."
- **Added the three-tier classification structure** (`pipeline/tiers.py`,
  `config/tier2_libraries.json`): tier 1 (import-free, fully automated),
  tier 2 (per-library, classified + NIM-reviewable but never auto-included —
  no per-library sandbox exists yet), tier 3 (real-world/project, classified
  only). `main.py --tiers` controls which tiers are active in a given run;
  default is tier 1 only. Output is now organized under
  `data/<tier>/[<library>/]<decision>/records.jsonl` instead of a single flat
  `data/<decision>/` layout.

### Still intentionally not built (unchanged from before this pass)
- No per-library, version-pinned execution environments for tier 2.
- No dedicated validation profile (static analysis / partial execution) for
  tier 3 real-world repository code; it should not be forced to run as a
  standalone snippet.
- No automated license/provenance detection — still a manual, source-level
  approval step (`pipeline/source_checks.py` remains a stub that only checks
  instruction/output aren't both empty).
- Dual-NIM self-consistency checking (`dual_review_low`/`dual_review_high`/
  `max_review_disagreement` in `config/thresholds.json`) is configured but not
  wired into `decision.py`/`runner.py`.
- Local (non-Docker) sandbox mode still has no network isolation — only
  Docker mode (`--network none`) blocks outbound calls. Use Docker mode for
  any untrusted/unattended run.

## v3 (prior)

### Fixed
- Fixed the `NameError: decision is not defined` / `reason is not defined` crash in the hard-failure branch.
- Hard-failure decisions are now computed directly and never rely on a dummy NIM result.
- Aligned `runner.py` and `decision.py` on the `execution_status` contract.

### Implemented
- Added an executor abstraction with a Docker production executor (network
  disabled, read-only root filesystem, dropped capabilities, no-new-privileges,
  PID/memory/CPU limits, non-root user, restricted tmpfs).
- Added Linux `resource.setrlimit` limits to the local executor (memory, CPU,
  process count, output size, open files).
- Added explicit Windows behavior: timeout + temp cwd only, no `setrlimit`
  equivalent; production/untrusted execution on Windows must use Docker mode.
- Exact, AST-structural, and token-shingle near-duplicate layers.
- NIM retry/backoff and a separate retry queue.
- Expanded NIM rubric and hard axis gates.

## 0.2.0

- Added structural and near-duplicate detection across runs.
- Added Gitleaks scanner integration (fail-open at the time — fixed in v0.3).
- Added retry/backoff and a separate retry queue for NIM infrastructure failures.
- Added instruction alignment and scope-fit scoring.
- Added deterministic score-axis gates.
- Removed dummy NIM topic metadata.
- Added Linux resource limits to the local development executor.
- Added audit metadata for duplicate matching and secret scanning.