feat(enrichment): image/binary asset weight-delta analyzer - #1621
Conversation
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review — held for maintainer review
⏸️ Held for maintainer review — Large change — held for manual review Review summary
Nits — 7 non-blocking
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. This adds a REES analyzer for binary asset size findings, wires PR file status/previous path through enrichment, and renders added/grown asset findings into the prompt brief. The main analyzer logic is coherent: it evaluates all binary candidates before capping findings, treats copied files as added, and compares modified/renamed files against base sizes only when base data is available. I do not see a must-fix runtime or contract break in the provided diff. 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.
|
e3990c3 to
d2be23f
Compare
d2be23f to
f382cda
Compare
0cc500b to
65a2026
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1621 +/- ##
=======================================
Coverage 95.58% 95.58%
=======================================
Files 204 204
Lines 22295 22297 +2
Branches 8053 8055 +2
=======================================
+ Hits 21310 21312 +2
Misses 408 408
Partials 577 577
🚀 New features to boost your workflow:
|
Adds a REES analyzer that flags a PR committing or growing a heavy image/font/ binary blob — repo + CDN/cold-start bloat the textual diff hides behind 'Binary files differ'. Binary sizes are not in the patch, so it fetches the repo's git tree at headSha (and baseSha for modified files) with the request's short-lived GitHub token — one recursive call returns every blob size and sidesteps the Contents API 1 MB cap — then it is pure size arithmetic. Flags a newly-added blob >= 100 KB or growth >= 100 KB; text formats (.svg/.json) are excluded. repoFullName is validated to exactly two safe owner/repo segments (no extra slash, no '.'/'..' traversal) and sha to a commit-SHA pattern, and every path segment is URL-encoded, so a hostile repoFullName cannot redirect the token-bearing request to another repo. Fail-safe: returns [] without a token or on a failed/unsafe fetch. Bounded by MAX_FILES; injects fetch for tests, mirroring the dependency-scan analyzer. Closes JSONbored#1506.
Compare renamed and copied binary assets against their previous paths, and keep truncated Git tree responses useful by falling back to candidate-path size lookups. Pin the GitHub API version for asset size fetches and render binary-scaled sizes with KiB/MiB labels. Validation: npm run test:ci; npm audit --audit-level=moderate.
fd03b2b to
ec216c9
Compare
Treat copied binary paths as newly added assets so heavy copied files are reported by their full introduced size instead of being discounted against the source path. Add a regression test that covers an equal-size copied binary and verifies the base tree is not fetched for that classification.
Summary
statusinto REES so modified binaries can be compared againstbaseShaand rendered as growth instead of new additions.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥97% coverage of the lines AND branches you changed (aim for 98%+ on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
npm --prefix review-enrichment testfor the standalone REES package.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository. Not applicable; no visible UI changes.UI Evidence
No visible UI, frontend, docs, or extension changes.
Notes
main, resolving the previous merge conflict.statusis included in the REES request body.buildBrief, so the analyzer is exercised through the production registry path.