From 3ea297f05019a5810b774ba010544df389dc61d9 Mon Sep 17 00:00:00 2001 From: leubeem Date: Mon, 15 Jun 2026 15:28:27 +0200 Subject: [PATCH] ci: make typecheck a real blocking gate; bump actions to Node 24 majors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous `vue-tsc --noEmit` step was a no-op: the root tsconfig uses `files: []` with project references, so without `--build` it checks zero files and always passes. Switch to `vue-tsc --build` (new `yarn typecheck` script) and make the job blocking. Fix the one error this surfaced: UsageEventDocument extended mongoose.Document, whose `model` method collides with the `model: string` field. Use the recommended pattern — a plain attrs interface passed to the Schema/Model generics (hydrated docs still expose Document methods). Typecheck is now clean. Bump actions/checkout@v5 and actions/setup-node@v5 to silence the Node.js 20 runtime deprecation (forced to Node 24 from 2026-06-16). Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 18 +++++++----------- package.json | 1 + server/models/UsageEvent.ts | 12 ++++++++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 289a992..b2d5f94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,12 @@ jobs: name: Test suite runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Enable Corepack run: corepack enable - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: 22 cache: yarn @@ -27,19 +27,15 @@ jobs: run: yarn test typecheck: - name: Typecheck (non-blocking) + name: Typecheck runs-on: ubuntu-latest - # TypeScript strict mode is currently disabled (see review QUAL-10). This job - # surfaces type errors without gating merges; promote it to a required check - # once the strict-mode cleanup lands. - continue-on-error: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Enable Corepack run: corepack enable - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v5 with: node-version: 22 cache: yarn @@ -47,5 +43,5 @@ jobs: - name: Install dependencies run: yarn install --immutable - - name: vue-tsc - run: yarn vue-tsc --noEmit + - name: Typecheck (vue-tsc --build) + run: yarn typecheck diff --git a/package.json b/package.json index be2a561..d9f338a 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "preview": "nuxt preview", "start": "node .output/server/index.mjs", "postinstall": "nuxt prepare", + "typecheck": "vue-tsc --build", "sharp:rebuild": "SHARP_IGNORE_GLOBAL_LIBVIPS=1 yarn rebuild sharp", "import:decision": "tsx --tsconfig tsconfig.scripts.json scripts/import-decision-tree.ts", "test": "tsx --tsconfig tsconfig.tests.json --test \"tests/**/*.test.ts\" \"server/**/*.test.ts\" \"shared/**/*.test.ts\"" diff --git a/server/models/UsageEvent.ts b/server/models/UsageEvent.ts index ebbc448..d8f0f92 100644 --- a/server/models/UsageEvent.ts +++ b/server/models/UsageEvent.ts @@ -5,7 +5,11 @@ const { Schema } = mongoose export type UsageKind = 'stt' | 'tts' | 'llm' export type UsageProvider = 'openai' | 'speaches' | 'piper' | 'cache' -export interface UsageEventDocument extends mongoose.Document { +// Plain attribute shape (not extending mongoose.Document). Extending Document +// collides on `model` (Document.model is a method); passing the attrs type to +// the Schema/Model generics is the recommended pattern and still yields +// hydrated documents with all Document methods from queries/create. +export interface UsageEventAttrs { user?: mongoose.Types.ObjectId sessionId?: string kind: UsageKind @@ -23,7 +27,7 @@ export interface UsageEventDocument extends mongoose.Document { createdAt: Date } -const usageEventSchema = new mongoose.Schema({ +const usageEventSchema = new mongoose.Schema({ user: { type: Schema.Types.ObjectId, ref: 'User', index: true }, sessionId: { type: String }, kind: { type: String, enum: ['stt', 'tts', 'llm'], required: true }, @@ -41,5 +45,5 @@ const usageEventSchema = new mongoose.Schema({ usageEventSchema.index({ user: 1, createdAt: -1 }) export const UsageEvent = - (mongoose.models.UsageEvent as mongoose.Model | undefined) || - mongoose.model('UsageEvent', usageEventSchema) + (mongoose.models.UsageEvent as mongoose.Model | undefined) || + mongoose.model('UsageEvent', usageEventSchema)