Skip to content

refactor: share path-resolution and body-cap helpers#355

Open
TBX3D wants to merge 2 commits into
vmfunc:mainfrom
TBX3D:refactor/share-detection-substrate
Open

refactor: share path-resolution and body-cap helpers#355
TBX3D wants to merge 2 commits into
vmfunc:mainfrom
TBX3D:refactor/share-detection-substrate

Conversation

@TBX3D

@TBX3D TBX3D commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

the per-user sif config directory resolution (~/.config/sif on unix, %LOCALAPPDATA% on windows) and the 5MiB response-body cap were each copy-pasted across module loading and framework detection. pulled the first into internal/sifpath.UserSubdir and the second into httpx.ReadCappedBody, with the same resolved paths and cap as before, verified by new tests on the path-layout invariants.

@TBX3D
TBX3D requested a review from vmfunc as a code owner July 9, 2026 22:14
@github-actions github-actions Bot added scan changes to scan engine modules changes to scan modules tests test changes size/m <200 lines changed labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

pr summary

7 files changed (+106 -31)

category files
go source 7
tests 1

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@7ea1cd2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
internal/sifpath/sifpath.go 42.85% 2 Missing and 2 partials ⚠️
internal/httpx/httpx.go 0.00% 2 Missing ⚠️
internal/modules/loader.go 33.33% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #355   +/-   ##
=======================================
  Coverage        ?   54.71%           
=======================================
  Files           ?       82           
  Lines           ?     6872           
  Branches        ?        0           
=======================================
  Hits            ?     3760           
  Misses          ?     2843           
  Partials        ?      269           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

TBX3D added 2 commits July 9, 2026 19:59
the modules loader and the framework custom-signature loader each
hand-rolled the same ~/.config/sif/<sub> (and %LocalAppData%\sif\<sub>
on windows) path. extract internal/sifpath.UserSubdir and route both
through it so the per-user layout is defined in one place.

no behavior change: the helper reproduces the existing paths exactly.
the frameworks detector and the module executor each defined their own
5 MB body cap and ran the same io.ReadAll(io.LimitReader(...)) read. move
the cap and the read into httpx.MaxBodySize / httpx.ReadCappedBody so both
scanners share one ceiling instead of two consts that can drift.

no behavior change: the cap value and read semantics are unchanged.
@TBX3D
TBX3D force-pushed the refactor/share-detection-substrate branch from 5468abf to d1b3f4e Compare July 10, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modules changes to scan modules scan changes to scan engine size/m <200 lines changed tests test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants