fix(scoring): clamp fraction scorers to [0, 1]#364
Open
TBX3D wants to merge 4 commits into
Open
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #364 +/- ##
=======================================
Coverage ? 55.14%
=======================================
Files ? 83
Lines ? 6981
Branches ? 0
=======================================
Hits ? 3850
Misses ? 2853
Partials ? 278 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pr summary16 files changed (+799 -47)
|
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.
a `fingerprint` module identifies a technology by weighted body/header signatures scored into a confidence, with an optional version regex, rather than a boolean match. it fires one finding carrying the score once it reaches the threshold (default 0.5). this is the framework detectors' scoring in the module format, so a custom tech fingerprint lives alongside other modules. validated at load (signatures present, non-empty patterns, finite weights, confidence in [0,1], version regex compiles) and covered by yaml round-trip, validation, header, version and default-threshold tests. documented in docs/modules.md. shares the response body cap via httpx.ReadCappedBody.
scoreFingerprint and MatchSignatures divide matched weight by total weight with no bound on the result. validation rejects negative weights on real configs, but the math itself has no invariant, so any caller that skips validation gets a score outside [0, 1] used directly as reported confidence. clamp both to guard the pathological path; normal validated inputs already fall inside [0, 1] and are unaffected.
TBX3D
force-pushed
the
fix/scoring-fraction-clamp
branch
from
July 10, 2026 04:07
c5b01fa to
9eb7a02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a fraction scorer could return a value outside 0-1 depending on input distribution, which then propagated into downstream weighted sums. clamp at the source instead of trusting every caller to bound it.