fix(enrichment): fail closed on dependency scan truncation - #1587
fix(enrichment): fail closed on dependency scan truncation#1587JSONbored wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Closing — this reverses a deliberate policy I shipped hours earlier in #1537 ( |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary
Nits — 5 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. The PR converts three silent-truncation paths in the dependency scanner — per-manifest-file cap, per-file patch-line cap, and per-scan query cap — from silent break/slice into explicit `DependencyScanTruncatedError` throws, which the existing orchestrator catch already surfaces as `analyzerStatus = 'degraded'` / `partial = true`. The logic is correct at all three sites: thresholds are preserved (manifests throw on file 21, patches throw at 501 lines, queries throw at 26 changes vs the 25-query default), and the four new test cases drive real production code paths — not fabricated states — covering each truncation axis, the orchestrator degraded-brief path, and abort-signal forwarding in the non-truncated case. The removed silent-cap test is correctly replaced by the fail-closed equivalents. Nits (5)
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Motivation
ok, so a silent truncation produced misleading analyzer status and an incomplete brief; truncation must be explicit and surfaced as a degraded analyzer.Description
DependencyScanTruncatedErrorand made the scanner fail closed by throwing when the manifest-file cap is exceeded, when a single file exceeds the per-file patch-line cap, or when the number of extracted dependency changes exceeds the dependency-query cap instead of silently slicing them.break/slice behavior inextractDependencyChangesandscanDependencieswith explicit checks that throwDependencyScanTruncatedErroron over-cap inputs.analyzerStatus = "degraded"andpartial = truein the brief.review-enrichment/test/enrichment.test.tscovering dependency-query bypass, manifest/patch-line truncation, that truncated scans cause degraded briefs, and that abort-signal forwarding still works when not truncated.Testing
cd review-enrichment && npm test, and all tests passed (41tests,0failures).npm run test:ci; it was invoked but failed early due to external tooling setup (actionlint fallback required network/DNS access), so full gate could not complete in this environment.npm audit --audit-level=moderatein this environment and the audit endpoint returned a403(external registry limitation), so that check could not complete here.Codex Task