-
Notifications
You must be signed in to change notification settings - Fork 11
Harden workflow warning cleanup #770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { spawn } from 'node:child_process'; | ||
| import { writeFile } from 'node:fs/promises'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| const CANONICAL_NEXT_ENV = `/// <reference types="next" /> | ||
| /// <reference types="next/image-types/global" /> | ||
| import "./../../dist/apps/website/.next/types/routes.d.ts"; | ||
|
|
||
| // NOTE: This file should not be edited | ||
| // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. | ||
| `; | ||
|
|
||
| async function restoreNextEnv(): Promise<void> { | ||
| await writeFile(new URL('../next-env.d.ts', import.meta.url), CANONICAL_NEXT_ENV); | ||
| } | ||
|
|
||
| function run(command: string, args: string[]): Promise<number | null> { | ||
| return new Promise((resolve, reject) => { | ||
| const child = spawn(command, args, { stdio: 'inherit' }); | ||
| child.on('error', reject); | ||
| child.on('close', (code) => resolve(code)); | ||
| }); | ||
| } | ||
|
|
||
| async function main(): Promise<void> { | ||
| const separator = process.argv.indexOf('--'); | ||
| const commandLine = separator === -1 ? process.argv.slice(2) : process.argv.slice(separator + 1); | ||
| const [command, ...args] = commandLine; | ||
|
|
||
| if (!command) { | ||
| throw new Error('Expected a command after --'); | ||
| } | ||
|
|
||
| let exitCode: number | null = 1; | ||
| try { | ||
| exitCode = await run(command, args); | ||
| } finally { | ||
| await restoreNextEnv(); | ||
| } | ||
| process.exitCode = exitCode ?? 1; | ||
| } | ||
|
|
||
| if (process.argv[1] === fileURLToPath(import.meta.url)) { | ||
| main().catch((error: unknown) => { | ||
| console.error(error); | ||
| process.exitCode = 1; | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,8 @@ class FakeModel { | |||||
| bound: unknown[] = []; | ||||||
| private turn = 0; | ||||||
| bindTools(tools: unknown[]) { this.bound = tools; return this; } | ||||||
| async invoke(_messages: unknown[]) { | ||||||
| async invoke(messages: unknown[]) { | ||||||
| void messages; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unconventional suppression:
Suggested change
If the project's ESLint rule triggers on |
||||||
| this.turn += 1; | ||||||
| if (this.turn === 1) { | ||||||
| return new AIMessage({ content: '', tool_calls: [{ name: 'get_weather', args: { city: 'SF' }, id: 'call_1' }] }); | ||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded constant works today, but will silently restore stale content if
next-env.d.tsis legitimately updated (e.g., a Next.js upgrade regenerates the routes import path). A snapshot-then-restore pattern is more resilient:Suggested alternative for the full file — read then restore:
This would automatically track whatever git-committed content the file had at test start. Minor maintainability note, not a blocker.