Skip to content

ibm: standard results silently fail unless withItems is set #124

Description

@wittjeff

Surfaced by typing during the Phase 3 TypeScript conversion (#120) and preserved verbatim there per the no-behavior-change policy; this issue tracks the fix.

Symptom

Any job that runs the ibm tool with standard results enabled and withItems: false gets a failed act: data.prevented: true with error: "Act failed (Cannot read properties of undefined (reading 'forEach'))". It looks like the accessibility-checker failed, but the tool ran fine — the failure is in the reporter's own standard-result pass.

Root cause

tests/ibm.ts (and the emitted ibm.js): trimActReport assigns actReport.items only inside its if (withItems) branch, then returns {totals, items: actReport.items} — so items is undefined when itemization was not requested. The standard pass then iterates it unconditionally (tests/ibm.ts:210):

nativeResult.items.forEach(item => {...});

The TypeError is swallowed by the reporter's outer catch, which reclassifies it as an act failure. (The standard totals were already correctly populated from totals.recommendation/totals.violation just before the throw, but the result is discarded.)

Suggested fix

Two options, either of which makes withItems: false usable with standard results:

  1. Build the standard instances from actReport.results regardless of withItems, and let withItems control only the native result's itemization (matches how other adapters treat the flag), or
  2. Guard the loop (if (nativeResult.items)), yielding a totals-only standard result when itemization is off.

Option 1 preserves instance-level standard reporting, which downstream scoring generally expects.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions