Skip to content

audit-engine: untouched-carried aggregate drops shared-component units, so a partial re-audit can score differently from a full audit #2301

Description

@nc9

Since #2288 (shared-component issue density, #2256), a full audit scales down the issue-density penalty for findings that repeat across pages as one shared component (sharedWarnUnits / sharedFailUnits on CheckTally, used in scoring.ts ~L881-891). The untouched-carried aggregate path drops those units, so a partial re-audit can score differently from a full audit of the same site.

  • aggregateUntouchedCarried (packages/audit-engine/src/complete-store-fold.ts ~L1331) calls addChecksToTally (~L1389), which fills sharedWarnUnits / sharedFailUnits (scoring.ts ~L698, ~L707; carried checks keep componentOccurrences via carriedFindingToCheck), but copies only failed, failUnits, warnings, warnUnits into the per-rule totals (~L1394-1397). UntouchedRuleTotals (~L213-235) has no shared fields.
  • addUntouched (~L569-577) therefore adds no shared units to the fold tally, while the streamed carried path (~L560) goes through addChecksToTally and keeps them.
  • Effect: when an untouched page carries observed, groupable component findings and the aggregate route is taken, the shared-chrome scaling is not applied to the carried part. The density penalty stays unscaled, so the partial re-audit's score can come out LOWER than a full audit of the same site.
  • The private cloud's SQL twin of the aggregate mirrors the same four fields, so it inherits the gap; it needs a matching change after this one.

Found from code reading (file:line above); not yet reproduced by a run.

Acceptance Criteria

  • UntouchedRuleTotals carries optional sharedWarnUnits and sharedFailUnits, and aggregateUntouchedCarried sums them (zero omitted)
  • addUntouched adds them to the fold tally, dropping the warn half for advisory rules the same way it does for warnUnits
  • A test builds the same site two ways (untouched carried pages through the aggregate, and streamed in full) and gets identical overall and debug.sharedComponentUnits
  • A test with no component findings shows scores unchanged from before this fix

Activity

  1. added
    bug
    size: S
    in-progress
    on Nov 24, 2026
  2. self-assigned this
    on Nov 24, 2026
  3. added theissue type on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugin-progresssize: S

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions