{
  "sourceKind": "separate production-editor working copy; not a public GitHub commit",
  "reviewedAt": "2026-10-22",
  "excerpts": [
    {
      "file": "app/studio/grid-warp.ts",
      "start": 4,
      "end": 11,
      "code": "export type GridWarp={planes?:ConnectedPlanes;enabled:boolean;points:WarpPoint[]};\nexport function rectangleWarp(x=0,y=0,width=1,height=1):GridWarp{return{enabled:true,points:Array.from({length:16},(_,i)=>({x:x+(i%4)/3*width,y:y+Math.floor(i/4)/3*height}))};}\nexport function validateGridWarp(w:GridWarp){if(w?.planes)validateConnectedPlanes(w.planes);if(!w||typeof w.enabled!=='boolean'||!Array.isArray(w.points)||w.points.length!==16||w.points.some(p=>!p||[p.x,p.y].some(n=>!Number.isFinite(n)||n<0||n>1)))throw Error('Invalid custom warp.');}\nexport function gridWarpIdentity(w?:GridWarp){return !w?.enabled||!w.planes&&w.points.every((p,i)=>Math.abs(p.x-(i%4)/3)<1e-10&&Math.abs(p.y-Math.floor(i/4)/3)<1e-10);}\nconst weights=(t:number)=>[(1-t)**3,3*t*(1-t)**2,3*t*t*(1-t),t**3];\n// Bicubic Bezier surface: moving a control point bends the continuous image surface.\nexport function warpPoint(w:GridWarp,u:number,v:number){const a=weights(u),b=weights(v);let x=0,y=0;for(let j=0;j<4;j++)for(let i=0;i<4;i++){const p=w.points[j*4+i],weight=a[i]*b[j];x+=p.x*weight;y+=p.y*weight;}return{x,y};}\nexport function gridWarpMesh(w:GridWarp,width:number,height:number){const nx=40,ny=40,points=[];for(let j=0;j<=ny;j++)for(let i=0;i<=nx;i++){const p=warpPoint(w,i/nx,j/ny);points.push({x:i/nx*width,y:j/ny*height,tx:p.x*width,ty:p.y*height});}return{nx,ny,points};}",
      "ref": "working-copy-2026-10-22",
      "sha256": "809558da576768b141c6fafe40f7c4a66087d29f52d9935a67c6cfa5dd646c21"
    },
    {
      "file": "app/studio/connected-planes.ts",
      "start": 2,
      "end": 5,
      "code": "export type ConnectedPlanes={layout:{x:number;y:number}[];destination:{x:number;y:number}[];quads:[number,number,number,number][]};\nexport const initialPlanes=():ConnectedPlanes=>({layout:[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:0,y:1},{x:.5,y:1},{x:1,y:1}],destination:[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:0,y:1},{x:.5,y:1},{x:1,y:1}],quads:[[0,1,4,3],[1,2,5,4]]});\nconst convex=(q:{x:number;y:number}[])=>q.every((p,i)=>{const b=q[(i+1)%4],c=q[(i+2)%4];return (b.x-p.x)*(c.y-b.y)-(b.y-p.y)*(c.x-b.x)>1e-6;});\nexport function validateConnectedPlanes(p:ConnectedPlanes){if(!p||!Array.isArray(p.layout)||!Array.isArray(p.destination)||p.layout.length!==p.destination.length||p.layout.length<4||p.layout.length>40||!Array.isArray(p.quads)||!p.quads.length||p.quads.length>8||[...p.layout,...p.destination].some(v=>!v||[v.x,v.y].some(n=>!Number.isFinite(n)||n<0||n>1)))throw Error('Connected plane points must stay inside the layer bounds.');for(const q of p.quads){if(q.length!==4||new Set(q).size!==4||q.some(i=>!Number.isInteger(i)||i<0||i>=p.layout.length)||!convex(q.map(i=>p.layout[i]))||!convex(q.map(i=>p.destination[i])))throw Error('Keep each connected plane convex and clockwise.');}}",
      "ref": "working-copy-2026-10-22",
      "sha256": "5c950db23324271689603bb20f34492894517d979cb6d0c84657437a755fac89"
    },
    {
      "file": "app/studio/precision-warp.ts",
      "start": 8,
      "end": 9,
      "code": "export function planesPrecision(source:PrecisionRaster,p:ConnectedPlanes){validateConnectedPlanes(p);const {width,height}=source,{sample,result,stride}=sampler(source);for(const indices of p.quads){const layout=indices.map(i=>p.layout[i]) as Quad,dest=indices.map(i=>p.destination[i]) as Quad,a=homography(layout),b=inverse(homography(dest)),x0=Math.max(0,Math.floor(Math.min(...dest.map(v=>v.x))*width)),x1=Math.min(width-1,Math.ceil(Math.max(...dest.map(v=>v.x))*width)),y0=Math.max(0,Math.floor(Math.min(...dest.map(v=>v.y))*height)),y1=Math.min(height-1,Math.ceil(Math.max(...dest.map(v=>v.y))*height));for(let y=y0;y<=y1;y++)for(let x=x0;x<=x1;x++){const uv=mapMatrix(b,(x+.5)/width,(y+.5)/height);if(uv.x< -1e-7||uv.x>1+1e-7||uv.y< -1e-7||uv.y>1+1e-7)continue;const at=mapMatrix(a,uv.x,uv.y);sample(at.x*width-.5,at.y*height-.5,(y*width+x)*stride);}}return result;}\nexport function warpPrecision(source:PrecisionRaster,grid?:GridWarp,puppet?:PuppetWarp){let r=source;if(grid?.enabled&&!gridWarpIdentity(grid))r=grid.planes?planesPrecision(r,grid.planes):meshPrecision(r,gridWarpMesh(grid,r.width,r.height));if(puppet?.enabled&&!warpIdentity(puppet))r=meshPrecision(r,puppetMesh(puppet,r.width,r.height));return r;}",
      "ref": "working-copy-2026-10-22",
      "sha256": "48a2cf67ff775b0349a103e29483768c426fdaa33223cdd3423f27b9fbfbab0e"
    },
    {
      "file": "app/studio/projective-path.ts",
      "start": 4,
      "end": 7,
      "code": "/** Projected cubic curves are rational; adaptively subdivide only when perspective is present. */\nexport function projectPath(p:PathShape,forward:number[],width=1,height=1):PathShape{\n const map=(p:Point)=>{const q=mapMatrix(forward,p.x,p.y);return {x:q.x*width,y:q.y*height};};\n const checkRegion=(points:Point[])=>{const z=points.map(p=>forward[6]*p.x+forward[7]*p.y+forward[8]);if(z.some(v=>Math.abs(v)<1e-7)||z.some(v=>v*z[0]<0))throw Error('The perspective horizon crosses a path.');};",
      "ref": "working-copy-2026-10-22",
      "sha256": "5b98aac97a071eb01d12306079d2ad20ebe6ce07e5e20989fd4e526b8408a606"
    }
  ],
  "productionUI": {
    "passed": true,
    "date": "2026-10-22",
    "route": "Connected Planes UI and project save/reopen",
    "originalBytesUnchanged": true,
    "entireLayerRoundtripExact": true,
    "planes": {
      "layout": [
        {
          "x": 0,
          "y": 0
        },
        {
          "x": 0.5,
          "y": 0
        },
        {
          "x": 1,
          "y": 0
        },
        {
          "x": 0,
          "y": 1
        },
        {
          "x": 0.5,
          "y": 1
        },
        {
          "x": 1,
          "y": 1
        }
      ],
      "destination": [
        {
          "x": 0,
          "y": 0
        },
        {
          "x": 0.5,
          "y": 0.12
        },
        {
          "x": 1,
          "y": 0
        },
        {
          "x": 0,
          "y": 1
        },
        {
          "x": 0.5,
          "y": 0.88
        },
        {
          "x": 1,
          "y": 1
        }
      ],
      "quads": [
        [
          0,
          1,
          4,
          3
        ],
        [
          1,
          2,
          5,
          4
        ]
      ]
    },
    "testedMask": false,
    "fullHistoricalSuiteRerun": false
  },
  "historicalReports": [
    {
      "file": "connected-planes-render-results.json",
      "sha256": "c8c2d2715b1a2f9763e6d76c7c97b829fefc23785e363558a60be1d8c2384d93",
      "results": {
        "passed": true,
        "checks": [
          "Identity planes preserve exact pixels",
          "Connected splits propagate to neighbors",
          "Shared warped edge has no alpha seam",
          "Folded planes rejected",
          "PSD/PSB restores editable original pixels, shared planes and mask with exact composite"
        ]
      },
      "freshRun": false
    },
    {
      "file": "connected-planes-ui-results.json",
      "sha256": "3e6aa1f0b6b7546ef7af9e4538917187a221b0a98124feb24d39089c246d0a88",
      "results": {
        "passed": true,
        "checks": [
          "Connected plane splits and cancellation",
          "Shared vertex edit",
          "Undo/Redo and recovery",
          "Original pixels and mask retained"
        ],
        "errors": []
      },
      "freshRun": false
    }
  ]
}