@rig-c/review 1.16.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,6 +73,7 @@ Audio clips contain `id`, local `path` and optional `label`. Cues require `id`,
73
73
  - `GET /assets/<path>` serves an allowlisted local asset. Encode each path segment when building the URL. Responses use no-store and nosniff headers.
74
74
  - `GET /api/session` returns the current session or a fresh pending session.
75
75
  - `PUT /api/session` accepts the full session object below, with matching schema/id/revision/sourceHash. It requires the server's exact Origin, `application/json`, and <= 1 MiB. It returns the saved session with server-generated `updatedAt`.
76
+ - On a single-package session PUT, the managed front preserves allowlisted failed-check refusals from a matching worker as HTTP 400. It accepts the structured check summary or fallback and fixed check refusals in a JSON error object of at most 512 bytes. Other worker 400 errors use `FRONT_UPSTREAM_REJECTED`.
76
77
 
77
78
  ```json
78
79
  {
package/docs/WORKFLOWS.md CHANGED
@@ -466,3 +466,56 @@ Standalone parts notes and comments use
466
466
  For a part note, also pass `--part-note <part>` and supply its correction ID.
467
467
  Selected parts JSON keeps the saved verdict and adds the correction selection.
468
468
  The inventory names a retained Create-side input. Review does not read that path.
469
+
470
+ ## Four-stage acceptance fixture
471
+
472
+ The explicit browser runner in the Review checkout walks four independent Create
473
+ checkpoint prefixes using the managed loopback route for every stage and the
474
+ independent replay. The direct-route Save defect is tracked in
475
+ [Review #443](https://github.com/rig-c/review/issues/443).
476
+ Its inputs come from one archive of Create
477
+ [a1a5162](https://github.com/rig-c/create/commit/a1a5162cf4ce7fdef8caba50dc3979cf416467dd)
478
+ with SHA-256
479
+ `68034a42a70765ddda434195b945c9d87da85cf86443c657c31848ee163a8096`.
480
+ The materializer verifies the archive and each checkpoint sidecar before using
481
+ disposable copies. Checkpoint commands identify the declared acts and option
482
+ sets. The runner calls selected public consumers with explicit arguments.
483
+
484
+ Run `bun tests/four-stage-browser.ts` in a bounded Nova job from the Review
485
+ checkout after installing its frozen lock. Supply the original archive in
486
+ `REVIEW_371_CREATE_ARCHIVE`, the directory with Create's frozen-lock
487
+ `node_modules` in `REVIEW_371_CREATE_BENCH`, a new evidence directory in
488
+ `REVIEW_371_OUTPUT`, and the retained Stage 3 failed Apply JSON in
489
+ `REVIEW_371_FAILED_APPLIED`. The runner checks the failed artifact digest.
490
+ Keep Chromium's child `TMPDIR` short (the runner uses `/tmp` during launch).
491
+ The profile, Review state, input copies and producer scratch belong to the job.
492
+ The runner defaults to English followed by Korean. For a gated run, launch
493
+ `bash tests/four-stage-job.sh en` with the same pinned inputs, then launch
494
+ `bash tests/four-stage-job.sh ko` after accepting the English result. Each job
495
+ has a 600-second command deadline and uses a new evidence directory. The
496
+ `walk-checkpoints.jsonl` file records the last step entered if a run stops.
497
+
498
+ 1. Save and export the pre-rig parts and mesh verdict through the joined Review
499
+ surface. Create's shared parts-verdict checker verifies the actual saved
500
+ artifact. The next prefix already has a signature bound to its original
501
+ synthetic verdict.
502
+ 2. Save the explicit bones picks, then register and answer meshes, constraints
503
+ and motion in the generator's order. Refresh the joined view on identity
504
+ changes and check each answer and exact note in Create.
505
+ 3. Preview and Apply the body idle amplitude change from 0.5 to 2.5. The check
506
+ must pass with at least 6.12/255 torso breath heat. Export the made correction
507
+ and read back the Create config-patch record in its pending state. Replay the
508
+ exported patch in separate Review scratch. The measured 0.75 failed-check
509
+ control uses the refused UI request for a separate pending capture and
510
+ checked-claim refusal. It writes no resolved outcome.
511
+ 4. Write and check post 2 through Create on its pending prefix, then open rig 1
512
+ with explicit post 2. Inspect the authored keys and timing, exercise the
513
+ named camera Apply refusal, and save the described request. Verify the
514
+ inspected and project-relative model bindings and Create's pending readback.
515
+ The Create writer checks the explicit model selector and stores the exported
516
+ context string verbatim.
517
+
518
+ Both locales have browser captures. The runner checks original inventories
519
+ against each copy after the walk, retains named public record changes separately,
520
+ and records the first consumer verdict for each planted mutation. Inspecting,
521
+ navigating and saving a Review draft produce no Create signoff.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/review",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "type": "module",
5
5
  "description": "Local human rig inspection and structured feedback export",
6
6
  "license": "MIT",
package/src/front.ts CHANGED
@@ -99,7 +99,7 @@ async function boundedBody(req:Request,limit:number,timeoutMs=10000):Promise<Arr
99
99
  }
100
100
  /** Owner-only regular record for this key, or null. */
101
101
  async function instanceRecord(control:string,key:string):Promise<RecordFile|null>{const file=join(control,key+'.json');try{const info=await lstat(file);if(!info.isFile()||(info.mode&0o077)!==0)return null;}catch(e){if((e as NodeJS.ErrnoException).code==='ENOENT')return null;throw e;}return readRecord(file,key);}
102
- /** Worker statuses map to named front codes; worker text never reaches the client. */
102
+ /** Worker errors default to front codes unless an inspection refusal is allowlisted. */
103
103
  const upstreamFailure:Record<number,string>={400:'FRONT_UPSTREAM_REJECTED',403:'FRONT_UPSTREAM_FORBIDDEN',404:'FRONT_UPSTREAM_NOT_FOUND',405:'FRONT_UPSTREAM_METHOD',409:'FRONT_UPSTREAM_CONFLICT'};
104
104
  const responseHeaders=['content-type','content-length','content-range','accept-ranges','content-disposition','cache-control','content-security-policy','x-content-type-options','referrer-policy'];
105
105
  /** The trusted atlas frame alone may carry this closed navigation query. */
@@ -108,6 +108,26 @@ export function stageFrameQuery(mode:'single'|'compare',search:string):boolean {
108
108
  const allowed=mode==='single'?['stageEmbed','lang']:['stageEmbed','lang','side'];
109
109
  return keys.length===allowed.length&&new Set(keys).size===keys.length&&keys.every(k=>allowed.includes(k))&&params.get('stageEmbed')==='1'&&['en','ko'].includes(params.get('lang')??'')&&(mode==='single'||['a','b'].includes(params.get('side')??''));
110
110
  }
111
+ // The submitted Apply can supply the check line. Accept the producer's structured
112
+ // summary fields, never an arbitrary suffix after the failed-check code.
113
+ const submitCheckPrefix = 'EDIT_SUBMIT_UNCHECKED: applied build failed check — ';
114
+ const checkBarName = '(?:[A-Z][A-Z0-9_]*|gate|loop|seam)';
115
+ const submitCheckSummary = new RegExp(
116
+ String.raw`^check: FAIL — \d+ bar\(s\) not met(?:, \d+ declared requirement\(s\) not PASS)?; ` +
117
+ String.raw`\d+ of \d+ bar\(s\) measured, \d+ skipped(?: \(${checkBarName}(?:, ${checkBarName})*\))?` +
118
+ String.raw`(?:; \d+ warning\(s\) \((?:SEAM_OVER_MOTION(?:, CLOTH_SETTLES)?|CLOTH_SETTLES), not a bar\))?$`
119
+ );
120
+ const submitCheckFallback = new RegExp(String.raw`^(?:${checkBarName}: FAIL|check exited -?\d+)$`);
121
+ const fixedSubmitRefusals = new Set([
122
+ 'EDIT_SUBMIT_UNCHECKED: applied mesh has no successful producer check',
123
+ 'CORRECTION_CHECK_FAILED: the settled Apply requires a passing producer check',
124
+ ]);
125
+ function isSubmitCheckRefusal(error: string): boolean {
126
+ if(fixedSubmitRefusals.has(error))return true;
127
+ if(!error.startsWith(submitCheckPrefix))return false;
128
+ const detail=error.slice(submitCheckPrefix.length);
129
+ return submitCheckSummary.test(detail)||submitCheckFallback.test(detail);
130
+ }
111
131
  /** Preserve only closed, bounded inspection refusals. */
112
132
  async function inspectionRefusal(mode:'single'|'compare',method:string,path:string,response:Response,sameFingerprint:boolean):Promise<string|null>{
113
133
  const stageData=mode==='single'?path==='/api/stage-parts':/^\/api\/compare\/(?:a|b)\/stage-parts$/.test(path);
@@ -115,8 +135,9 @@ async function inspectionRefusal(mode:'single'|'compare',method:string,path:stri
115
135
  // Both reads race during the single-package page bootstrap.
116
136
  const direction=sameFingerprint&&mode==='single'&&method==='GET'&&response.status===409&&
117
137
  (path==='/api/review'||path==='/api/session');
138
+ const submit=sameFingerprint&&mode==='single'&&method==='PUT'&&path==='/api/session'&&response.status===400;
118
139
  const verdict=mode==='single'&&['/api/stage-parts/verdict','/api/stage-parts/export/json','/api/stage-parts/export/issue'].includes(path)&&[400,409].includes(response.status);
119
- if(!(direction||interview||verdict||stageData&&method==='GET'&&response.status===409)||!/^application\/json(?:\s*;|$)/i.test(response.headers.get('content-type')??''))return null;
140
+ if(!(submit||direction||interview||verdict||stageData&&method==='GET'&&response.status===409)||!/^application\/json(?:\s*;|$)/i.test(response.headers.get('content-type')??''))return null;
120
141
  const limit=512,declared=response.headers.get('content-length');if(declared!==null&&(!/^\d+$/.test(declared)||Number(declared)>limit))return null;
121
142
  const reader=response.body?.getReader();if(!reader)return null;
122
143
  try{
@@ -126,6 +147,7 @@ async function inspectionRefusal(mode:'single'|'compare',method:string,path:stri
126
147
  const data:unknown=JSON.parse(new TextDecoder().decode(body)),named='PARTS_ATLAS_UNAVAILABLE: the inspected package has no usable atlas or its source changed.';
127
148
  if(data===null||typeof data!=='object'||Array.isArray(data)||Object.keys(data).length!==1)return null;
128
149
  const error=(data as {error?:unknown}).error;
150
+ if(submit)return typeof error==='string'&&isSubmitCheckRefusal(error)?error:null;
129
151
  if(direction)return error===directionStale?directionStale:null;
130
152
  return typeof error==='string'&&(interview?[...interviewRefusals]:[...(stageData&&response.status===409?[named,...Object.values(stageDraftRefusals),...stageVerdictRefusals]:[]),interviewStale,...(verdict?stageVerdictRefusals:[])] as readonly string[]).some(code=>code===error)?error:null;
131
153
  }catch{return null;}finally{reader.releaseLock();}