The problem
packages/core/CLAUDE.md:60 documents sudo() as returning an AccessContext. It returns a StackContext.
The two differ in a way that matters: StackContext deliberately omits the ORM handle, so an author following this line and reaching for the handle finds nothing there.
Provenance
Made false by #1332. That pull request removed an as unknown as AccessContext cast which had been papering over exactly this difference — the plugin runtime was being handed something typed as one thing and shaped as another, and a write over it found nothing. Removing the cast was correct; this line was not updated with it.
Why it is low severity, and still worth fixing
The type system now rejects the mistake, and the plugin-owned write refuses a handle-less context by name rather than failing obscurely. So a reader is caught quickly.
But this is a CLAUDE.md — guidance an agent reads before writing code — and it currently describes a type the function does not return, in the file that is the reference for this package's context surface.
What to do
Correct the line, and check the surrounding entries against the real signatures rather than only this one. Two rounds of this delivery found that fixing a named line while its neighbours stayed wrong was the most common way a defect survived.
Context
_Generated by Claude Code
The problem
packages/core/CLAUDE.md:60documentssudo()as returning anAccessContext. It returns aStackContext.The two differ in a way that matters:
StackContextdeliberately omits the ORM handle, so an author following this line and reaching for the handle finds nothing there.Provenance
Made false by #1332. That pull request removed an
as unknown as AccessContextcast which had been papering over exactly this difference — the plugin runtime was being handed something typed as one thing and shaped as another, and a write over it found nothing. Removing the cast was correct; this line was not updated with it.Why it is low severity, and still worth fixing
The type system now rejects the mistake, and the plugin-owned write refuses a handle-less context by name rather than failing obscurely. So a reader is caught quickly.
But this is a
CLAUDE.md— guidance an agent reads before writing code — and it currently describes a type the function does not return, in the file that is the reference for this package's context surface.What to do
Correct the line, and check the surrounding entries against the real signatures rather than only this one. Two rounds of this delivery found that fixing a named line while its neighbours stayed wrong was the most common way a defect survived.
Context
_Generated by Claude Code