Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript
9.9 KB
Raw Blame
{"specialist":"state-machines","matrix":{"machine":"take proposals (src/takes/proposals.ts)","kinds":["takes_add","takes_remove","takes_deactivate","takes_replace","takes_replace (same claim, falls through)"],"actions":["accept","drop"],"cells":[{"kind":"takes_add","action":"accept","row":"take created {id, claim, active:true}; proposal accepted","test":"test/proposals.test.ts:11"},{"kind":"takes_add","action":"drop","row":"no take created; proposal dropped","test":null},{"kind":"takes_remove","action":"accept","row":"take deleted; proposal accepted","test":"test/proposals.test.ts:18"},{"kind":"takes_remove","action":"drop","row":"take unchanged; proposal dropped","test":"test/proposals.test.ts:25"},{"kind":"takes_deactivate","action":"accept","row":"take kept with active:false, claim unchanged; proposal accepted","test":null},{"kind":"takes_deactivate","action":"drop","row":"take unchanged (active:true); proposal dropped","test":null},{"kind":"takes_replace","action":"accept","row":"take kept, claim rewritten, active unchanged; proposal accepted","test":"test/proposals.test.ts:33"},{"kind":"takes_replace","action":"drop","row":"take unchanged (old claim); proposal dropped","test":null},{"kind":"takes_replace (same claim, falls through)","action":"accept","row":"take kept unchanged; proposal accepted","test":null},{"kind":"takes_replace (same claim, falls through)","action":"drop","row":"take unchanged; proposal dropped","test":null}]}}
{"severity":"CRITICAL","confidence":95,"path":"src/takes/proposals.ts","line":40,"category":"state-matrix","summary":"wrong row: takes_deactivate × accept → take should be kept with active:false, but the case falls into the takes_remove branch and deletes the take","fix":"Give takes_deactivate its own branch: `const t = store.takes.get(p.takeId); if (t) store.takes.set(p.takeId, { ...t, active: false }); break;`","fingerprint":"src/takes/proposals.ts:state-matrix:wrong-row:takes_deactivate:accept","specialist":"state-machines","cell":{"kind":"takes_deactivate","action":"accept"},"evidence":"Lines 40-42: `case 'takes_deactivate': case 'takes_remove': store.takes.delete(p.takeId)`. The trust guard exists so agents cannot destroy takes without owner review; an owner accepting a deactivate loses the record permanently.","test_stub":"test('accepting a deactivate proposal keeps the take with active:false', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_deactivate', takeId: 't1' });\n  acceptProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: false });\n  expect(store.proposals.get('p1')?.status).toBe('accepted');\n});"}
{"severity":"CRITICAL","confidence":95,"path":"src/takes/proposals.ts","line":39,"category":"state-matrix","summary":"wrong row: takes_replace (same claim) × accept → take should be kept unchanged, but the fall-through lands in the delete branch and removes the take","fix":"End the takes_replace case with an unconditional `break` (a same-claim replace is a no-op); never fall through into the remove branch.","fingerprint":"src/takes/proposals.ts:state-matrix:wrong-row:takes_replace-same-claim:accept","specialist":"state-machines","cell":{"kind":"takes_replace (same claim, falls through)","action":"accept"},"evidence":"Line 34 guards the rewrite with `p.claim !== current.claim`; when the claim is equal (or p.claim is undefined, or the take is missing) control reaches line 42 `store.takes.delete(p.takeId)`. The comment says 'nothing new to write' but the code deletes.","test_stub":"test('accepting a replace proposal with the same claim leaves the take unchanged', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_replace', takeId: 't1', claim: 'the sky is blue' });\n  acceptProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: true });\n  expect(store.proposals.get('p1')?.status).toBe('accepted');\n});"}
{"severity":"CRITICAL","confidence":95,"path":"src/takes/proposals.ts","line":41,"category":"state-matrix","summary":"collapsed kinds: takes_deactivate, same-claim takes_replace and takes_remove all share the single destructive `store.takes.delete` branch; only takes_remove is tested, so the other two look covered while deleting data","fix":"One branch per kind in acceptProposal: remove deletes, deactivate sets active:false, replace rewrites or no-ops. Add a `default: throw` or exhaustive `never` check so a future kind cannot silently inherit the delete path.","fingerprint":"src/takes/proposals.ts:state-matrix:collapsed-kinds:accept","specialist":"state-machines","cell":{"kind":"takes_deactivate","action":"accept"},"evidence":"test/proposals.test.ts:18 covers only takes_remove through this branch."}
{"severity":"CRITICAL","confidence":90,"path":"src/takes/proposals.ts","line":40,"category":"state-matrix","summary":"untested cell: takes_deactivate × accept → take kept with active:false, proposal accepted","fix":"Add a test that proposes takes_deactivate on a seeded take, accepts it, and asserts the full take row and proposal status.","fingerprint":"src/takes/proposals.ts:state-matrix:takes_deactivate:accept","specialist":"state-machines","cell":{"kind":"takes_deactivate","action":"accept"},"test_stub":"test('accepting a deactivate proposal keeps the take with active:false', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_deactivate', takeId: 't1' });\n  acceptProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: false });\n  expect(store.proposals.get('p1')?.status).toBe('accepted');\n});"}
{"severity":"CRITICAL","confidence":90,"path":"src/takes/proposals.ts","line":49,"category":"state-matrix","summary":"untested cell: takes_deactivate × drop → take unchanged (active:true), proposal dropped","fix":"Add a drop test for the takes_deactivate kind asserting the take row is untouched and status is 'dropped'.","fingerprint":"src/takes/proposals.ts:state-matrix:takes_deactivate:drop","specialist":"state-machines","cell":{"kind":"takes_deactivate","action":"drop"},"test_stub":"test('dropping a deactivate proposal keeps the take active', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_deactivate', takeId: 't1' });\n  dropProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: true });\n  expect(store.proposals.get('p1')?.status).toBe('dropped');\n});"}
{"severity":"CRITICAL","confidence":90,"path":"src/takes/proposals.ts","line":39,"category":"state-matrix","summary":"untested cell: takes_replace (same claim) × accept → take kept unchanged, proposal accepted","fix":"Add a test that accepts a takes_replace whose claim equals the current claim and asserts the take still exists unchanged.","fingerprint":"src/takes/proposals.ts:state-matrix:takes_replace-same-claim:accept","specialist":"state-machines","cell":{"kind":"takes_replace (same claim, falls through)","action":"accept"},"test_stub":"test('accepting a same-claim replace proposal leaves the take unchanged', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_replace', takeId: 't1', claim: 'the sky is blue' });\n  acceptProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: true });\n  expect(store.proposals.get('p1')?.status).toBe('accepted');\n});"}
{"severity":"CRITICAL","confidence":90,"path":"src/takes/proposals.ts","line":49,"category":"state-matrix","summary":"untested cell: takes_replace (same claim) × drop → take unchanged, proposal dropped","fix":"Add a drop test for a same-claim takes_replace asserting the take row is untouched and status is 'dropped'.","fingerprint":"src/takes/proposals.ts:state-matrix:takes_replace-same-claim:drop","specialist":"state-machines","cell":{"kind":"takes_replace (same claim, falls through)","action":"drop"},"test_stub":"test('dropping a same-claim replace proposal leaves the take unchanged', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_replace', takeId: 't1', claim: 'the sky is blue' });\n  dropProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: true });\n  expect(store.proposals.get('p1')?.status).toBe('dropped');\n});"}
{"severity":"CRITICAL","confidence":90,"path":"src/takes/proposals.ts","line":49,"category":"state-matrix","summary":"untested cell: takes_replace (new claim) × drop → take keeps its old claim, proposal dropped","fix":"Add a drop test for takes_replace with a differing claim asserting the original claim remains and status is 'dropped'.","fingerprint":"src/takes/proposals.ts:state-matrix:takes_replace:drop","specialist":"state-machines","cell":{"kind":"takes_replace","action":"drop"},"test_stub":"test('dropping a replace proposal keeps the old claim', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_replace', takeId: 't1', claim: 'the sky is grey' });\n  dropProposal(store, 'p1');\n  expect(store.takes.get('t1')).toEqual({ id: 't1', claim: 'the sky is blue', active: true });\n  expect(store.proposals.get('p1')?.status).toBe('dropped');\n});"}
{"severity":"CRITICAL","confidence":90,"path":"src/takes/proposals.ts","line":49,"category":"state-matrix","summary":"untested cell: takes_add × drop → no take created, proposal dropped","fix":"Add a drop test for takes_add asserting the target id is absent from store.takes and status is 'dropped'.","fingerprint":"src/takes/proposals.ts:state-matrix:takes_add:drop","specialist":"state-machines","cell":{"kind":"takes_add","action":"drop"},"test_stub":"test('dropping an add proposal creates no take', () => {\n  const store = seeded();\n  propose(store, { id: 'p1', kind: 'takes_add', takeId: 't2', claim: 'water is wet' });\n  dropProposal(store, 'p1');\n  expect(store.takes.has('t2')).toBe(false);\n  expect(store.proposals.get('p1')?.status).toBe('dropped');\n});"}