diff --git a/docs/orientation-recovery.md b/docs/orientation-recovery.md
index 084fa550..e19318ef 100644
--- a/docs/orientation-recovery.md
+++ b/docs/orientation-recovery.md
@@ -115,7 +115,7 @@ explicit saved mappings remain usable. Newly exported face metadata also keeps
the actual uploaded JPEG. Capture cancellation cannot approve a preview.
The vendored package's source commit and artifact hashes are checked by
-`npm run verify:capture-core`. Its EUPL-1.2 license and CubeAssembler MIT notices
+`npm run verify:capture-core`. Its `EUPL-1.2 OR AGPL-3.0-or-later` license and CubeAssembler MIT notices
are included; production distribution remains subject to the owner's license
acceptance gate. This slice does not migrate the viewer or the puzzle engine.
diff --git a/e2e/preferences.spec.ts b/e2e/preferences.spec.ts
index 5d5f2e0a..0519c558 100644
--- a/e2e/preferences.spec.ts
+++ b/e2e/preferences.spec.ts
@@ -29,7 +29,7 @@ test('ignores invalid size and missing color profile cookies', async ({
await page.context().addCookies([
{
name: 'cube-assembler-cube-size',
- value: '8',
+ value: '16',
url: 'http://127.0.0.1:4174/',
},
{
@@ -47,6 +47,27 @@ test('ignores invalid size and missing color profile cookies', async ({
)
})
+for (const size of [8, 15]) {
+ test(`restores a ${size}x${size} size cookie and opens camera capture`, async ({
+ page,
+ }) => {
+ await page.context().addCookies([
+ {
+ name: 'cube-assembler-cube-size',
+ value: String(size),
+ url: 'http://127.0.0.1:4174/',
+ },
+ ])
+ await page.goto('/')
+ await expect(page.getByRole('combobox', { name: 'Cube' })).toHaveValue(
+ `builtin-generic-${size}`,
+ )
+ await page.getByRole('button', { name: 'Capture faces' }).click()
+ await expect(page.locator('.capture-modal-content')).toBeVisible()
+ await expect(page.getByText(/review only/i)).toHaveCount(0)
+ })
+}
+
test('restores the 3D view, sticker style, and auto-rotation after reload', async ({
page,
}) => {
diff --git a/package-lock.json b/package-lock.json
index 6022f8d5..b8a1b7fb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,7 @@
"@fontsource/ibm-plex-mono": "^5.3.0",
"@fontsource/ibm-plex-sans": "^5.3.0",
"@fontsource/space-grotesk": "^5.3.0",
- "@puzlwerk/capture-recovery": "file:vendor/puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz",
+ "@puzlwerk/capture-recovery": "file:vendor/puzlwerk-capture-recovery-0.4.0-97d0897c.tgz",
"@puzlwerk/viewer": "file:vendor/puzlwerk-viewer-0.1.0-7e14cbd8.tgz",
"fflate": "^0.8.3",
"preact": "^11.2.0"
@@ -921,10 +921,10 @@
"license": "MIT"
},
"node_modules/@puzlwerk/capture-recovery": {
- "version": "0.3.0",
- "resolved": "file:vendor/puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz",
- "integrity": "sha512-BtfE7CoPonBHrK4prBaJKizjjF/qIwhjm3aUZnhYSGJ8rDdISN62efvPH3fNz6ojh+uaVrPDGgrkrPW83euFCw==",
- "license": "EUPL-1.2",
+ "version": "0.4.0",
+ "resolved": "file:vendor/puzlwerk-capture-recovery-0.4.0-97d0897c.tgz",
+ "integrity": "sha512-1Uq7MPYcPE64XJ9gd6tYITFh9oZJ2IHjPSqp7nuIqrDN0VXDTZXL9gcwUk5vjkwOL52A3y0RZTKmfvExDp4SFw==",
+ "license": "EUPL-1.2 OR AGPL-3.0-or-later",
"dependencies": {
"@rescript/runtime": "12.3.1"
}
diff --git a/package.json b/package.json
index b61af6cc..8e8a5d7d 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,7 @@
"@fontsource/ibm-plex-mono": "^5.3.0",
"@fontsource/ibm-plex-sans": "^5.3.0",
"@fontsource/space-grotesk": "^5.3.0",
- "@puzlwerk/capture-recovery": "file:vendor/puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz",
+ "@puzlwerk/capture-recovery": "file:vendor/puzlwerk-capture-recovery-0.4.0-97d0897c.tgz",
"@puzlwerk/viewer": "file:vendor/puzlwerk-viewer-0.1.0-7e14cbd8.tgz",
"fflate": "^0.8.3",
"preact": "^11.2.0"
diff --git a/public/licenses/index.html b/public/licenses/index.html
index b2043159..1b66ebf2 100644
--- a/public/licenses/index.html
+++ b/public/licenses/index.html
@@ -29,10 +29,10 @@
Third-party licenses
includes) — AGPL-3.0-or-later
- PuzlWerk capture recovery (compiled PuzlWerk Core, vendored archive 0.3.0) —
- EUPL-1.2 ; the archive was distributed under EUPL-1.2 only. From 2026-11-17 on
- PuzlWerk Core is EUPL-1.2 OR AGPL-3.0-or-later at your choice
- (AGPL-3.0-or-later ); archives 0.1.0 and 0.3.0 stay EUPL-1.2. The archive also
+ PuzlWerk capture recovery (compiled PuzlWerk Core, vendored archive 0.4.0) —
+ EUPL-1.2 OR AGPL-3.0-or-later at your choice
+ (EUPL-1.2 , AGPL-3.0-or-later ). Archives 0.1.0 and
+ 0.3.0 were distributed under EUPL-1.2 only. The archive also
contains material derived from CubeAssembler, which keeps its MIT license and attribution
(CUBE_ASSEMBLER_LICENSE.txt inside the archive).
diff --git a/scripts/fixtureUploadServer.mjs b/scripts/fixtureUploadServer.mjs
index 70976e8d..9f5cb368 100644
--- a/scripts/fixtureUploadServer.mjs
+++ b/scripts/fixtureUploadServer.mjs
@@ -5,6 +5,8 @@ import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
const FACES = ['u', 'r', 'f', 'd', 'l', 'b']
+// Same range as CubeSizeRange.maxCubeSize; a test keeps the two equal.
+const MAX_CUBE_SIZE = 15
const MAX_BYTES = 30 * 1024 * 1024
const FAVICON = readFileSync(
new URL('./fixtureUploadFavicon.svg', import.meta.url),
@@ -93,7 +95,7 @@ async function validateFixture(byName) {
if (
!Number.isInteger(n) ||
n < 2 ||
- n > 7 ||
+ n > MAX_CUBE_SIZE ||
!validFacelets(meta.colorsURFDLB, n)
) {
throw new UploadError(400, 'Invalid fixture metadata')
diff --git a/src/client/profiles/cubeProfileReview.ts b/src/client/profiles/cubeProfileReview.ts
index 1e05ab2a..78549df5 100644
--- a/src/client/profiles/cubeProfileReview.ts
+++ b/src/client/profiles/cubeProfileReview.ts
@@ -9,5 +9,6 @@ export {
mergeCubes,
replaceCubes,
sampledSquares,
+ toggleSizeFilter,
unusedCubes,
} from '../../core/profiles/CubeProfileReview.gen'
diff --git a/src/client/profiles/cubeReviewPage.tsx b/src/client/profiles/cubeReviewPage.tsx
index d0eaafcd..725db76f 100644
--- a/src/client/profiles/cubeReviewPage.tsx
+++ b/src/client/profiles/cubeReviewPage.tsx
@@ -8,6 +8,7 @@ import {
deleteCubes,
mergeCubes,
replaceCubes,
+ toggleSizeFilter,
unusedCubes,
} from './cubeProfileReview'
import { DeleteButton, SelectionBar } from './profileDeletion'
@@ -227,13 +228,7 @@ export function CubeReviewTab({ settings, onChange, photo }: Props) {
key={size}
class="color-review-tab"
aria-pressed={sizes.includes(size)}
- onClick={() =>
- setSizes(
- sizes.includes(size)
- ? sizes.filter((s) => s !== size)
- : [...sizes, size].sort(),
- )
- }
+ onClick={() => setSizes(toggleSizeFilter(sizes, size))}
>
{size}×{size}
diff --git a/src/client/scannerAppView.tsx b/src/client/scannerAppView.tsx
index 91c9d91d..a7a9d7a5 100644
--- a/src/client/scannerAppView.tsx
+++ b/src/client/scannerAppView.tsx
@@ -418,9 +418,6 @@ export function ScannerAppView({ model }: { model: ScannerAppModel }) {
e.currentTarget.value = profile.id
}}
>
- {puzzleSize === 8 && (
- Imported 8×8 (review only)
- )}
{
- if (puzzleSize === 8) {
- setCaptureMessage(
- '8×8 is supported for imported-photo orientation review only. Select a 2×2–7×7 cube for camera capture.',
- )
- return
- }
cancelCaptureIO()
armCaptureAudio()
dismissTurnOverlay()
diff --git a/src/core/app/CubeSizeRange.res b/src/core/app/CubeSizeRange.res
new file mode 100644
index 00000000..03950afb
--- /dev/null
+++ b/src/core/app/CubeSizeRange.res
@@ -0,0 +1,8 @@
+// The cube sizes the app handles: one source for the profile list, the size
+// cookie and the capture and fixture limits. Raise `maxCubeSize` to widen the range.
+let minCubeSize = 2
+let maxCubeSize = 15
+
+let cubeSizes = Array.fromInitializer(~length=maxCubeSize - minCubeSize + 1, i => minCubeSize + i)
+
+let isSupportedSize = size => size >= minCubeSize && size <= maxCubeSize
diff --git a/src/core/app/CubeSizeRange.resi b/src/core/app/CubeSizeRange.resi
new file mode 100644
index 00000000..fb7fc8d7
--- /dev/null
+++ b/src/core/app/CubeSizeRange.resi
@@ -0,0 +1,4 @@
+@genType let minCubeSize: int
+@genType let maxCubeSize: int
+@genType let cubeSizes: array
+@genType let isSupportedSize: int => bool
diff --git a/src/core/app/Preferences.res b/src/core/app/Preferences.res
index 47329187..f2d1aaab 100644
--- a/src/core/app/Preferences.res
+++ b/src/core/app/Preferences.res
@@ -75,8 +75,13 @@ let selectionCookie = (name, value) => `${name}=${encodeURIComponent(value)}; ${
let selectedCubeSize = cookies =>
switch readSelectionOption(cookies, cubeSizeCookie) {
- | Some(("2" | "3" | "4" | "5" | "6" | "7") as value) => Null.make(Float.parseFloat(value))
- | _ => Null.null
+ | Some(value) =>
+ switch Int.fromString(value) {
+ | Some(size) if Int.toString(size) == value && CubeSizeRange.isSupportedSize(size) =>
+ Null.make(Int.toFloat(size))
+ | _ => Null.null
+ }
+ | None => Null.null
}
type cubeView =
diff --git a/src/core/capture/CaptureFaceMapping.res b/src/core/capture/CaptureFaceMapping.res
index 4a8c0fe5..49df5d1a 100644
--- a/src/core/capture/CaptureFaceMapping.res
+++ b/src/core/capture/CaptureFaceMapping.res
@@ -110,8 +110,11 @@ let assignMapping = (mapping: mapping, slot, target) =>
let validateMapping = (captured: Dict.t, mapping: mapping, size): validation => {
let issues = []
- if size < 2 || size > 8 {
- issues->Array.push("Manual face mapping supports sizes 2 through 8.")
+ if !CubeSizeRange.isSupportedSize(size) {
+ let (lo, hi) = (CubeSizeRange.minCubeSize, CubeSizeRange.maxCubeSize)
+ issues->Array.push(
+ `Manual face mapping supports sizes ${Int.toString(lo)} through ${Int.toString(hi)}.`,
+ )
}
if Array.length(mapping) != 6 {
issues->Array.push("Assign all six captured photos.")
diff --git a/src/core/capture/FixtureZip.res b/src/core/capture/FixtureZip.res
index 87c4110c..dd73cc82 100644
--- a/src/core/capture/FixtureZip.res
+++ b/src/core/capture/FixtureZip.res
@@ -73,10 +73,11 @@ let fixtureLayout = (request: fixtureRequest, now: string) => {
if (
!Float.isFinite(gridSize) ||
Math.floor(gridSize) != gridSize ||
- gridSize < 2.0 ||
- gridSize > 8.0
+ gridSize < Int.toFloat(CubeSizeRange.minCubeSize) ||
+ gridSize > Int.toFloat(CubeSizeRange.maxCubeSize)
) {
- fail("gridSize must be an integer between 2 and 8")
+ let (lowest, highest) = (CubeSizeRange.minCubeSize, CubeSizeRange.maxCubeSize)
+ fail(`gridSize must be an integer between ${Int.toString(lowest)} and ${Int.toString(highest)}`)
}
let size = Float.toString(gridSize)
[
diff --git a/src/core/capture/GuidedCaptureProtocol.res b/src/core/capture/GuidedCaptureProtocol.res
index 8f7b7881..44ba95c3 100644
--- a/src/core/capture/GuidedCaptureProtocol.res
+++ b/src/core/capture/GuidedCaptureProtocol.res
@@ -46,8 +46,7 @@ let placedFaces = (captured, placements: CaptureFaceMapping.mapping) =>
)->fromGeometry
let seedForMapping = (captured: Dict.t, size, placements): seed => {
let complete =
- size >= 2 &&
- size <= 8 &&
+ CubeSizeRange.isSupportedSize(size) &&
slots->Array.every(slot =>
captured
->Dict.get(slot)
diff --git a/src/core/profiles/CubeProfileReview.res b/src/core/profiles/CubeProfileReview.res
index 46c963c6..6dc32eeb 100644
--- a/src/core/profiles/CubeProfileReview.res
+++ b/src/core/profiles/CubeProfileReview.res
@@ -204,3 +204,9 @@ let sampledSquares = (size, core, outer) => {
}
squares
}
+
+// The size filter after the chip for `size` is clicked: added or removed, ascending.
+let toggleSizeFilter = (sizes, size) =>
+ (
+ sizes->Array.includes(size) ? sizes->Array.filter(s => s != size) : [...sizes, size]
+ )->Array.toSorted((a, b) => Int.toFloat(a - b))
diff --git a/src/core/profiles/CubeProfileReview.resi b/src/core/profiles/CubeProfileReview.resi
index 48fcdc16..a72804cd 100644
--- a/src/core/profiles/CubeProfileReview.resi
+++ b/src/core/profiles/CubeProfileReview.resi
@@ -22,3 +22,4 @@ let deleteCubes: (ProfileSettings.profileSettings, array) => ProfileSett
@genType type square = {x: float, y: float, w: float, h: float}
@genType let sampledSquares: (int, float, float) => array
+@genType let toggleSizeFilter: (array, int) => array
diff --git a/src/core/profiles/ProfileSettings.res b/src/core/profiles/ProfileSettings.res
index 48ab7f25..e3adb877 100644
--- a/src/core/profiles/ProfileSettings.res
+++ b/src/core/profiles/ProfileSettings.res
@@ -36,7 +36,7 @@ type profileSettings = {
autoMatchedColorsId?: string,
}
-let cubeSizes = [2, 3, 4, 5, 6, 7]
+let cubeSizes = CubeSizeRange.cubeSizes
let autoColorsId = "auto-colors"
let captureColorsId = "capture-colors"
let colorKeys = ["W", "Y", "O", "R", "G", "B"]
@@ -93,19 +93,9 @@ let builtinCubes = cubeSizes->Array.map(size =>
})
)
-// Imported 8x8 captures can be corrected without adding a camera-size option.
-// Keep one stable profile object so live effects do not retrigger per render.
-let importedEight = freeze({
- id: "imported-generic-8",
- name: "Imported 8×8 (review only)",
- size: 8,
- sampling: freeze({stickerCore: 0.6}),
-})
-
let builtinCube = size =>
switch builtinCubes->Array.find(cube => cube.size == size) {
| Some(cube) => cube
- | None if size == 8 => importedEight
| None => fail("Unsupported cube size")
}
@@ -153,7 +143,7 @@ let activeCube = (settings: profileSettings, size) => {
let validCubeSetting = (cube: cubeSetting) =>
cube.id != "" &&
cube.name->String.trim != "" &&
- cubeSizes->Array.includes(cube.size) &&
+ CubeSizeRange.isSupportedSize(cube.size) &&
Float.isFinite(cube.sampling.stickerCore) &&
cube.sampling.stickerCore > 0.0 &&
cube.sampling.stickerCore <= 1.0
@@ -435,7 +425,7 @@ let parseCube = (value: Untrusted.t) =>
| (Some(id), Some(name), Some(size), Some(stickerCore))
if name->String.trim != "" &&
isInteger(size) &&
- cubeSizes->Array.includes(Float.toInt(size)) &&
+ CubeSizeRange.isSupportedSize(Float.toInt(size)) &&
Float.isFinite(stickerCore) &&
stickerCore > 0.0 &&
stickerCore <= 1.0 =>
@@ -490,7 +480,7 @@ let parseProfileSettings = (value: Untrusted.t) =>
->Array.forEach(((key, id)) =>
switch (Int.fromString(key), Untrusted.string(id)) {
| (Some(size), Some(id))
- if cubeSizes->Array.includes(size) &&
+ if CubeSizeRange.isSupportedSize(size) &&
Int.toString(size) == key &&
[...cubes, builtinCube(size)]->Array.some(cube => cube.id == id && cube.size == size) =>
activeCubeBySize->Dict.set(key, id)
diff --git a/test/captureFaceMapping.test.ts b/test/captureFaceMapping.test.ts
index 948f7d97..6120fc52 100644
--- a/test/captureFaceMapping.test.ts
+++ b/test/captureFaceMapping.test.ts
@@ -186,6 +186,25 @@ describe('manual captured-face mapping', () => {
})
})
+describe('manual mapping size range', () => {
+ it.each(Array.from({ length: 14 }, (_, i) => i + 2))(
+ 'accepts a size %i cube',
+ (n) => {
+ const raw = solved(n)
+ const result = validateMapping(raw, initializeMapping(raw, null), n)
+ expect(result.issues.join(' ')).not.toMatch(/supports sizes/)
+ },
+ )
+ it.each([1, 16, 17])('refuses size %i with the supported range', (n) => {
+ const raw = solved(Math.max(n, 2))
+ const result = validateMapping(raw, initializeMapping(raw, null), n)
+ expect(result.valid).toBe(false)
+ expect(result.issues).toContain(
+ 'Manual face mapping supports sizes 2 through 15.',
+ )
+ })
+})
+
describe('capture-relative display frame', () => {
it('keeps canonical faces intact and records exact invertible transforms', () => {
const raw = asymmetric(3)
diff --git a/test/cubeProfileReview.test.ts b/test/cubeProfileReview.test.ts
index aff51663..d984c27a 100644
--- a/test/cubeProfileReview.test.ts
+++ b/test/cubeProfileReview.test.ts
@@ -6,6 +6,7 @@ import {
duplicateCubeGroups,
mergeCubes,
replaceCubes,
+ toggleSizeFilter,
unusedCubes,
} from '../src/client/profiles/cubeProfileReview'
import {
@@ -158,3 +159,30 @@ describe('deleting cubes', () => {
expect(unusedCubes(BASE)).toEqual(['warm', 'gan', 'gocube', 'big'])
})
})
+
+describe('size filter', () => {
+ it('toggles sizes and keeps them in numeric order', () => {
+ expect(toggleSizeFilter([], 10)).toEqual([10])
+ expect(toggleSizeFilter([10], 2)).toEqual([2, 10])
+ expect(toggleSizeFilter([2, 10, 15], 3)).toEqual([2, 3, 10, 15])
+ expect(toggleSizeFilter([2, 3, 10], 3)).toEqual([2, 10])
+ expect(toggleSizeFilter([9], 9)).toEqual([])
+ })
+})
+
+describe('review of cubes of size 8 through 15', () => {
+ it.each([8, 9, 12, 15])(
+ 'groups a saved size %i cube with its Generic cube and names the fallback when deleting it',
+ (size) => {
+ const saved = settings([cube(`mine-${size}`, size, 0.6)], {
+ [size]: `mine-${size}`,
+ })
+ expect(ids(duplicateCubeGroups(saved, 0.02))).toEqual([
+ [`builtin-generic-${size}`, `mine-${size}`].sort(),
+ ])
+ expect(cubeDeletionEffects(saved, [`mine-${size}`])).toEqual([
+ `${size}×${size} then uses Generic ${size}×${size}`,
+ ])
+ },
+ )
+})
diff --git a/test/fixtureUploadServer.test.ts b/test/fixtureUploadServer.test.ts
index 8ad0a6ae..5389443f 100644
--- a/test/fixtureUploadServer.test.ts
+++ b/test/fixtureUploadServer.test.ts
@@ -4,20 +4,23 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { once } from 'node:events'
import type { Server } from 'node:http'
+import { maxCubeSize } from '../src/core/app/CubeSizeRange.gen'
import { createFixtureUploadServer } from '../scripts/fixtureUploadServer.mjs'
const FACE_KEYS = ['u', 'r', 'f', 'd', 'l', 'b']
const JPEG = new Uint8Array([0xff, 0xd8, 0xff, 0xd9])
-function fixtureForm(name = 'capture-test'): FormData {
+function fixtureForm(name = 'capture-test', gridSize = 3): FormData {
const form = new FormData()
form.set('name', name)
const faces = Object.fromEntries(
FACE_KEYS.map((face) => [face, { photo: `face-${face}.jpg` }]),
)
const meta = {
- gridSize: 3,
- colorsURFDLB: FACE_KEYS.map((_, i) => 'WROGYB'[i].repeat(9)).join(' '),
+ gridSize,
+ colorsURFDLB: FACE_KEYS.map((_, i) =>
+ 'WROGYB'[i].repeat(gridSize * gridSize),
+ ).join(' '),
faces,
}
form.append(
@@ -94,6 +97,30 @@ describe('local fixture upload server', () => {
expect((await fetch(`${url}/meta.json`)).status).toBe(404)
})
+ it.each(Array.from({ length: 14 }, (_, i) => i + 2))(
+ 'accepts a size %i fixture',
+ async (size) => {
+ await start()
+ expect((await upload(fixtureForm(`size-${size}`, size))).status).toBe(201)
+ },
+ )
+
+ it('accepts the largest app size and refuses the next one', async () => {
+ await start()
+ expect(maxCubeSize).toBe(15)
+ expect((await upload(fixtureForm('edge', maxCubeSize))).status).toBe(201)
+ expect((await upload(fixtureForm('over', maxCubeSize + 1))).status).toBe(
+ 400,
+ )
+ })
+
+ it.each([1, 16, 17])('refuses a size %i fixture', async (size) => {
+ await start()
+ const response = await upload(fixtureForm('too-big', size))
+ expect(response.status).toBe(400)
+ expect(await readdir(root!)).toEqual([])
+ })
+
it('stores size-prefixed fixture names as directory names', async () => {
await start()
const name = 'cube-3x3-2026-09-27T08-55-46'
diff --git a/test/fixtureZip.test.ts b/test/fixtureZip.test.ts
index 9da973d9..87539866 100644
--- a/test/fixtureZip.test.ts
+++ b/test/fixtureZip.test.ts
@@ -93,6 +93,34 @@ describe('fixture zips', () => {
).toBe('cube-2x2-2026-09-27T08-55-46')
})
+ it.each(Array.from({ length: 14 }, (_, i) => i + 2))(
+ 'builds a fixture for a size %i cube',
+ (size) => {
+ const face = 'W'.repeat(size * size)
+ const fixture = buildFixture(
+ request({
+ name: 'sized',
+ gridSize: size,
+ colorsURFDLB: Array(6).fill(face).join(' '),
+ }),
+ )
+ expect(fixture.name).toBe('sized')
+ },
+ )
+
+ it.each([1, 16, 17])('refuses a grid size of %i', (size) => {
+ expect(() =>
+ buildFixture(
+ request({
+ gridSize: size,
+ colorsURFDLB: Array(6)
+ .fill('W'.repeat(size * size))
+ .join(' '),
+ }),
+ ),
+ ).toThrow('gridSize must be an integer between 2 and 15')
+ })
+
it('keeps explicit fixture names path-safe', () => {
expect(buildFixture(request({ name: '../../etc/passwd' })).name).toBe(
'------etc-passwd',
diff --git a/test/guidedCaptureProtocol.test.ts b/test/guidedCaptureProtocol.test.ts
index 7ad2a317..bcb0a4ca 100644
--- a/test/guidedCaptureProtocol.test.ts
+++ b/test/guidedCaptureProtocol.test.ts
@@ -73,7 +73,7 @@ it('independently derives every source and pixel orientation from the physical 3
})
}
})
-for (const size of [2, 3, 4, 5, 6, 7])
+for (const size of Array.from({ length: 14 }, (_, i) => i + 2))
for (const mirrored of [false, true]) {
it(`preserves the exact physical ${size}×${size} assembly with mirror=${mirrored}`, () => {
let original = solvedCubeFaces(size, {
@@ -102,6 +102,7 @@ for (const size of [2, 3, 4, 5, 6, 7])
}
const seed = physicalSeed(photos, size)
expect(seed.validation.valid).toBe(true)
+ expect(seed.canonicalTransform).not.toBeNull()
expect(seed.validation.faces).toEqual(standardOrientation(original).faces)
const found = generateForProtocol(photos, size, physicalProtocol)
expect(found.baselineStatus).toBe('checked')
diff --git a/test/photoProvenance.test.ts b/test/photoProvenance.test.ts
index 71a9a9e1..c302c002 100644
--- a/test/photoProvenance.test.ts
+++ b/test/photoProvenance.test.ts
@@ -192,3 +192,28 @@ it('does not initialize a capture from an unselected empty main-net render', ()
).filter(Boolean),
).toHaveLength(6)
})
+
+it.each(Array.from({ length: 14 }, (_, i) => [i + 2]))(
+ 'binds six source photos of a %i-sized cube through the capture package',
+ (size) => {
+ const grid = Array.from({ length: size }, () => Array(size).fill('W'))
+ const faces: Record = Object.fromEntries(
+ slots.map((slot) => [
+ slot,
+ {
+ photoIdentity: {
+ photoId: `size-${size}-${slot}`,
+ sourceHash: createHash('sha256').update(slot).digest('hex'),
+ sourceGrid: grid,
+ },
+ colors: grid,
+ confidence: 1,
+ timestamp: 0,
+ croppedImage: '',
+ },
+ ]),
+ )
+ const binding = new CapturePhotoBinding()
+ expect(binding.update(faces, size)).toBeDefined()
+ },
+)
diff --git a/test/preferences.test.ts b/test/preferences.test.ts
index 49f5c667..5a06a0fa 100644
--- a/test/preferences.test.ts
+++ b/test/preferences.test.ts
@@ -113,9 +113,29 @@ describe('preference cookies', () => {
expect(readSelection(cookies, COLOR_PROFILE_COOKIE)).toBe('colors/custom 1')
})
+ it.each(Array.from({ length: 14 }, (_, i) => i + 2))(
+ 'reads the supported cube-size cookie %i',
+ (size) => {
+ expect(selectedCubeSize(`${CUBE_SIZE_COOKIE}=${size}`)).toBe(size)
+ },
+ )
+
it('ignores malformed or unsupported cube-size cookies', () => {
expect(selectedCubeSize('')).toBeNull()
- expect(selectedCubeSize(`${CUBE_SIZE_COOKIE}=8`)).toBeNull()
+ for (const value of [
+ '0',
+ '1',
+ '16',
+ '17',
+ '100',
+ '8.0',
+ '+8',
+ ' 8',
+ '8x',
+ 'NaN',
+ '1e1',
+ ])
+ expect(selectedCubeSize(`${CUBE_SIZE_COOKIE}=${value}`), value).toBeNull()
expect(selectedCubeSize(`${CUBE_SIZE_COOKIE}=02`)).toBeNull()
expect(selectedCubeSize(`${CUBE_SIZE_COOKIE}=%GG`)).toBeNull()
expect(
diff --git a/test/profileSettings.test.ts b/test/profileSettings.test.ts
index 49718b0d..52f44831 100644
--- a/test/profileSettings.test.ts
+++ b/test/profileSettings.test.ts
@@ -13,9 +13,11 @@ import {
colorPalette,
copyColorProfile,
copyCubeSetting,
+ CUBE_SIZES,
cubesForSize,
deleteColorProfile,
groupCubesByName,
+ isBuiltinCube,
mergeSettings,
parseProfileSettings,
renameColorProfile,
@@ -28,6 +30,8 @@ import {
resolvedColorProfileSnapshot,
} from '../src/client/profiles/profileSettings'
+const SIZES = Array.from({ length: 14 }, (_, i) => i + 2)
+
describe('separate cube and color settings', () => {
it('groups cube choices by name and shows sizes within each group', () => {
const withNamedCubes = saveCube(
@@ -50,13 +54,13 @@ describe('separate cube and color settings', () => {
sizes: cubes.map((cube) => cube.size),
})),
).toEqual([
- { name: 'Generic', sizes: [2, 3, 4, 5, 6, 7] },
+ { name: 'Generic', sizes: SIZES },
{ name: 'My Cube', sizes: [3, 7] },
])
})
it('always lists one read-only Generic cube with a 60 percent core for every size', () => {
- expect(allCubes(EMPTY_SETTINGS)).toHaveLength(6)
+ expect(allCubes(EMPTY_SETTINGS)).toHaveLength(14)
expect(cubesForSize(EMPTY_SETTINGS, 5).map((cube) => cube.name)).toEqual([
'Generic 5×5',
])
@@ -315,4 +319,94 @@ describe('renaming profiles', () => {
expect(() => renameCube(settings, 'nope', 'Mine')).toThrow()
expect(() => renameColorProfile(settings, 'colors-a', ' ')).toThrow()
})
+
+ describe('cube sizes 2 through 15', () => {
+ it('lists the sizes 2 through 15 only', () => {
+ expect(CUBE_SIZES).toEqual(SIZES)
+ })
+
+ it.each(SIZES)('has a read-only Generic size %i cube', (size) => {
+ const cube = builtinCube(size)
+ expect(cube).toMatchObject({
+ id: `builtin-generic-${size}`,
+ name: `Generic ${size}×${size}`,
+ size,
+ sampling: { stickerCore: 0.6 },
+ })
+ expect(isBuiltinCube(cube.id)).toBe(true)
+ expect(activeCube(EMPTY_SETTINGS, size)).toBe(cube)
+ expect(cubesForSize(EMPTY_SETTINGS, size)).toEqual([cube])
+ expect(() => saveCube(EMPTY_SETTINGS, cube)).toThrow('built-in')
+ })
+
+ it.each([1, 16, 0, -3])('has no built-in cube of size %i', (size) => {
+ expect(() => builtinCube(size)).toThrow('Unsupported cube size')
+ })
+
+ it('has no review-only imported 8×8 cube', () => {
+ expect(isBuiltinCube('imported-generic-8')).toBe(false)
+ expect(allCubes(EMPTY_SETTINGS).map((cube) => cube.id)).not.toContain(
+ 'imported-generic-8',
+ )
+ expect(builtinCube(8).id).toBe('builtin-generic-8')
+ expect(allCubes(EMPTY_SETTINGS).map((cube) => cube.name)).not.toContain(
+ 'Imported 8×8 (review only)',
+ )
+ })
+
+ it.each(SIZES)(
+ 'saves, selects and reloads a custom size %i cube',
+ (size) => {
+ const custom = {
+ id: `custom-${size}`,
+ name: `My ${size}×${size}`,
+ size,
+ sampling: { stickerCore: 0.5 },
+ }
+ const saved = saveCube(EMPTY_SETTINGS, custom)
+ expect(activeCube(saved, size)).toEqual(custom)
+ const reloaded = parseProfileSettings(JSON.parse(JSON.stringify(saved)))
+ expect(reloaded.cubes).toEqual([custom])
+ expect(activeCube(reloaded, size).id).toBe(custom.id)
+ expect(
+ selectCube(EMPTY_SETTINGS, builtinCube(size).id).activeCubeBySize,
+ ).toEqual({ [size]: builtinCube(size).id })
+ },
+ )
+
+ it.each([1, 16, 100])('rejects a custom cube of size %i', (size) => {
+ const custom = {
+ id: 'bad',
+ name: 'Bad',
+ size,
+ sampling: { stickerCore: 0.5 },
+ }
+ expect(() => saveCube(EMPTY_SETTINGS, custom)).toThrow('Invalid cube')
+ const parsed = parseProfileSettings({
+ cubes: [custom],
+ colors: [],
+ activeCubeBySize: { [size]: 'bad' },
+ activeColorsId: AUTO_COLORS_ID,
+ })
+ expect(parsed.cubes).toEqual([])
+ expect(parsed.activeCubeBySize).toEqual({})
+ })
+
+ it('keeps a stored active cube for size 8 and 15', () => {
+ const parsed = parseProfileSettings({
+ cubes: [],
+ colors: [],
+ activeCubeBySize: {
+ 8: 'builtin-generic-8',
+ 15: 'builtin-generic-15',
+ 16: 'builtin-generic-16',
+ },
+ activeColorsId: AUTO_COLORS_ID,
+ })
+ expect(parsed.activeCubeBySize).toEqual({
+ 8: 'builtin-generic-8',
+ 15: 'builtin-generic-15',
+ })
+ })
+ })
})
diff --git a/test/thirdPartyLicenses.test.ts b/test/thirdPartyLicenses.test.ts
index 802f2c63..17297d83 100644
--- a/test/thirdPartyLicenses.test.ts
+++ b/test/thirdPartyLicenses.test.ts
@@ -70,11 +70,13 @@ describe('third-party licenses page', () => {
it('states both licenses of the capture-recovery Core and which archive carries which', () => {
const html = page().replace(/\s+/g, ' ')
expect(html).toContain('EUPL-1.2 OR AGPL-3.0-or-later')
- expect(html).toMatch(
- /0\.3\.0\) — EUPL-1\.2<\/a>; the archive was distributed under EUPL-1\.2 only/,
+ expect(html).toContain('vendored archive 0.4.0')
+ expect(html).not.toContain('vendored archive 0.3.0')
+ expect(html).toContain(
+ 'EUPL-1.2 OR AGPL-3.0-or-later at your choice ( EUPL-1.2 , AGPL-3.0-or-later )',
)
expect(html).toContain(
- 'href="agpl-3.0.LICENSE">AGPL-3.0-or-later); archives 0.1.0 and 0.3.0 stay EUPL-1.2',
+ 'Archives 0.1.0 and 0.3.0 were distributed under EUPL-1.2 only',
)
expect(html).toContain('CUBE_ASSEMBLER_LICENSE.txt')
})
diff --git a/vendor/README.md b/vendor/README.md
index 498146ec..83fe19b2 100644
--- a/vendor/README.md
+++ b/vendor/README.md
@@ -6,7 +6,8 @@ checks that artifact and the installed source/runtime hashes. No sibling checkou
or registry publication is needed. The archive includes generated TypeScript
bindings, runtime modules, rebuildable ReScript sources, and source provenance.
-Core is licensed EUPL-1.2. The included CubeAssembler-derived material retains its
+Core is licensed `EUPL-1.2 OR AGPL-3.0-or-later` since archive 0.4.0 (the earlier archives 0.1.0
+and 0.3.0 were EUPL-1.2 only). The included CubeAssembler-derived material retains its
MIT license and attribution. These notices do not relicense the package as MIT.
Production distribution requires the owner's separate license acceptance gate.
diff --git a/vendor/capture-core.json b/vendor/capture-core.json
index 6c331dab..2306c297 100644
--- a/vendor/capture-core.json
+++ b/vendor/capture-core.json
@@ -1,9 +1,9 @@
{
"package": "@puzlwerk/capture-recovery",
- "version": "0.3.0",
- "artifact": "puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz",
- "sha256": "2750f4573fbb8ef800fbff7e638f9354e616424fb3b9078d13118b55223da25c",
- "sourceRevision": "f1fa30ac2c12b507be9c6f3041fe7ef316378c37",
+ "version": "0.4.0",
+ "artifact": "puzlwerk-capture-recovery-0.4.0-97d0897c.tgz",
+ "sha256": "7a8b68f85241cb03964b55bb00aa33aeaf5c329f19b66ece8940e77713778c99",
+ "sourceRevision": "97d0897c878932f814b785b58e723d2c361f0cf3",
"sourceRepository": "https://github.com/wstein/puzlwerk",
- "license": "EUPL-1.2 with CubeAssembler MIT notices"
+ "license": "EUPL-1.2 OR AGPL-3.0-or-later, with CubeAssembler MIT notices"
}
diff --git a/vendor/puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz b/vendor/puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz
deleted file mode 100644
index 96a29d55..00000000
Binary files a/vendor/puzlwerk-capture-recovery-0.3.0-f1fa30ac.tgz and /dev/null differ
diff --git a/vendor/puzlwerk-capture-recovery-0.4.0-97d0897c.tgz b/vendor/puzlwerk-capture-recovery-0.4.0-97d0897c.tgz
new file mode 100644
index 00000000..ba306037
Binary files /dev/null and b/vendor/puzlwerk-capture-recovery-0.4.0-97d0897c.tgz differ