Skip to content

Commit 93d1f3c

Browse files
committed
scan: report needs_audit_loc (token-cost proxy) + oversized modules (split candidates, loc>=2000) so big/expensive audits are visible up front
1 parent b195f28 commit 93d1f3c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/scan.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,20 @@ def main():
179179
ensure_ascii=False, indent=1)
180180

181181
needs = buckets["stale"] + buckets["unaudited"]
182+
# oversized modules: too coarse to be a useful audit unit AND expensive to audit
183+
# (the auditor must read a lot). Split candidates. Threshold overridable via meta.
184+
big_threshold = state.get("meta", {}).get("oversizedLoc", 2000)
185+
oversized = sorted(((m["loc"], m["id"]) for m in state.get("modules", [])
186+
if (m.get("loc") or 0) >= big_threshold), reverse=True)
187+
needs_loc = sum(m.get("loc") or 0 for m in state.get("modules", []) if m["id"] in set(needs))
182188
report = {
183189
"modules": len(state.get("modules", [])),
184190
"tracked_loc": tracked_loc,
185191
"tracked_files": len(union_files),
186192
"needs_audit": needs,
187193
"needs_audit_count": len(needs),
194+
"needs_audit_loc": needs_loc, # rough proxy for the next audit's token cost
195+
"oversized": [mid for _, mid in oversized], # split candidates (loc >= threshold)
188196
"up_to_date": len(needs) == 0 and not buckets["empty"],
189197
"git": git_report,
190198
**buckets,

0 commit comments

Comments
 (0)