# tail-render-ts — CG-38

An agent-named symbol sitting in the TAIL of a large file must render.

This mirrors the geometry of the reported file (a 1,414-line Svelte chat store)
closely enough that the same two defects reproduce, and it is that geometry — not
any individual line — that the fixture exists to hold:

| | line | why it matters |
|---|---|---|
| `QueuedMessage` (interface) | 70 | the DECOY. Same stem as the query token, near the top, cheap to render — it is what the broken build returned *instead of* the functions. |
| `createSessionStore` (function) | 104–1417 | the ENVELOPE. Spans ~92% of the file, and `function` is deliberately **not** in `ENVELOPE_KINDS` (CG-27), so every symbol inside merges into ONE cluster that must then be shrunk and trimmed. |
| `handleStreamMessage` | ~554 | a 290-line god-method in the middle, so the head of the file has plenty to spend the budget on. |
| `queueMessage` | 1088 | TARGET. Past line 1,000. |
| `removeQueuedMessage` | 1096 | TARGET. |
| `flushQueuedMessages` | 1102 | TARGET. Past line 1,000. |

Two more pieces are load-bearing:

- **`queueMessage` never calls `flushQueuedMessages`** (both push to / drain the same
  array instead). That absence is what produced no call chain, no synthesized hop and
  no dispatch boundary — and so made `buildFlowFromNamedSymbols` throw the
  named-symbol identity away along with the narrative it had nothing to print.
- **`types/worker-configuration.d.ts`** — 2,500 lines of generated Wrangler ambient
  types, carrying the `Generated by wrangler. DO NOT EDIT.` banner so the ranker flags
  and penalises it. It is what makes the fixture able to test the issue's
  index-dependence lead: a penalty on this file moves `maxGraph`, which moves the 6%
  relevance gate, which moves every other file's allowance — and must still not cost
  the top-ranked file the definitions the agent named.

`src/lib/session-store.ts` is machine-generated to hit those line numbers with real,
extractable TypeScript. If you need to change it, change the geometry (the target
line numbers, the closure span, the decoy's position) rather than editing individual
lines — the fixture-shape assertions in
`__tests__/explore-named-symbol-render.test.ts` will tell you if it has rotted.

Gate: `__tests__/explore-named-symbol-render.test.ts`.
Probe: `node scripts/agent-eval/probe-named-symbol.mjs`.
Numbers: `docs/benchmarks/explore-tail-render-cg38.md`.
