From 187619cbb20bdc0e042a29e694e2efcdc53b2fc2 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sat, 29 Nov 2025 17:52:10 +0100 Subject: [PATCH] wip --- Modelfile | 8 - .../adapters/automation/FixtureServer.ts | 268 ++---------------- 2 files changed, 24 insertions(+), 252 deletions(-) delete mode 100644 Modelfile diff --git a/Modelfile b/Modelfile deleted file mode 100644 index cdf0a0cad..000000000 --- a/Modelfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mychen76/qwen3_cline_roocode -PARAMETER num_ctx 65536 # Or higher if supported/needed. Maximize context. -PARAMETER temperature 0.25 # Low for precision, but slightly higher than 0.1/0.2 for minor flexibility -PARAMETER top_p 0.9 # Focuses on probable tokens, cutting off the long tail (less likely than top_p=1) -PARAMETER top_k 40 # Further restricts sampling pool (often works well with top_p) -PARAMETER repeat_penalty 1.1 # Mild penalty to discourage nonsensical loops, but allows necessary code repetition. -PARAMETER num_keep 1024 # Keep initial instructions/context -PARAMETER num_predict 16384 # Generous prediction length for substantial code blocks \ No newline at end of file diff --git a/packages/infrastructure/adapters/automation/FixtureServer.ts b/packages/infrastructure/adapters/automation/FixtureServer.ts index f279d71c5..07f0ad0c3 100644 --- a/packages/infrastructure/adapters/automation/FixtureServer.ts +++ b/packages/infrastructure/adapters/automation/FixtureServer.ts @@ -11,7 +11,7 @@ export interface IFixtureServer { /** * Step number to fixture file mapping. - * Steps 2-17 map to the corresponding HTML fixture files. + * Steps 1-18 map to the corresponding HTML fixture files. */ const STEP_TO_FIXTURE: Record = { 1: '01-hosted-racing.html', @@ -40,7 +40,8 @@ export class FixtureServer implements IFixtureServer { private fixturesPath: string; constructor(fixturesPath?: string) { - this.fixturesPath = fixturesPath ?? path.resolve(process.cwd(), 'html-dumps/iracing-hosted-sessions'); + this.fixturesPath = + fixturesPath ?? path.resolve(process.cwd(), 'html-dumps/iracing-hosted-sessions'); } async start(port: number = 3456): Promise<{ url: string; port: number }> { @@ -57,7 +58,6 @@ export class FixtureServer implements IFixtureServer { this.server.on('error', (err: NodeJS.ErrnoException) => { if (err.code === 'EADDRINUSE') { - // Try next port this.server = null; this.start(port + 1).then(resolve).catch(reject); } else { @@ -102,7 +102,23 @@ export class FixtureServer implements IFixtureServer { private handleRequest(req: http.IncomingMessage, res: http.ServerResponse): void { const urlPath = req.url || '/'; - const fileName = urlPath === '/' ? 'step-02-hosted-racing.html' : urlPath.replace(/^\//, ''); + + let fileName: string; + if (urlPath === '/') { + fileName = STEP_TO_FIXTURE[1]; + } else { + fileName = urlPath.replace(/^\//, ''); + + const legacyMatch = fileName.match(/^step-(\d+)-/); + if (legacyMatch) { + const stepNum = Number(legacyMatch[1]); + const mapped = STEP_TO_FIXTURE[stepNum]; + if (mapped) { + fileName = mapped; + } + } + } + const filePath = path.join(this.fixturesPath, fileName); // Security check - prevent directory traversal @@ -114,246 +130,10 @@ export class FixtureServer implements IFixtureServer { fs.readFile(filePath, (err, data) => { if (err) { - if (err.code === 'ENOENT') { - // Only generate fallback HTML for known step fixture filenames - // (e.g., 'step-03-create-race.html'). For other missing files, - // return 404 so tests that expect non-existent files to be 404 still pass. - if (!/^step-\d+-/.test(fileName)) { - res.writeHead(404, { 'Content-Type': 'text/plain' }); - res.end('Not Found'); - return; - } - - const stepMatch = fileName.match(/(\d+)-/); - const stepNum = stepMatch ? Number(stepMatch[1]) : 1; - - const fallbackHtml = ` - - - - - Mock Fixture - Step ${stepNum} - - - - - - - - - - - - -`; - - res.writeHead(200, { 'Content-Type': 'text/html' }); - res.end(fallbackHtml); + const errno = (err as NodeJS.ErrnoException).code; + if (errno === 'ENOENT') { + res.writeHead(404, { 'Content-Type': 'text/plain' }); + res.end('Not Found'); } else { res.writeHead(500, { 'Content-Type': 'text/plain' }); res.end('Internal Server Error');