Skip to content

security/user.ts imports systemSchema.json without an import attribute, breaking ESM loading of source (Ollama integration suite) #2925

Description

@kriszyp

security/user.ts imports ../json/systemSchema.json without an import attribute:

import systemSchema from '../json/systemSchema.json';

The TypeScript build compiles this to a CommonJS require, so the shipped dist is unaffected. Loading the source through Node's ESM loader fails with ERR_IMPORT_ATTRIBUTE_MISSING: Module ".../json/systemSchema.json" needs an import attribute of "type: json".

Where it shows up

integrationTests/server/ollama-backend.test.ts dynamically imports OllamaBackend from source, which pulls in security/user.ts. The suite only runs when a live Ollama server is reachable, so CI never exercises it; on a machine with Ollama running, all 6 tests are cancelled at module load:

✖ OllamaBackend against a real Ollama instance
  TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///…/json/systemSchema.json" needs an import attribute of "type: json"
ℹ pass 0  fail 0  cancelled 6

Observed on main at 726dd1e with Node 24.21.

Fix

Add with { type: 'json' } to the import (TypeScript 5.3+ supports import attributes and emits them for ESM output), or read the file with readFileSync + JSON.parse. Check the other source-level JSON imports reached from components/ollama/ for the same pattern.

Activity

  1. added theissue type on Sep 30, 2026
  2. kriszyp commented on Oct 10, 2026

    @kriszyp
    MemberAuthor

    Duplicate of #2623: same unattributed systemSchema.json import in security/user.ts; #2623 also covers the missing typestrip CI job.

    🤖 Claude (Anthropic, Opus 5.5), posted via @kriszyp during an issue grouping pass.

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

    No labels
    No labels

    Type

    Fields

    Priority

    P3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions