One small request travels from an assignment to an inspected change. Try the actual filter, expose the draft’s mistake, then inspect the executed tests and the correction.
Field Notes is a fictional demo project. Its code and tests are real. This is an authored walkthrough; the product guide screenshots elsewhere are separate examples.
Add a saved-filter control
The assignment
Give the implementer ownership of the filter module and its tests. Preserve search, keep the selected filter visible, and show an honest empty state. Ask a reviewer to inspect those acceptance criteria before proposing a commit.
Fictional product under development
Field Notes
Ready for review · 2 items
- Keyboard navigationready
- Empty-result messageready
Inspect the exact correction
diff --git apublic/dark-lord/saved-filter/draft.mjs bpublic/dark-lord/saved-filter/filter.mjs
index abfb5e1..e36de75 100644
--- apublic/dark-lord/saved-filter/draft.mjs
+++ bpublic/dark-lord/saved-filter/filter.mjs
@@ -11,6 +11,5 @@ export const FILTERS = [
];
export function applyFilter(items, filter, query = "") {
const needle = query.trim().toLocaleLowerCase("en");
- const matches = items.filter(item => (!filter.status || item.status === filter.status) && item.title.toLocaleLowerCase("en").includes(needle));
- return matches.length ? matches : items;
+ return items.filter(item => (!filter.status || item.status === filter.status) && item.title.toLocaleLowerCase("en").includes(needle));
}
Read the executed test results
The draft exits with code 1; the correction exits with code 0. Source review by Codex; no separate reviewer-agent run is claimed.
Draft
TAP version 13
# Subtest: All work preserves every item
ok 1 - All work preserves every item
---
duration_ms: 1.098103
type: 'test'
...
# Subtest: Ready for review selects exactly the ready items
ok 2 - Ready for review selects exactly the ready items
---
duration_ms: 0.139812
type: 'test'
...
# Subtest: A saved filter with no matches returns an empty list
not ok 3 - A saved filter with no matches returns an empty list
---
duration_ms: 1.556044
type: 'test'
location: '/home/david-hathiramani/david/devinterface-website/examples/saved-filter/filter.test.mjs:6:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly deep-equal:
+ actual - expected
+ [
+ {
+ id: 1,
+ status: 'ready',
+ title: 'Keyboard navigation'
+ },
+ {
+ id: 2,
+ status: 'in-progress',
+ title: 'Saved filter control'
+ },
+ {
+ id: 3,
+ status: 'ready',
+ title: 'Empty-result message'
+ },
+ {
+ id: 4,
+ status: 'backlog',
+ title: 'Mobile spacing'
+ }
+ ]
- []
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
actual:
0:
id: 1
title: 'Keyboard navigation'
status: 'ready'
1:
id: 2
title: 'Saved filter control'
status: 'in-progress'
2:
id: 3
title: 'Empty-result message'
status: 'ready'
3:
id: 4
title: 'Mobile spacing'
status: 'backlog'
operator: 'deepStrictEqual'
stack: |-
TestContext.<anonymous> (file:///home/david-hathiramani/david/devinterface-website/examples/saved-filter/filter.test.mjs:6:72)
Test.runInAsyncScope (node:async_hooks:214:14)
Test.run (node:internal/test_runner/test:1047:25)
Test.processPendingSubtests (node:internal/test_runner/test:744:18)
Test.postRun (node:internal/test_runner/test:1173:19)
Test.run (node:internal/test_runner/test:1101:12)
async Test.processPendingSubtests (node:internal/test_runner/test:744:7)
...
# Subtest: Search and a saved filter are combined
ok 4 - Search and a saved filter are combined
---
duration_ms: 0.103821
type: 'test'
...
# Subtest: Search with no matches does not reset the selection
not ok 5 - Search with no matches does not reset the selection
---
duration_ms: 0.378399
type: 'test'
location: '/home/david-hathiramani/david/devinterface-website/examples/saved-filter/filter.test.mjs:8:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly deep-equal:
+ actual - expected
+ [
+ {
+ id: 1,
+ status: 'ready',
+ title: 'Keyboard navigation'
+ },
+ {
+ id: 2,
+ status: 'in-progress',
+ title: 'Saved filter control'
+ },
+ {
+ id: 3,
+ status: 'ready',
+ title: 'Empty-result message'
+ },
+ {
+ id: 4,
+ status: 'backlog',
+ title: 'Mobile spacing'
+ }
+ ]
- []
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
actual:
0:
id: 1
title: 'Keyboard navigation'
status: 'ready'
1:
id: 2
title: 'Saved filter control'
status: 'in-progress'
2:
id: 3
title: 'Empty-result message'
status: 'ready'
3:
id: 4
title: 'Mobile spacing'
status: 'backlog'
operator: 'deepStrictEqual'
stack: |-
TestContext.<anonymous> (file:///home/david-hathiramani/david/devinterface-website/examples/saved-filter/filter.test.mjs:8:71)
Test.runInAsyncScope (node:async_hooks:214:14)
Test.run (node:internal/test_runner/test:1047:25)
Test.processPendingSubtests (node:internal/test_runner/test:744:18)
Test.postRun (node:internal/test_runner/test:1173:19)
Test.run (node:internal/test_runner/test:1101:12)
async Test.processPendingSubtests (node:internal/test_runner/test:744:7)
...
# Subtest: Filtering leaves source data unchanged
ok 6 - Filtering leaves source data unchanged
---
duration_ms: 0.152566
type: 'test'
...
1..6
# tests 6
# suites 0
# pass 4
# fail 2
# cancelled 0
# skipped 0
# todo 0
# duration_ms 57.781529
Correction
TAP version 13 # Subtest: All work preserves every item ok 1 - All work preserves every item --- duration_ms: 1.163948 type: 'test' ... # Subtest: Ready for review selects exactly the ready items ok 2 - Ready for review selects exactly the ready items --- duration_ms: 0.130037 type: 'test' ... # Subtest: A saved filter with no matches returns an empty list ok 3 - A saved filter with no matches returns an empty list --- duration_ms: 0.071712 type: 'test' ... # Subtest: Search and a saved filter are combined ok 4 - Search and a saved filter are combined --- duration_ms: 0.075583 type: 'test' ... # Subtest: Search with no matches does not reset the selection ok 5 - Search with no matches does not reset the selection --- duration_ms: 0.157992 type: 'test' ... # Subtest: Filtering leaves source data unchanged ok 6 - Filtering leaves source data unchanged --- duration_ms: 0.132777 type: 'test' ... 1..6 # tests 6 # suites 0 # pass 6 # fail 0 # cancelled 0 # skipped 0 # todo 0 # duration_ms 56.773486
Inspect the complete evidence record, filter source, tests and production notes.