Skip to content

A rejected lazy ORM import in lower.ts is cached permanently, poisoning the process #1231

Description

@borisno2

Found during the code review of PR #1220 (issue #1147), 2026-09-06. Targets the prisma-8 line.

Problem

packages/core/src/secured/lower.ts (around line 66) loads Prisma's and / or combinators through a lazy import(), so the package root keeps its static import graph free of @prisma/orm-postgres — an invariant now enforced by a real import-graph walk in purity.test.ts.

The promise is cached, including when it rejects. A single transient import failure is therefore permanent for the life of the process: every subsequent predicate lowering re-awaits the same rejected promise, and no retry can recover it. Every secured read fails until the process restarts.

Deliberately left unfixed in #1220, which was scoped to the blocking findings.

What to build

  • A rejected import is not cached — the next call retries
  • A successful import is still cached (no per-call import cost, no race)
  • A test proves a transient failure followed by a success recovers

Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions