Set the decision and its input
The local report includes only nonexcluded North records. A2 and B3 produce total5. The faulty drilldown function returns all five source IDs, including excluded C and South D/E. The corrected function retains the segment and exclusion conditions when returning supporting IDs.
| Case | Input JSON |
|---|---|
| Base test | {"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":2},{"id":"B","segment":"North","excluded":false,"units":3},{"id":"C","segment":"North","excluded":true,"units":7},{"id":"D","segment":"South","excluded":false,"units":8},{"id":"E","segment":"South","excluded":true,"units":9}]} |
Run the supplied comparison
The programme executes the aggregate and local drilldown function. Its returned ID list is the drilldown result contract, not evidence that a real customer interface opened those records.
| Path | Output JSON |
|---|---|
| Faulty path | {"total":5,"openedIds":["A","B","C","D","E"]} |
| Required path | {"total":5,"openedIds":["A","B"]} |
import assert from 'node:assert/strict';
const run=function run(i,corrected=true){
if(i.segment===null)return {held:true};const eligible=i.records.filter(r=>r.segment===i.segment&&!r.excluded);
return {total:eligible.reduce((s,r)=>s+r.units,0),openedIds:(corrected?eligible:i.records).map(r=>r.id)};
};
const cases=[{"input":{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":2},{"id":"B","segment":"North","excluded":false,"units":3},{"id":"C","segment":"North","excluded":true,"units":7},{"id":"D","segment":"South","excluded":false,"units":8},{"id":"E","segment":"South","excluded":true,"units":9}]},"corrected":false,"expected":{"total":5,"openedIds":["A","B","C","D","E"]}},{"input":{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":2},{"id":"B","segment":"North","excluded":false,"units":3},{"id":"C","segment":"North","excluded":true,"units":7},{"id":"D","segment":"South","excluded":false,"units":8},{"id":"E","segment":"South","excluded":true,"units":9}]},"corrected":true,"expected":{"total":5,"openedIds":["A","B"]}},{"input":{"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":0}]},"corrected":true,"expected":{"total":0,"openedIds":["A"]}},{"input":{"segment":null,"records":[]},"corrected":true,"expected":{"held":true}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Choose from the boundary evidence
An eligible zero-valued A still belongs to the zero total’s drilldown. Missing segment is held rather than opening every row.
- Read aggregate conditions
- Reuse them for supporting rows
- Compare total and returned IDs
Matching a grand total does not establish row-level lineage.
| Condition | Input JSON | Expected output JSON |
|---|---|---|
| a legitimate zero aggregate | {"segment":"North","records":[{"id":"A","segment":"North","excluded":false,"units":0}]} | {"total":0,"openedIds":["A"]} |
| segment not defined | {"segment":null,"records":[]} | {"held":true} |
Which IDs support the base displayed total5?
Show the worked answer
A and B only. C is excluded and D/E are outside North; their presence would change the meaning of the drilldown.