Skip to content

Restore per-element tool attribution in tsp50 scorer#1

Open
wittjeff wants to merge 1 commit intojrpool:mainfrom
wittjeff:fix/instance-dedup-element-tracking
Open

Restore per-element tool attribution in tsp50 scorer#1
wittjeff wants to merge 1 commit intojrpool:mainfrom
wittjeff:fix/instance-dedup-element-tracking

Conversation

@wittjeff
Copy link

Summary

  • Restores per-element tool attribution in tsp50.js that was lost when simplifying from tsp.js
  • Adds uniqueElementCount to issue details for accurate instance counting
  • Groups details.element entries by detecting tool combination (matching tsp.js behavior)

Problem

tsp50.js tracks issuePaths as a flat Set<pathID>, which loses information about which tools detected each element. The newer tsp.js scorer correctly tracks this as {pathID: Set<toolName>}, enabling downstream consumers to:

  1. Know which tools detected each specific element (e.g., "axe + ibm" vs "axe only")
  2. Count truly unique elements per issue (uniqueElementCount)
  3. Group elements by their detecting tool combination in details.element

Without this, consumers that rely on details.element to understand cross-tool agreement at the element level get only a flat list of paths with no tool attribution.

Changes

procs/score/tsp50.js:

  1. issuePaths structure: Changed from Set<pathID> to {pathID: Set<toolName>} — tracks which tools reported each element
  2. uniqueElementCount: Added to each issue's details — count of unique path-identified elements
  3. details.element: Changed from flat array to tool-attributed object — groups paths by detecting tool combination (e.g., {"axe + ibm": ["/html/body/div[1]"], "axe": ["/html/body/div[2]"]})

These changes align tsp50.js with the existing behavior in tsp.js.

Test plan

  • Verify scored reports include uniqueElementCount per issue
  • Verify details.element[issueID] is grouped by tool combination string
  • Verify multi-tool detections show combined tool lists (e.g., "axe + ibm")
  • Verify single-tool detections show individual tool name

🤖 Generated with Claude Code

The tsp50 scorer simplified element tracking from tsp's per-element tool
attribution (issuePaths[issueID][pathID] = Set<tools>) to a flat set
(issuePaths[issueName] = Set<pathIDs>). This lost the ability for
consumers to know which tools detected each element.

This change:

1. Restores tool-per-element tracking: issuePaths maps each pathID to
   the set of tools that reported it, and details.element groups paths
   by their detecting tool combinations (e.g., "axe + ibm": [paths]).

2. Adds uniqueElementCount to each issue's details: the count of unique
   path-identified elements, giving consumers a deduplicated instance
   count based on pathID. This is more accurate than summing per-tool
   instanceCounts, which double-counts elements found by multiple tools.

The element detail format now matches tsp's output structure, making
it consistent across scorer versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants