3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Warn when a path traced job skips postPasses (#2226)
Nguyen Xuan An048e1e24fe83
diff --git a/changes/2226.md b/changes/2226.mdnew file mode 100644index 00000000..44982b4e--- /dev/null+++ b/changes/2226.md@@ -0,0 +1 @@+- A path traced render job on a scene with `postPasses` now reports a `post-passes-skipped` warning in `metrics.diagnostics` that names the passes it did not run, and the path tracer and user pass docs say so (#2226)diff --git a/docs/agent-render-jobs.md b/docs/agent-render-jobs.mdindex cf55a011..ea900b5e 100644--- a/docs/agent-render-jobs.md+++ b/docs/agent-render-jobs.md@@ -248,7 +248,7 @@ An `image`, `stills` or `video` job can ask for the offline [path tracer](https:"renderer": { "type": "pathTracer", "backend": "gpu", "samples": 64, "bounces": 8, "denoise": true, "seed": 0, "maxSeconds": 120 } }```-Every field after `type` is optional. `backend` is `cpu` (the default, byte-identical on SwiftShader smokes), `gpu`, which traces in a WebGL2 shader and needs a runtime started on the GPU backend (a `--backend cpu` runtime refuses it), or `native`, which traces on hardware ray queries (Vulkan) through the optional `@codepawlhq/cook` package. A native job exports the scene from the job page, traces it in the job runner with the Cycles-matching kernel (`JS67_NATIVE_KERNEL=legacy` keeps the older one), then denoises (OIDN runs on a device kept alive between frames when the OIDN library is installed, so only the first frame pays for the device and the filter commit; `metrics.pathTracer.oidnMode` says `in-process` or `cli`) and writes the PNG as the other backends do: `denoise: true` means OIDN with the albedo and normal guides when `@codepawlhq/crucible-denoise-oidn` and its binary are installed, else (or when OIDN fails) the GPU a-trous filter of the native tracer with a note in `metrics.pathTracer.denoiserNote` (`denoiser: "atrous"`; it is biased, it smooths; `denoise: "wavelet"` asks for the CPU filter). The report carries `kernel` and `averageSamples`. The Cycles-matching kernel takes up to 4,000,000 unique triangles (copies of a shared mesh count once, and the scene may hold four times that with every copy counted); the job reads the scene from its page as one Blob over the DevTools stream (about half the time of returning it as base64, and no single message bounds it); from the second frame of a `stills` or `video` job the page sends only the table bytes that changed since the frame before (a scene with moving particles sends the particles, not the static meshes; a table that changed length sends the changes in the bytes it shares with the old one and the new tail), the job rebuilds the same tables from them, and `metrics.pathTracer.exportSentBytes` says how many bytes crossed (`JS67_NATIVE_EXPORT_DELTA=off` reads every table whole); the `cpu` backend and the older kernel keep 400,000, and the `gpu` backend takes what the page's WebGL2 context holds, up to 2,000,000 (see [path-tracer.md](https://github.com/codepawl/crucible/blob/main/docs/path-tracer.md)). A larger scene is refused with an error that names the limit. On the Cycles-matching kernel the job sends each material whole (FORMAT-v2 tables, instanced or not): blend opacity (`alphaMode: "blend"` with `opacity` below 1), sheen, `specular` and `specularColor`, anisotropy, iridescence, attenuation, and the clearcoat, transmission, sheen, anisotropy and coat normal maps all reach the kernel, and `metrics.pathTracer.ignored` lists only what it does not shade (the legacy kernel keeps the v1 tables and the old notes). A scene whose materials cannot be exported whole is traced from the v1 tables for that frame with the reason in `materialsReason`; the native tracer stays usable. It never fails for lack of the package: without it, without its built binary or without a Vulkan ray query adapter the job runs on `gpu` (`cpu` on a cpu runtime) and `metrics.pathTracer.backendNote` says why; `metrics.pathTracer.backend` always names what ran. The look up costs one import and is cached per process. Native traces volume fog and subsurface scattering with the same walk as the WebGPU megakernel, honours `maxSeconds`, and honours `noiseThreshold` on the GPU (after 16 samples, and then every 8, a converged pixel draws no more; `report.averageSamples` is the mean a pixel drew). The `gpu` fallback ignores `noiseThreshold`. The report in `metrics.pathTracer` names the `backend` that ran, the `gpu`, `gpuCompileSeconds` and `gpuKernelCompiles`. A `stills` or `video` job traces every frame with the same options: the kernel compiles once per job page and each frame reuses it, so a film shows `gpuKernelCompiles: 1`. A native `stills` or `video` job (the Cycles-matching kernel) also keeps one native session for the whole job: a frame that only moves the camera reuses the uploaded scene, the compiled kernel and the acceleration structures; changed materials, lights, instance transforms or triangles (the table may change length) are sent to the session, which rebuilds only the changed meshes' acceleration structures; a frame whose record counts, placed meshes, emissive meshes, textures or environment changed gets a new session, and a failed session update or render falls back to a new session or a one-shot trace for that frame. `metrics.pathTracer.nativeSession` says which one each frame took (`path` is `new-session`, `reused`, `updated` or `one-shot`, with `reason`, `changedTables`, `changedMeshes` (after a triangles update), `pipelineReused` and `accelerationReused`); `metrics.nativeSessionRoutes` lists the `path` of every frame. A job reuses the session only when the tables the page exports are equal to the previous frame's apart from the camera (`reused`), or differ in material values, lights, instance transforms or triangles (`updated`). Geometry that moves with the time, such as particle systems (sparks, swaying hair) or a moved node in a scene exported as flattened triangles, goes through `updated` and costs one BLAS build per changed mesh plus the TLAS. A changed emissive mesh, other record counts or another set of placed meshes gives that frame a new session, which costs what a one-shot trace costs and is byte-identical to it; `reason` names the first table that differed. A single-frame job and `JS67_NATIVE_KERNEL=legacy` trace one-shot and carry no `nativeSession`; `JS67_NATIVE_SESSIONS=off` in the server's environment traces every frame one-shot (default on). The session is closed when the job ends or fails, and every frame of a stills job equals the one-shot render byte for byte. A native video also blends its frames over time, so the noise the denoiser leaves does not shimmer from frame to frame: each pixel finds where its surface point was in the frame before (from the first-hit distance and the two cameras) and the filtered light is averaged with what was gathered there. A pixel whose surface was hidden, off screen, another surface or seen from a direction more than about 6 degrees away in the frame before starts again, so a cut to another view starts again too, and the whole image starts again at a new shot of a `timeline` and on any frame whose scene, light or render settings changed (its route is not `reused`), so a video with moving parts or lights, or a dip through black, gets no blending on those frames. Each frame of such a video traces with its own seed (`seed` plus the frame number), and `metrics.pathTracer.temporal` reports `historyShare` (the share of pixels that found their history, from the last frame) with `restarted` saying why an image started again. The blend assumes a still scene under a moving camera: light that depends on the view (a sharp reflection, a highlight, the view through glass) trails the camera by a few frames, and an orthographic camera is not blended. `JS67_NATIVE_TEMPORAL=off` in the server's environment turns the blending off, which makes every video frame equal its one-shot render again. A video of traced frames goes through the ffmpeg encoder (the browser H.264 encoder has no drawn frame to read), `maxSeconds` limits each frame, and the job deadline is `maxSeconds` times the frame count plus 60 seconds, up to the job ceiling. Limits: `samples` 1 to 1024, `bounces` 1 to 16, `seed` 0 to 2147483647, `maxSeconds` 1 to 600 (the job's deadline is `maxSeconds` plus 60 seconds; a 1920 by 1080 still of a 180,000 triangle room at 64 samples took 246 s, so give a large still `maxSeconds` 600). `passes` are refused with it, because the tracer has no object ID, depth or normal pass; part findings (framing, floating, intersecting, textures, z-fighting) still reach `metrics.diagnostics` from the first frame, with a `findings-unavailable` entry saying that exposure findings are not available on a traced job (see [mcp.md](mcp.md)). The tracer loads in the job page on demand, uses eight threads at below-normal priority, stops pixels that have converged (`report.averageSamples`), and writes `render.png`; `scene_render_result` metrics carry `pathTracer` with the samples, threads, seconds and what the scene asked for that was not drawn. The same recipe and seed give the same PNG on the cpu and gpu backends; the native Cycles-matching kernel is not always byte-identical between runs (on the demo room at 960 by 540 and 256 samples two jobs differed in a few bytes; a 480 by 270 job with OIDN did not). A job that passes `maxSeconds` fails and writes no image.+Every field after `type` is optional. `backend` is `cpu` (the default, byte-identical on SwiftShader smokes), `gpu`, which traces in a WebGL2 shader and needs a runtime started on the GPU backend (a `--backend cpu` runtime refuses it), or `native`, which traces on hardware ray queries (Vulkan) through the optional `@codepawlhq/cook` package. A native job exports the scene from the job page, traces it in the job runner with the Cycles-matching kernel (`JS67_NATIVE_KERNEL=legacy` keeps the older one), then denoises (OIDN runs on a device kept alive between frames when the OIDN library is installed, so only the first frame pays for the device and the filter commit; `metrics.pathTracer.oidnMode` says `in-process` or `cli`) and writes the PNG as the other backends do: `denoise: true` means OIDN with the albedo and normal guides when `@codepawlhq/crucible-denoise-oidn` and its binary are installed, else (or when OIDN fails) the GPU a-trous filter of the native tracer with a note in `metrics.pathTracer.denoiserNote` (`denoiser: "atrous"`; it is biased, it smooths; `denoise: "wavelet"` asks for the CPU filter). The report carries `kernel` and `averageSamples`. The Cycles-matching kernel takes up to 4,000,000 unique triangles (copies of a shared mesh count once, and the scene may hold four times that with every copy counted); the job reads the scene from its page as one Blob over the DevTools stream (about half the time of returning it as base64, and no single message bounds it); from the second frame of a `stills` or `video` job the page sends only the table bytes that changed since the frame before (a scene with moving particles sends the particles, not the static meshes; a table that changed length sends the changes in the bytes it shares with the old one and the new tail), the job rebuilds the same tables from them, and `metrics.pathTracer.exportSentBytes` says how many bytes crossed (`JS67_NATIVE_EXPORT_DELTA=off` reads every table whole); the `cpu` backend and the older kernel keep 400,000, and the `gpu` backend takes what the page's WebGL2 context holds, up to 2,000,000 (see [path-tracer.md](https://github.com/codepawl/crucible/blob/main/docs/path-tracer.md)). A larger scene is refused with an error that names the limit. On the Cycles-matching kernel the job sends each material whole (FORMAT-v2 tables, instanced or not): blend opacity (`alphaMode: "blend"` with `opacity` below 1), sheen, `specular` and `specularColor`, anisotropy, iridescence, attenuation, and the clearcoat, transmission, sheen, anisotropy and coat normal maps all reach the kernel, and `metrics.pathTracer.ignored` lists only what it does not shade (the legacy kernel keeps the v1 tables and the old notes). A scene whose materials cannot be exported whole is traced from the v1 tables for that frame with the reason in `materialsReason`; the native tracer stays usable. It never fails for lack of the package: without it, without its built binary or without a Vulkan ray query adapter the job runs on `gpu` (`cpu` on a cpu runtime) and `metrics.pathTracer.backendNote` says why; `metrics.pathTracer.backend` always names what ran. The look up costs one import and is cached per process. Native traces volume fog and subsurface scattering with the same walk as the WebGPU megakernel, honours `maxSeconds`, and honours `noiseThreshold` on the GPU (after 16 samples, and then every 8, a converged pixel draws no more; `report.averageSamples` is the mean a pixel drew). The `gpu` fallback ignores `noiseThreshold`. The report in `metrics.pathTracer` names the `backend` that ran, the `gpu`, `gpuCompileSeconds` and `gpuKernelCompiles`. A `stills` or `video` job traces every frame with the same options: the kernel compiles once per job page and each frame reuses it, so a film shows `gpuKernelCompiles: 1`. A native `stills` or `video` job (the Cycles-matching kernel) also keeps one native session for the whole job: a frame that only moves the camera reuses the uploaded scene, the compiled kernel and the acceleration structures; changed materials, lights, instance transforms or triangles (the table may change length) are sent to the session, which rebuilds only the changed meshes' acceleration structures; a frame whose record counts, placed meshes, emissive meshes, textures or environment changed gets a new session, and a failed session update or render falls back to a new session or a one-shot trace for that frame. `metrics.pathTracer.nativeSession` says which one each frame took (`path` is `new-session`, `reused`, `updated` or `one-shot`, with `reason`, `changedTables`, `changedMeshes` (after a triangles update), `pipelineReused` and `accelerationReused`); `metrics.nativeSessionRoutes` lists the `path` of every frame. A job reuses the session only when the tables the page exports are equal to the previous frame's apart from the camera (`reused`), or differ in material values, lights, instance transforms or triangles (`updated`). Geometry that moves with the time, such as particle systems (sparks, swaying hair) or a moved node in a scene exported as flattened triangles, goes through `updated` and costs one BLAS build per changed mesh plus the TLAS. A changed emissive mesh, other record counts or another set of placed meshes gives that frame a new session, which costs what a one-shot trace costs and is byte-identical to it; `reason` names the first table that differed. A single-frame job and `JS67_NATIVE_KERNEL=legacy` trace one-shot and carry no `nativeSession`; `JS67_NATIVE_SESSIONS=off` in the server's environment traces every frame one-shot (default on). The session is closed when the job ends or fails, and every frame of a stills job equals the one-shot render byte for byte. A native video also blends its frames over time, so the noise the denoiser leaves does not shimmer from frame to frame: each pixel finds where its surface point was in the frame before (from the first-hit distance and the two cameras) and the filtered light is averaged with what was gathered there. A pixel whose surface was hidden, off screen, another surface or seen from a direction more than about 6 degrees away in the frame before starts again, so a cut to another view starts again too, and the whole image starts again at a new shot of a `timeline` and on any frame whose scene, light or render settings changed (its route is not `reused`), so a video with moving parts or lights, or a dip through black, gets no blending on those frames. Each frame of such a video traces with its own seed (`seed` plus the frame number), and `metrics.pathTracer.temporal` reports `historyShare` (the share of pixels that found their history, from the last frame) with `restarted` saying why an image started again. The blend assumes a still scene under a moving camera: light that depends on the view (a sharp reflection, a highlight, the view through glass) trails the camera by a few frames, and an orthographic camera is not blended. `JS67_NATIVE_TEMPORAL=off` in the server's environment turns the blending off, which makes every video frame equal its one-shot render again. A video of traced frames goes through the ffmpeg encoder (the browser H.264 encoder has no drawn frame to read), `maxSeconds` limits each frame, and the job deadline is `maxSeconds` times the frame count plus 60 seconds, up to the job ceiling. Limits: `samples` 1 to 1024, `bounces` 1 to 16, `seed` 0 to 2147483647, `maxSeconds` 1 to 600 (the job's deadline is `maxSeconds` plus 60 seconds; a 1920 by 1080 still of a 180,000 triangle room at 64 samples took 246 s, so give a large still `maxSeconds` 600). A scene with `postPasses` is traced without them: the PNG is the plain traced frame and `metrics.diagnostics` carries a `post-passes-skipped` warning naming the passes (see [user-passes.md](user-passes.md)). `passes` are refused with it, because the tracer has no object ID, depth or normal pass; part findings (framing, floating, intersecting, textures, z-fighting) still reach `metrics.diagnostics` from the first frame, with a `findings-unavailable` entry saying that exposure findings are not available on a traced job (see [mcp.md](mcp.md)). The tracer loads in the job page on demand, uses eight threads at below-normal priority, stops pixels that have converged (`report.averageSamples`), and writes `render.png`; `scene_render_result` metrics carry `pathTracer` with the samples, threads, seconds and what the scene asked for that was not drawn. The same recipe and seed give the same PNG on the cpu and gpu backends; the native Cycles-matching kernel is not always byte-identical between runs (on the demo room at 960 by 540 and 256 samples two jobs differed in a few bytes; a 480 by 270 job with OIDN did not). A job that passes `maxSeconds` fails and writes no image.A native frame that compiled its kernel says so in `metrics.pathTracer`: `compileSeconds` is the compile, `gpuTraceSeconds` the trace; a compile over one second adds `kernelCompileNote`. The first trace of each scene variant (a scene with no emitter is its own variant) compiles; later frames of the job reuse it. Details: [path-tracer.md](https://github.com/codepawl/crucible/blob/main/docs/path-tracer.md).diff --git a/docs/path-tracer.md b/docs/path-tracer.mdindex 0e8c11b4..ee9a2c5a 100644--- a/docs/path-tracer.md+++ b/docs/path-tracer.md@@ -75,6 +75,7 @@ A glass part with a material `dispersion` above 0 splits white light into colour`report.ignored` lists the ones this scene asks for; a render job returns it as `metrics.pathTracer.ignored`. It names occlusion maps, anisotropy, iridescence, sheen, moss, splat layers, baked `lightMap`s, tagged materials (foliage, liquid, water and the like, traced as plain surfaces), blended transparency, and the fog fields above.+- `postPasses` (user post-process passes): the tracer writes the lit frame only and has no first-hit depth, normal or object ID buffer for a pass to read, so a render job returns the plain traced frame. The job completes and `metrics.diagnostics` carries a `post-passes-skipped` warning naming the passes (#2226; [user-passes.md](user-passes.md)). Render the look with a raster job.- The procedural sky when there is no environment map (the sky is black).The native `cycles` kernel reads an environment map as it is, as Blender Cycles does: a sun stored at tens of thousands lights the scene with all of it. Until #1172 its packer capped every texel at 16, which left a sunlit scene (Pavilion) at 0.77 of its Cycles brightness; without the cap it is at 1.01 ([numbers](https://github.com/codepawl/crucible/blob/main/docs/cycles-parity.md#the-environment-limit-of-16-1172)). A caller of the Cook package can still pass `hdriRadianceLimit` to cap the texels and trade that energy for less noise at low sample counts.diff --git a/docs/user-passes.md b/docs/user-passes.mdindex 047166e4..fe7d88c5 100644--- a/docs/user-passes.md+++ b/docs/user-passes.md@@ -6,7 +6,7 @@ The same field works from three places: the `crucible/addons/user-pass` addon, t## Where a pass runs-Passes run in order on the finished frame: after depth of field, motion blur, line art, bloom, grading and the view transform, as the last step before the canvas. The first pass reads the frame as it would have been shown. Each next pass reads the one before. Colours are display-referred (0 to 1), so quantising and dithering work on the values people see. The path tracer does not apply passes. Render passes (`pass: 'depth'` and the others) and the water mirror are unaffected.+Passes run in order on the finished frame: after depth of field, motion blur, line art, bloom, grading and the view transform, as the last step before the canvas. The first pass reads the frame as it would have been shown. Each next pass reads the one before. Colours are display-referred (0 to 1), so quantising and dithering work on the values people see. The path tracer does not apply passes: a path traced job (`renderer.type` `pathTracer`, any backend) returns the plain traced frame, because the tracer has no first-hit depth, normal or object ID buffer for a pass to read. The job still completes, and its `metrics.diagnostics` carries a `post-passes-skipped` warning (#2226) that names the passes it left out. A scene without `postPasses` gets no such entry. Render passes (`pass: 'depth'` and the others) and the water mirror are unaffected.## A passdiff --git a/scripts/agent-runtime.mjs b/scripts/agent-runtime.mjsindex 98d3f737..a677f925 100644--- a/scripts/agent-runtime.mjs+++ b/scripts/agent-runtime.mjs@@ -59,7 +59,7 @@ import { ANNOTATE_LIMITS, validateMarks, isBoundedPng } from '../src/agent-annotimport { REVIEW_LINK_LIMITS, newReviewId, parseReviewFile, validateReviewMarks } from '../src/review-link.js';import { writeReviewBuild } from './review-page.mjs';import { normalizeReview, reviewDeadlineMessage, REVIEW_LIMITS } from './agent-review.mjs';-import { mergeFrameDiagnostics, pathTracerFindingsLimit } from '../src/frame-checks.js';+import { mergeFrameDiagnostics, pathTracerFindingsLimit, pathTracerSkippedPassesWarning } from '../src/frame-checks.js';import { BRANCH_LIMITS, validateBranchName } from '../src/agent-branches.js';import { createSharedGpuCard } from './agent-gpu-queue.mjs';import { isBrowserLoss, describeBrowserLoss } from './agent-browser-loss.mjs';@@ -1031,7 +1031,7 @@ export function createAgentRuntime({ kernelWorkers = true, backend = 'gpu', browmetrics.pathTracer = traced.report;if (frame === 0) {const looked = await jobPage.evaluate(input => window.__agentPreview.findings(input), frameInput);- mergeFrameDiagnostics(metrics, [pathTracerFindingsLimit(), ...looked.diagnostics]);+ mergeFrameDiagnostics(metrics, [pathTracerFindingsLimit(), pathTracerSkippedPassesWarning(snapshot.recipe.postPasses), ...looked.diagnostics].filter(Boolean));}if (traced.report.nativeSession) (metrics.nativeSessionRoutes ??= []).push(traced.report.nativeSession.path);const tracedBytes = Buffer.from(traced.data, 'base64');diff --git a/src/frame-checks.js b/src/frame-checks.jsindex 83a2d153..25958b05 100644--- a/src/frame-checks.js+++ b/src/frame-checks.js@@ -339,6 +339,23 @@ export function pathTracerFindingsLimit() {};}+/**+ * The warning a path traced job carries when its scene has `postPasses`. The tracer writes the lit frame only and has no+ * first-hit depth, normal or object ID buffer for a pass to read, so the job returns the frame without the passes.+ * Returns undefined when the scene has none, so a job without `postPasses` is unchanged.+ */+export function pathTracerSkippedPassesWarning(postPasses) {+ if (!postPasses?.length) return undefined;+ const names = postPasses.map(pass => pass.name).join(', ');+ return {+ kind: 'post-passes-skipped',+ severity: 'warning',+ target: 'renderer',+ message: `This job is path traced, and the path tracer does not run postPasses: ${postPasses.length === 1 ? 'the pass' : 'the passes'} ${names} did not touch the image. The PNG is the plain traced frame.`,+ fix: 'Render the look with a raster job (leave renderer out), or trace for the lit frame and accept it without the passes (docs/user-passes.md, "Where a pass runs").',+ };+}+/** Adds a frame's diagnostics to `metrics.diagnostics`, keeping one entry per kind, target and message across a job's frames, up to 16 entries. */export function mergeFrameDiagnostics(metrics, frameDiagnostics) {if (!frameDiagnostics?.length) return;diff --git a/tests/frame-checks.test.js b/tests/frame-checks.test.jsindex e8eec3fb..9f84e772 100644--- a/tests/frame-checks.test.js+++ b/tests/frame-checks.test.js@@ -2,7 +2,7 @@ import './support/load-agent-scene-modules.mjs';import assert from 'node:assert/strict';import test from 'node:test';import { createAgentScene } from '../src/agent-scene.js';-import { exposureProblems, framingProblems, lumaShares, mergeFrameDiagnostics, pathTracerFindingsLimit, placementProblems, textureProblems } from '../src/frame-checks.js';+import { exposureProblems, framingProblems, lumaShares, mergeFrameDiagnostics, pathTracerFindingsLimit, pathTracerSkippedPassesWarning, placementProblems, textureProblems } from '../src/frame-checks.js';import { closedRoom, closedRoomWithoutBake, freezeBakeClockForFile } from './support/agent-bake-rooms.mjs';freezeBakeClockForFile();@@ -290,6 +290,16 @@ test('a path traced job says why exposure findings and passes are unavailable',assert.match(limit.fix, /scene_look/);});+test('a path traced job names the postPasses it skipped, and says nothing when the scene has none', () => {+ const warning = pathTracerSkippedPassesWarning([{ name: 'toon-water' }, { name: 'dither' }]);+ assert.equal(warning.kind, 'post-passes-skipped');+ assert.equal(warning.severity, 'warning');+ assert.match(warning.message, /passes toon-water, dither did not touch the image/);+ assert.match(warning.fix, /raster job/);+ assert.equal(pathTracerSkippedPassesWarning([]), undefined);+ assert.equal(pathTracerSkippedPassesWarning(undefined), undefined);+});+test('the path traced exposure advice says a daylit interior traces brighter and to lower the exposure, not raise it', () => {const { fix } = pathTracerFindingsLimit();assert.match(fix, /brighter than the raster one/);diff --git a/tests/path-traced-findings.test.js b/tests/path-traced-findings.test.jsindex 80dfccbf..d3f0594f 100644--- a/tests/path-traced-findings.test.js+++ b/tests/path-traced-findings.test.js@@ -26,6 +26,16 @@ const recipe = {camera: { target: [0, 0.5, 0], eye: [3, 2, 4], up: [0, 1, 0], fov: 50, near: 0.1, far: 60 },};+const passRecipe = {+ name: 'desaturate',+ uniforms: { amount: 0.5 },+ fragment: `+ vec4 userPass(vec2 uv) {+ vec3 color = texture(sceneColor, uv).rgb;+ return vec4(mix(color, vec3(dot(color, vec3(0.299, 0.587, 0.114))), amount), 1.0);+ }`,+};+test('a path traced job reports part findings and says why exposure findings and passes are unavailable',{ skip: (!hasBuild && 'run npm run build:lib first') || (!hasBrowser && 'no Chrome'), timeout: 300000 }, async context => {const workDirectory = await mkdtemp(join(tmpdir(), 'crucible-traced-findings-'));@@ -43,22 +53,32 @@ test('a path traced job reports part findings and says why exposure findings andconst call = (name, toolArguments) => client.callTool({ name, arguments: toolArguments }, { timeout: 120000 });const created = (await call('scene_create', { recipe })).structuredContent;const settings = { kind: 'image', width: 64, height: 64, renderer: { type: 'pathTracer', backend: 'cpu', samples: 2, bounces: 2, denoise: false, seed: 1, maxSeconds: 60 } };- const submitted = await call('scene_render_submit', { sessionId: created.sessionId, expectedRevision: 0, settings });- assert.notEqual(submitted.isError, true, submitted.content?.[0]?.text);- const { jobId } = submitted.structuredContent;- let record;- for (;;) {- record = (await call('scene_render_status', { jobId })).structuredContent;- if (['completed', 'cancelled', 'failed'].includes(record.state)) break;- await delay(200);- }- assert.equal(record.state, 'completed', record.error);- const result = (await call('scene_render_result', { jobId })).structuredContent;- const diagnostics = (result.metrics ?? record.metrics).diagnostics ?? [];+ const traceDiagnostics = async sessionId => {+ const submitted = await call('scene_render_submit', { sessionId, expectedRevision: 0, settings });+ assert.notEqual(submitted.isError, true, submitted.content?.[0]?.text);+ const { jobId } = submitted.structuredContent;+ let record;+ for (;;) {+ record = (await call('scene_render_status', { jobId })).structuredContent;+ if (['completed', 'cancelled', 'failed'].includes(record.state)) break;+ await delay(200);+ }+ assert.equal(record.state, 'completed', record.error);+ const result = (await call('scene_render_result', { jobId })).structuredContent;+ return (result.metrics ?? record.metrics).diagnostics ?? [];+ };+ const diagnostics = await traceDiagnostics(created.sessionId);const floating = diagnostics.find(problem => problem.kind === 'floating-node');assert.deepEqual(floating?.nodes, ['crate']);const unavailable = diagnostics.find(problem => problem.kind === 'findings-unavailable');assert.match(unavailable?.message ?? '', /object ID, depth and normal/);+ assert.equal(diagnostics.some(problem => problem.kind === 'post-passes-skipped'), false, 'a scene without postPasses gets no skipped-pass warning');++ const withPasses = (await call('scene_create', { recipe: { ...recipe, postPasses: [passRecipe] } })).structuredContent;+ const passDiagnostics = await traceDiagnostics(withPasses.sessionId);+ const skipped = passDiagnostics.find(problem => problem.kind === 'post-passes-skipped');+ assert.equal(skipped?.severity, 'warning');+ assert.match(skipped?.message ?? '', /does not run postPasses.*desaturate/);const refused = await call('scene_render_submit', { sessionId: created.sessionId, expectedRevision: 0, settings: { ...settings, passes: ['objectId'] } });assert.equal(refused.isError, true);