There is a status panel module that runs in Node.js without a browser and simulates frontend-layer behavior. A code review needs to be performed for a regression PR. The panel stores the current state of the last selected request and updates it through selectRequest(query). Functional requirements:
{ label: string } and label.trim() is a non-empty string;trim().toLowerCase();TypeScript 5.8, strict=true, module=esnext.Reproduction context:
createBadgePanel(fetchBadge) once and then repeatedly calls selectRequest() when the selection changes.after version of the PR specifically, not redesign the API.Expected API contract:
createBadgePanel(fetchBadge) returns an object { getState, selectRequest };getState() returns a snapshot { query, loading, badge, error };selectRequest(query) returns a Promise<BadgeState> with a new snapshot of the current screen.TypeScript 5.8.3, Node.js 22.14.0, ES modules, no DOM and no third-party dependencies. Recommended run: tsc --strict --target es2022 --module esnext review.ts panel.ts or an equivalent tsconfig configuration with strict: true.
Use line comments to explain the problem, its impact, the fix and how to test it.