{"success":true,"name":"when-the-screen-shows-wrong-data-bisect-the-pipeline-find-wh","description":"A value displays wrong and the guilty layer is unknown","category":"ai-brimind","path":"ai-brimind/when-the-screen-shows-wrong-data-bisect-the-pipeline-find-wh/SKILL.md","file":"SKILL.md","content":"---\nname: when-the-screen-shows-wrong-data-bisect-the-pipeline-find-wh\ndescription: \"A value displays wrong and the guilty layer is unknown\"\n---\n\n# When the Screen Shows Wrong Data, Bisect the Pipeline: Find WHICH Layer Lied Before Fixing Anything\n\n## When to use\nThe UI shows incorrect, missing, or stale data, and you are about to 'fix' it in whatever layer you happen to be reading, without first locating where truth turned into error.\n\n## Example request\nThe screen shows the wrong member count → is the DB value wrong, the aggregation wrong, the API mapping wrong, or the frontend rendering a stale cache? Four suspects, one crime; fixing before locating means patching an innocent layer. Checking the middle first — hit the API endpoint directly and read the raw JSON → if the API is right, the bug is frontend-side; if wrong, go deeper to the DB; one check eliminates half the suspects, that is bisection. The DB checked directly shows the correct value but the API returns the old one → suspicion lands on caching or a stale derived field; the layer BETWEEN two known points is where the lie was born. A frontend 'fix' that reformats bad API data → the symptom moves, the lie stays; every screen consuming that endpoint inherits it — fixes belong at the layer that lied.\n\n## Instructions\nAct as a data detective who never accepts 'the screen is wrong' as a location — the screen is just where the lie became visible; the lie was BORN in exactly one layer of the pipeline (DB value, query, service transformation, API response, client cache, component state, render logic), and the fastest route to it is bisection: check the middle of the pipeline, eliminate half the suspects, repeat — never line-by-line reading from either end, and never fixing where you happened to be looking. When wrong data appears, do this: (1) Freeze the case first: which exact record, which exact field, what does it show, what SHOULD it show and says who? A concrete specimen ('member 6821 shows count 3, should be 5') makes every check decisive; vague wrongness cannot be bisected. (2) Check the middle: call the API endpoint directly (browser, curl) and read the raw JSON for that specimen. Right there → the backend is innocent, suspects are client cache, state, or render (go to 4). Wrong there → suspects are DB, query, or service (go to 3). One request halved the search space. (3) Backend half: read the value straight from the database for that record. DB correct but API wrong → the lie is born between them — a projection, a mapping, a derived/cached value gone stale (your derived-numbers and caching disciplines name the usual culprits), or the wrong record fetched entirely. DB wrong → the lie is upstream in whatever WROTE it; switch from 'why does it display wrong' to 'which write path corrupted it', and hunt with your side-effect-inventory and request-ID trails. (4) Frontend half: is the component rendering a stale cached query (your invalidation discipline's signature bug — mutate happened, dependents never refreshed)? Is state transformed after fetch? Log the value at arrival vs at render — the hop where correct becomes wrong is the culprit line. (5) Fix AT the lying layer and only there, then re-run the original check end to end; if you also feel tempted to add a frontend guard around a backend lie, resist per your root-cause discipline — masking a lie downstream leaves every OTHER consumer deceived. Only close the case when you can say which layer lied, why, and how the fix makes that layer truthful for all its consumers — 'I changed something and the screen looks right now' is not a solved case, it is a suspect released for good behavior.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #250\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}