app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit 40c61b580e491ce4cd30c89c9c896b4ba1127604
parent 2e2243db2c9f625926fb7b51c6f0cfbf466c7792
Author: triesap <tyson@radroots.org>
Date:   Sat, 10 Oct 2026 11:08:15 +0000

web: complete save-close and first-save route continuity (HCP-116)

Diffstat:
Mweb/src/lib/components/ListingEditor.svelte | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mweb/src/lib/publishing/listing-editor.ts | 108++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
Mweb/src/routes/products/[naddr=naddr]/edit/+page.svelte | 8+++++++-
Mweb/src/routes/sell/+page.svelte | 35++++++++++++++++++++++++++++++++++-
Mweb/src/routes/selling/drafts/[draftId=local_id]/+page.svelte | 8+++++++-
Aweb/tests/e2e/harness/listing-continuity.ts | 221+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aweb/tests/e2e/listing-continuity.spec.ts | 558+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mweb/tests/provenance/output.test.mjs | 97++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
Aweb/tests/unit/listing-continuity.test.ts | 34++++++++++++++++++++++++++++++++++
Mweb/tests/unit/route-inventory.test.ts | 1+
Mweb/tools/check-output.mjs | 1223++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
11 files changed, 1966 insertions(+), 407 deletions(-)

diff --git a/web/src/lib/components/ListingEditor.svelte b/web/src/lib/components/ListingEditor.svelte @@ -2,6 +2,7 @@ import { getContext, onMount } from 'svelte'; import CapabilityGate from './CapabilityGate.svelte'; import Notice from './Notice.svelte'; + import OperationStatus from './OperationStatus.svelte'; import { foodUnits } from '../contracts/food-availability-v1/values.ts'; import type { PublicDraftForm } from '../contracts/local-records.ts'; import { @@ -16,6 +17,7 @@ openListingEditor, listingEditorSnapshot, editListingEditor, + saveAndCloseListingEditor, closeListingEditor, subscribeListingEditor, type ListingEditor as Editor, @@ -23,13 +25,25 @@ type ListingEditorSnapshot } from '../publishing/listing-editor.ts'; import { internalHref } from '../navigation-url.ts'; - let { route }: { route: ListingEditorRoute } = $props(); + let { + route, + onfirstsave, + onsavedclose + }: { + route: ListingEditorRoute; + onfirstsave?: (draftId: string, current: () => boolean) => Promise<void>; + onsavedclose?: () => Promise<void>; + } = $props(); const context = getContext<IdentityViewContext>(IDENTITY_VIEW_CONTEXT); let identity = $state(identityViewSnapshot(context)), mounted = $state(false), editor = $state.raw<Editor | undefined>(), snapshot = $state<ListingEditorSnapshot>(), unavailable = $state(false); + let closeBusy = $state(false), + navigationFailed = $state(false); + let firstNavigation: Promise<void> | undefined; + let firstOwner: Editor | undefined; type Form = { -readonly [Key in keyof PublicDraftForm]: PublicDraftForm[Key]; }; @@ -109,6 +123,28 @@ form = { ...next.form }; off = subscribeListingEditor(owned, () => { snapshot = owned && listingEditorSnapshot(owned); + if ( + snapshot?.state === 'saved' && + snapshot.draftId && + resource.mode === 'new' && + owned && + firstOwner !== owned && + !closeBusy && + onfirstsave + ) { + firstOwner = owned; + firstNavigation = onfirstsave( + snapshot.draftId, + () => + alive && + mounted && + editor === owned && + !!owned && + !!listingEditorSnapshot(owned) + ).catch(() => { + if (alive) navigationFailed = true; + }); + } if (!snapshot) { unavailable = true; form = blankForm(); @@ -132,6 +168,32 @@ function connect() { return connectIdentityView(context); } + async function saveClose() { + const original = editor, + resource = route, + author = admittedAuthor; + if (closeBusy || !original || !listingEditorSnapshot(original)?.editable) + return; + closeBusy = true; + try { + const saved = await saveAndCloseListingEditor(original); + await firstNavigation; + if ( + !saved || + !mounted || + editor !== original || + route !== resource || + !author || + admittedAuthor !== author + ) + return; + await onsavedclose?.(); + } catch { + if (mounted) navigationFailed = true; + } finally { + closeBusy = false; + } + } function disconnect() { disconnectIdentityView(context); } @@ -180,7 +242,9 @@ {:else} {#if !visible.editable}<Notice tone="info" - text="These retained local values are read-only until the current listing is checked." + text={route.mode === 'draft' + ? 'This draft has a retained listing operation. Keep its original outcome for reconciliation.' + : 'These retained local values are read-only until the current listing is checked.'} />{:else}<p> Changes are saved in this browser. Browser storage is not a backup. </p>{/if} @@ -335,6 +399,18 @@ </div> </details> </form> + {#each visible.operations as operation (operation)}<OperationStatus + publicOperation={operation} + />{/each} + {#if visible.editable}<button + type="button" + onclick={saveClose} + disabled={closeBusy}>Save and close</button + >{/if} + {#if navigationFailed}<Notice + tone="warning" + text="Navigation did not complete. Your saved local data remains in this browser." + />{/if} {#if visible.editable}<p role="status"> {visible.state === 'saved' ? 'Saved in this browser.' diff --git a/web/src/lib/publishing/listing-editor.ts b/web/src/lib/publishing/listing-editor.ts @@ -33,6 +33,8 @@ import { publicDraftControllerSnapshot, editPublicDraft, flushPublicDraft, + retryPublicDraft, + saveAndClosePublicDraft, closePublicDraftController, type PublicDraftController } from './draft-controller.ts'; @@ -45,6 +47,11 @@ import { identitySessionSnapshot, subscribeIdentityInvalidation } from '../runtime/identity-session.ts'; +import { + readListingOperationView, + closeListingOperationView, + type ListingOperationView +} from './listing-operation-view.ts'; declare const editorBrand: unique symbol; export type ListingEditor = Readonly<{ [editorBrand]: true }>; @@ -62,6 +69,7 @@ export type ListingEditorSnapshot = Readonly<{ failure: string | null; coordinate: string | null; sourceEventId: string | null; + operations: readonly ListingOperationView[]; }>; type Editor = Readonly<{ current(): boolean; @@ -69,6 +77,7 @@ type Editor = Readonly<{ snapshot(): ListingEditorSnapshot | undefined; edit(form: unknown): Promise<boolean>; flush(): Promise<boolean>; + saveClose(): Promise<boolean>; subscribe(listener: () => void): () => void; }>; const editors = new WeakMap<ListingEditor, Editor>(); @@ -140,10 +149,12 @@ export async function openListingEditor( listeners = new Map<symbol, () => void>(), cancellation = new AbortController(); let alive = true, + closing = false, unsubscribe = () => {}, database: BrowserDatabase | undefined, repository: PublicDraftRepository | undefined, controller: PublicDraftController | undefined; + const operations = new Map<string, ListingOperationView>(); function current() { return ( alive && @@ -177,6 +188,8 @@ export async function openListingEditor( signal?.removeEventListener('abort', retire); cancellation.abort(); if (controller) closePublicDraftController(controller); + for (const operation of operations.values()) + closeListingOperationView(operation); if (database) closeBrowserDatabase(database); if (active.get(context)?.stamp === stamp) active.delete(context); notify(); @@ -298,6 +311,39 @@ export async function openListingEditor( } controller = acquired; if (!controller) return unavailable('resource'); + if (route.mode === 'draft') { + const quota = publicPublicationQuotaRepository(publications); + if (!quota) return unavailable('source'); + const inspected = await inspectPublicStorage(quota); + if (!current() || !inspected.ok) return unavailable('source'); + const inventory = publicInventorySnapshot(quota, inspected.value); + if (!inventory) return unavailable('source'); + for (const item of inventory.rows) { + if (item.family !== 'public_operation') continue; + const read = await readPublicListingIntent(publications, item.id); + if (!current()) return unavailable('source'); + const row = + read.status === 'found' && + publicRecordSnapshot(read.record, owner, item.id); + if (!row || row.family !== 'public_operation') + return unavailable('source'); + if (row.source.type !== 'draft' || row.source.id !== route.draftId) + continue; + if (operations.size >= 100) return unavailable('source'); + const operation = await readListingOperationView( + publications, + session, + item.id + ); + if (!current()) { + if (operation.status === 'found') + closeListingOperationView(operation.view); + return unavailable('source'); + } + if (operation.status !== 'found') return unavailable('source'); + operations.set(item.id, operation.view); + } + } } if (!current()) return unavailable('source'); const value: Editor = { @@ -313,16 +359,18 @@ export async function openListingEditor( mode: route.mode, owner, form: local ? local.form : { ...(sourceForm ?? emptyForm) }, - editable: route.mode !== 'edit', + editable: route.mode !== 'edit' && operations.size === 0, draftId: local?.draft?.id ?? null, - state: local - ? local.state === 'closed' - ? 'failed' - : local.state - : 'read-only', + state: + local && operations.size === 0 + ? local.state === 'closed' + ? 'failed' + : local.state + : 'read-only', failure: local?.failure ?? null, coordinate, - sourceEventId + sourceEventId, + operations: Array.from(operations.values()) }; }, async edit(input) { @@ -330,7 +378,8 @@ export async function openListingEditor( retire(); return false; } - if (!controller || route.mode === 'edit') return false; + if (!controller || route.mode === 'edit' || operations.size) + return false; if (!editPublicDraft(controller, input)) return false; notify(); const pending = flushPublicDraft(controller); @@ -353,7 +402,8 @@ export async function openListingEditor( retire(); return false; } - if (!controller || route.mode === 'edit') return false; + if (!controller || route.mode === 'edit' || operations.size) + return false; const pending = flushPublicDraft(controller); await Promise.resolve(); if (!current()) { @@ -369,6 +419,41 @@ export async function openListingEditor( notify(); return saved; }, + async saveClose() { + if ( + !current() || + !controller || + route.mode === 'edit' || + operations.size || + closing + ) + return false; + closing = true; + try { + if (publicDraftControllerSnapshot(controller)?.state === 'failed') { + const retried = await retryPublicDraft(controller); + if (!current()) { + retire(); + return false; + } + notify(); + if (!retried) return false; + } + const saved = await saveAndClosePublicDraft(controller); + if (!current()) { + retire(); + return false; + } + if (!saved) { + notify(); + return false; + } + retire(); + return true; + } finally { + closing = false; + } + }, subscribe(listener) { if (!current()) return () => {}; const key = Symbol(); @@ -402,6 +487,11 @@ export function flushListingEditor(editor: ListingEditor): Promise<boolean> { export function closeListingEditor(editor: ListingEditor): void { editors.get(editor)?.retire(); } +export function saveAndCloseListingEditor( + editor: ListingEditor +): Promise<boolean> { + return editors.get(editor)?.saveClose() ?? Promise.resolve(false); +} export function subscribeListingEditor( editor: ListingEditor, listener: () => void diff --git a/web/src/routes/products/[naddr=naddr]/edit/+page.svelte b/web/src/routes/products/[naddr=naddr]/edit/+page.svelte @@ -1,5 +1,6 @@ <script lang="ts"> import { page } from '$app/state'; + import { goto } from '$app/navigation'; import ListingEditor from '../../../../lib/components/ListingEditor.svelte'; import type { ListingEditorRoute } from '../../../../lib/publishing/listing-editor.ts'; const route = $derived({ @@ -8,4 +9,9 @@ } satisfies ListingEditorRoute); </script> -<ListingEditor {route} /> +<ListingEditor + {route} + onsavedclose={async () => { + await goto('/selling'); + }} +/> diff --git a/web/src/routes/sell/+page.svelte b/web/src/routes/sell/+page.svelte @@ -1,5 +1,38 @@ <script lang="ts"> import ListingEditor from '../../lib/components/ListingEditor.svelte'; + import { page } from '$app/state'; + import { canonicalLocalId } from '../../lib/private-handles.ts'; + import type { ListingEditorRoute } from '../../lib/publishing/listing-editor.ts'; + // A history return can restore the sell page under its shallow draft URL. + // Admit that original ID on mount; the first shallow save never swaps the + // mounted editor's resource or DOM while the user is typing. + const resumed = canonicalLocalId(page.shallow?.params?.draftId); + const route: ListingEditorRoute = resumed + ? { mode: 'draft', draftId: resumed } + : { mode: 'new' }; + import { goto, beforeNavigate } from '$app/navigation'; + import { draftHref } from '../../lib/routes.ts'; + import { internalHref } from '../../lib/navigation-url.ts'; + let pendingCurrent: (() => boolean) | undefined; + beforeNavigate((navigation) => { + if (navigation.shallow && pendingCurrent && !pendingCurrent()) + navigation.cancel(); + }); + async function firstSave(id: string, current: () => boolean) { + if (!current()) return; + pendingCurrent = current; + try { + const href = internalHref(draftHref(id)); + if (href !== undefined) + await goto(href, { shallow: true, replace: true, reset: false }); + else throw Error('Unavailable draft route'); + } finally { + if (pendingCurrent === current) pendingCurrent = undefined; + } + } + async function savedClose() { + await goto('/selling'); + } </script> -<ListingEditor route={{ mode: 'new' }} /> +<ListingEditor {route} onfirstsave={firstSave} onsavedclose={savedClose} /> diff --git a/web/src/routes/selling/drafts/[draftId=local_id]/+page.svelte b/web/src/routes/selling/drafts/[draftId=local_id]/+page.svelte @@ -1,5 +1,6 @@ <script lang="ts"> import { page } from '$app/state'; + import { goto } from '$app/navigation'; import ListingEditor from '../../../../lib/components/ListingEditor.svelte'; import type { ListingEditorRoute } from '../../../../lib/publishing/listing-editor.ts'; const route = $derived({ @@ -8,4 +9,9 @@ } satisfies ListingEditorRoute); </script> -<ListingEditor {route} /> +<ListingEditor + {route} + onsavedclose={async () => { + await goto('/selling'); + }} +/> diff --git a/web/tests/e2e/harness/listing-continuity.ts b/web/tests/e2e/harness/listing-continuity.ts @@ -0,0 +1,221 @@ +// HC_TEST_ONLY_QUALIFICATION_PORT: actual browser owners/native acknowledgments. +import * as editorApi from '../../../src/lib/publishing/listing-editor.ts'; +import { + createFixture as baseFixture, + blank, + inspectNative, + nativeObservation +} from './listing-editor.ts'; +import { createFixture as operationFixture } from './listing-operation-view.ts'; +import { + createIdentityViewContext, + mountIdentityView, + connectIdentityView, + disconnectIdentityView, + closeIdentityView +} from '../../../src/lib/runtime/view-context.ts'; +import type { PublicDraftForm } from '../../../src/lib/contracts/local-records.ts'; +export { blank, inspectNative, nativeObservation }; +export async function createFixture() { + const base = await baseFixture(), + context = createIdentityViewContext(); + mountIdentityView(context); + await connectIdentityView(context); + let editor: editorApi.ListingEditor | undefined; + let operation: Awaited<ReturnType<typeof operationFixture>> | undefined; + return { + inspect: base.inspect, + counts: base.counts, + async open(route: editorApi.ListingEditorRoute) { + const result = await editorApi.openListingEditor(context, route); + if (result.status === 'ready') editor = result.editor; + return result.status === 'ready' + ? { + status: result.status, + snapshot: editorApi.listingEditorSnapshot(result.editor) + } + : result; + }, + snapshot: () => editor && editorApi.listingEditorSnapshot(editor), + edit: (form: PublicDraftForm) => + editor + ? editorApi.editListingEditor(editor, form) + : Promise.resolve(false), + async saveClose(copied = false) { + const action: unknown = Reflect.get( + editorApi, + 'saveAndCloseListingEditor' + ); + if (typeof action !== 'function') + throw Error( + 'HCP116 save-close producer absent; no passing result inferred' + ); + return editor + ? await ( + action as (value: editorApi.ListingEditor) => Promise<boolean> + )(copied ? { ...editor } : editor) + : false; + }, + disconnect() { + disconnectIdentityView(context); + }, + async captured(unknown = false) { + operation = await operationFixture(); + if (unknown) { + await operation.holdSigning(); + await operation.stopSigning(); + } else if ((await operation.signed()) !== 'prepared') + throw Error('actual signature failed'); + const row = await operation.row(); + if (row.source.type !== 'draft') + throw Error('actual source draft missing'); + disconnectIdentityView(context); + await connectIdentityView(context); + return { + draftId: row.source.id, + command: row.id, + row, + signs: operation.counts() + }; + }, + async close() { + if (editor) editorApi.closeListingEditor(editor); + closeIdentityView(context); + operation?.close(); + await base.close(); + } + }; +} +// Abort actual native transactions after a genuine successful put; no fake event/result. +export function abortDraftWrites() { + const descriptor = Object.getOwnPropertyDescriptor( + IDBObjectStore.prototype, + 'put' + )!; + const original = descriptor.value as IDBObjectStore['put']; + let enabled = true, + aborts = 0; + const ids: string[] = []; + Object.defineProperty(IDBObjectStore.prototype, 'put', { + ...descriptor, + value: function (this: IDBObjectStore, value: unknown, key?: IDBValidKey) { + const request = original.call(this, value, key), + transaction = this.transaction; + if ( + enabled && + this.name === 'public_drafts' && + transaction.mode === 'readwrite' + ) { + if ( + value && + typeof value === 'object' && + 'id' in value && + typeof value.id === 'string' + ) + ids.push(value.id); + request.addEventListener('success', () => { + if (enabled) { + aborts++; + transaction.abort(); + } + }); + } + return request; + } + }); + return { + state: () => ({ aborts, ids: ids.slice() }), + restore() { + enabled = false; + Object.defineProperty(IDBObjectStore.prototype, 'put', descriptor); + } + }; +} +// Lose only original application request ACK callbacks after an actual committed +// put and its genuine readback. Native completion events/results are untouched. +export function unknownDraftAcknowledgment() { + const putDescriptor = Object.getOwnPropertyDescriptor( + IDBObjectStore.prototype, + 'put' + )!; + const originalPut = putDescriptor.value as IDBObjectStore['put']; + const ownListener = Object.getOwnPropertyDescriptor( + IDBRequest.prototype, + 'addEventListener' + ); + const listenerDescriptor = + ownListener ?? + Object.getOwnPropertyDescriptor(EventTarget.prototype, 'addEventListener')!; + const originalListener = + listenerDescriptor.value as IDBRequest['addEventListener']; + const held: { + target: IDBRequest; + event: Event; + listener: EventListenerOrEventListenerObject; + }[] = []; + let enabled = true, + putSubmitted = false, + puts = 0; + Object.defineProperty(IDBObjectStore.prototype, 'put', { + ...putDescriptor, + value: function (this: IDBObjectStore, value: unknown, key?: IDBValidKey) { + if ( + this.name === 'public_drafts' && + this.transaction.mode === 'readwrite' + ) { + putSubmitted = true; + puts++; + } + return originalPut.call(this, value, key); + } + }); + Object.defineProperty(IDBRequest.prototype, 'addEventListener', { + configurable: true, + writable: true, + value: function ( + this: IDBRequest, + type: string, + listener: EventListenerOrEventListenerObject | null, + options?: AddEventListenerOptions | boolean + ) { + if (!listener) return; + return originalListener.call( + this, + type, + function (event: Event) { + const target = event.currentTarget as IDBRequest, + source = target.source; + if ( + enabled && + putSubmitted && + type === 'success' && + source instanceof IDBObjectStore && + source.name === 'public_drafts' + ) + held.push({ target, event, listener }); + else if (typeof listener === 'function') listener.call(target, event); + else listener.handleEvent(event); + }, + options + ); + } + }); + return { + state: () => ({ puts, held: held.length }), + release() { + enabled = false; + Object.defineProperty(IDBObjectStore.prototype, 'put', putDescriptor); + if (ownListener) + Object.defineProperty( + IDBRequest.prototype, + 'addEventListener', + ownListener + ); + else Reflect.deleteProperty(IDBRequest.prototype, 'addEventListener'); + for (const row of held.splice(0)) + if (typeof row.listener === 'function') + row.listener.call(row.target, row.event); + else row.listener.handleEvent(row.event); + } + }; +} diff --git a/web/tests/e2e/listing-continuity.spec.ts b/web/tests/e2e/listing-continuity.spec.ts @@ -0,0 +1,558 @@ +import { expect, test, type Page } from '@playwright/test'; +import { build } from 'vite'; +import { svelte } from '@sveltejs/vite-plugin-svelte'; +import { fileURLToPath } from 'node:url'; +import { createStaticHarness } from '../integration/harness/static.ts'; +import type * as Fixture from './harness/listing-continuity.ts'; +import type { PublicDraftRecord } from '../../src/lib/contracts/local-records.ts'; +declare global { + interface Window { + hcp116: typeof Fixture; + hcp116Fixture: Awaited<ReturnType<typeof Fixture.createFixture>>; + hcp116Observation: ReturnType<typeof Fixture.nativeObservation>; + hcp116Abort: ReturnType<typeof Fixture.abortDraftWrites>; + hcp116Unknown: ReturnType<typeof Fixture.unknownDraftAcknowledgment>; + hcp116Input: HTMLInputElement; + } +} +let server: Awaited<ReturnType<typeof createStaticHarness>>, bundle: string; +const form = { + title: 'Exact incomplete draft', + description: ' Raw description\n', + location: '', + amount: '2,50', + currency: '', + unit: 'kg', + quantity: '03', + contactType: '', + contactValue: '' +} as const; +test.beforeAll(async () => { + server = await createStaticHarness(); + const built = await build({ + configFile: false, + plugins: [svelte({ configFile: false })], + resolve: { conditions: ['browser'] }, + logLevel: 'silent', + build: { + write: false, + minify: false, + lib: { + entry: fileURLToPath( + new URL('./harness/listing-continuity.ts', import.meta.url) + ), + name: 'hcp116', + formats: ['iife'] + } + } + }); + const output = Array.isArray(built) ? built[0] : built; + if (!('output' in output)) throw Error('actual bundle missing'); + const chunks = output.output.filter((row) => row.type === 'chunk'); + expect(chunks).toHaveLength(1); + bundle = chunks[0].code; +}); +test.afterAll(async () => { + await server?.close(); +}); +test.beforeEach(async ({ page }) => { + await page.addInitScript(() => { + window.WebSocket = class extends WebSocket { + constructor() { + super( + (() => { + throw Error('HCP116 source tests authorize no relay traffic'); + })() + ); + } + }; + }); + await page.goto(server.url + '/search'); + await page.addScriptTag({ content: bundle }); + await page.evaluate(async () => { + window.hcp116Fixture = await window.hcp116.createFixture(); + }); +}); +test.afterEach(async ({ page }) => { + await page.evaluate(async () => { + window.hcp116Observation?.restore(); + window.hcp116Abort?.restore(); + window.hcp116Unknown?.release(); + await window.hcp116Fixture?.close(); + }); +}); +async function navigate(page: Page, pathname: string) { + await page.evaluate((pathname) => { + const a = document.createElement('a'); + a.id = 'hcp116-route'; + a.href = pathname; + a.textContent = 'HCP116 controlled local route'; + document.body.append(a); + }, pathname); + await page.locator('#hcp116-route').click(); + await expect(page).toHaveURL(server.url + pathname); + await page.evaluate(() => document.querySelector('#hcp116-route')?.remove()); +} +async function newRoute(page: Page) { + await navigate(page, '/sell'); + await page + .getByRole('button', { name: 'Connect extension', exact: true }) + .last() + .click(); + await expect(page.locator('main form')).toBeVisible(); +} +async function drafts(page: Page) { + const rows = await page.evaluate( + async () => + (await window.hcp116.inspectNative()).drafts as { wire: string }[] + ); + return rows.map((row) => JSON.parse(row.wire) as PublicDraftRecord); +} +test('HCP116 genuine first acknowledged save replaces entry URL with same original DOM focus and one durable draft', async ({ + page +}) => { + await newRoute(page); + const field = page.getByLabel('Product name', { exact: true }); + await page.evaluate(() => { + window.hcp116Input = document.querySelector( + '#listing-title' + ) as HTMLInputElement; + }); + await field.fill(form.title); + await expect(page).toHaveURL(/\/selling\/drafts\/[0-9a-f-]{36}$/); + await expect(field).toBeFocused(); + expect( + await page.evaluate( + () => window.hcp116Input === document.querySelector('#listing-title') + ) + ).toBe(true); + const rows = await drafts(page); + expect(rows).toHaveLength(1); + expect(new URL(page.url()).pathname).toBe('/selling/drafts/' + rows[0].id); + expect(rows[0].form.title).toBe(form.title); + await field.fill('Later exact input'); + await expect( + page.getByText('Saved in this browser.', { exact: true }) + ).toBeVisible(); + const later = await drafts(page); + expect(later).toHaveLength(1); + expect(later[0].id).toBe(rows[0].id); + expect(later[0].form.title).toBe('Later exact input'); +}); +test('HCP116 held first native acknowledgment preserves latest edits focus and original id without another draft', async ({ + page +}) => { + await newRoute(page); + await page.evaluate(() => { + window.hcp116Observation = window.hcp116.nativeObservation(); + window.hcp116Observation.holdSave(); + window.hcp116Input = document.querySelector( + '#listing-title' + ) as HTMLInputElement; + }); + const title = page.getByLabel('Product name', { exact: true }); + await title.fill('First captured input'); + await expect + .poll( + async () => + await page.evaluate(() => window.hcp116Observation.state().held) + ) + .toBe(true); + await title.fill('Latest input while original acknowledgment waits'); + await expect(page).toHaveURL(server.url + '/sell'); + await page.evaluate(() => window.hcp116Observation.release()); + await expect(page).toHaveURL(/\/selling\/drafts\/[0-9a-f-]{36}$/); + await expect(title).toHaveValue( + 'Latest input while original acknowledgment waits' + ); + await expect(title).toBeFocused(); + expect( + await page.evaluate( + () => window.hcp116Input === document.querySelector('#listing-title') + ) + ).toBe(true); + const rows = await drafts(page); + expect(rows).toHaveLength(1); + expect(rows[0].form.title).toBe( + 'Latest input while original acknowledgment waits' + ); +}); +test('HCP116 durable draft URL reload and actual Search Back resume exact original raw values', async ({ + page +}) => { + await newRoute(page); + await page.getByLabel('Product name', { exact: true }).fill(form.title); + await expect(page).toHaveURL(/\/selling\/drafts\/[0-9a-f-]{36}$/); + await page.getByLabel('Price', { exact: true }).fill(form.amount); + await page.getByLabel('Per', { exact: true }).selectOption('kg'); + await page + .getByLabel('Advertised quantity (optional)', { exact: true }) + .fill('03'); + await expect( + page.getByText('Saved in this browser.', { exact: true }) + ).toBeVisible(); + const target = page.url(), + before = await drafts(page); + await page.getByRole('link', { name: 'Search', exact: true }).click(); + await expect(page.getByLabel('What are you looking for?')).toBeVisible(); + await page.goBack(); + await expect(page).toHaveURL(target); + await expect(page.getByLabel('Price', { exact: true })).toHaveValue('2,50'); + await expect( + page.getByLabel('Advertised quantity (optional)', { exact: true }) + ).toHaveValue('03'); + expect(await drafts(page)).toEqual(before); + // TEST_ONLY same observed author after real reload; this controlled provider + // offers no signature, relay or extension qualification. + await page.addInitScript( + (owner) => + Object.defineProperty(window, 'nostr', { + configurable: true, + value: { + getPublicKey: () => Promise.resolve(owner), + signEvent: () => + Promise.reject( + Error('HCP116 reload asserts no signature capability') + ) + } + }), + before[0].owner + ); + await page.evaluate(async () => await window.hcp116Fixture.close()); + await page.reload(); + await page.addScriptTag({ content: bundle }); + await page + .getByRole('button', { name: 'Connect extension', exact: true }) + .last() + .click(); + await expect(page).toHaveURL(target); + await expect(page.getByLabel('Price', { exact: true })).toHaveValue('2,50'); + await expect( + page.getByLabel('Advertised quantity (optional)', { exact: true }) + ).toHaveValue('03'); + expect(await drafts(page)).toEqual(before); +}); +test('HCP116 Save and close waits for genuine original acknowledgment and flushes latest input before Selling', async ({ + page +}) => { + await newRoute(page); + await page.evaluate(() => { + window.hcp116Observation = window.hcp116.nativeObservation(); + window.hcp116Observation.holdSave(); + }); + await page + .getByLabel('Product name', { exact: true }) + .fill('Initial close input'); + await expect + .poll( + async () => + await page.evaluate(() => window.hcp116Observation.state().held) + ) + .toBe(true); + await page + .getByRole('button', { name: 'Save and close', exact: true }) + .click(); + await expect(page).toHaveURL(server.url + '/sell'); + await page + .getByLabel('Description', { exact: true }) + .fill('Latest exact close description\n'); + await page.evaluate(() => window.hcp116Observation.release()); + await expect(page).toHaveURL(server.url + '/selling'); + const rows = await drafts(page); + expect(rows).toHaveLength(1); + expect(rows[0].form.description).toBe('Latest exact close description\n'); +}); +test('HCP116 genuine native abort keeps current form and route until explicit Save and close succeeds', async ({ + page +}) => { + await newRoute(page); + await page.evaluate(() => { + window.hcp116Abort = window.hcp116.abortDraftWrites(); + }); + await page.getByLabel('Product name', { exact: true }).fill(form.title); + await expect( + page.getByText('Not saved. Keep your current input here.', { exact: true }) + ).toBeVisible(); + await page + .getByRole('button', { name: 'Save and close', exact: true }) + .click(); + await expect( + page.getByText('Not saved. Keep your current input here.', { exact: true }) + ).toBeVisible(); + await expect(page).toHaveURL(server.url + '/sell'); + await expect(page.getByLabel('Product name', { exact: true })).toHaveValue( + form.title + ); + expect(await drafts(page)).toHaveLength(0); + const attempted = await page.evaluate(() => window.hcp116Abort.state()); + expect(attempted.aborts).toBeGreaterThan(0); + expect(new Set(attempted.ids).size).toBe(1); + await page.evaluate(() => window.hcp116Abort.restore()); + await page + .getByRole('button', { name: 'Save and close', exact: true }) + .click(); + await expect(page).toHaveURL(server.url + '/selling'); + const rows = await drafts(page); + expect(rows).toHaveLength(1); + expect(rows[0].id).toBe(attempted.ids[0]); + expect(rows[0].form.title).toBe(form.title); +}); +test('HCP116 actual lost put and readback acknowledgments preserve original attempt then reconcile before latest save-close', async ({ + page +}) => { + await newRoute(page); + await page.evaluate(() => { + window.hcp116Unknown = window.hcp116.unknownDraftAcknowledgment(); + }); + await page + .getByLabel('Product name', { exact: true }) + .fill('Original uncertain input'); + await expect( + page.getByText('Not saved. Keep your current input here.', { exact: true }) + ).toBeVisible(); + await expect(page).toHaveURL(server.url + '/sell'); + const before = await drafts(page); + expect(before).toHaveLength(1); + await page + .getByLabel('Product name', { exact: true }) + .fill('Latest input after unknown receipt'); + await expect(page.getByLabel('Product name', { exact: true })).toHaveValue( + 'Latest input after unknown receipt' + ); + const actual = await page.evaluate(() => window.hcp116Unknown.state()); + expect(actual.puts).toBe(1); + expect(actual.held).toBeGreaterThanOrEqual(2); + await page.evaluate(() => window.hcp116Unknown.release()); + await page + .getByRole('button', { name: 'Save and close', exact: true }) + .click(); + await expect(page).toHaveURL(server.url + '/selling'); + const after = await drafts(page); + expect(after).toHaveLength(1); + expect(after[0].id).toBe(before[0].id); + expect(after[0].form.title).toBe('Latest input after unknown receipt'); +}); +test('HCP116 copied save-close cannot close original saved controller or create another draft', async ({ + page +}) => { + const actual = await page.evaluate(async (form) => { + const f = window.hcp116Fixture; + await f.open({ mode: 'new' }); + if (!(await f.edit(form))) throw Error('actual draft failed'); + const before = await f.inspect(), + copied = await f.saveClose(true), + originalAlive = !!f.snapshot(), + original = await f.saveClose(); + return { + before, + copied, + originalAlive, + original, + snapshot: f.snapshot(), + after: await f.inspect() + }; + }, form); + expect(actual).toMatchObject({ + copied: false, + originalAlive: true, + original: true + }); + expect(actual.snapshot).toBeUndefined(); + expect(actual.after).toEqual(actual.before); +}); +test('HCP116 disconnected original editor cannot save-close through stale original ownership', async ({ + page +}) => { + const actual = await page.evaluate(async (form) => { + const f = window.hcp116Fixture; + await f.open({ mode: 'new' }); + await f.edit(form); + const before = await f.inspect(); + f.disconnect(); + return { + closed: await f.saveClose(), + before, + after: await f.inspect(), + snapshot: f.snapshot() + }; + }, form); + expect(actual.closed).toBe(false); + expect(actual.snapshot).toBeUndefined(); + expect(actual.after).toEqual(actual.before); +}); +test('HCP116 logout while original save-close waits prevents late Selling navigation and leaves genuine local fact', async ({ + page +}) => { + await newRoute(page); + await page.evaluate(() => { + window.hcp116Observation = window.hcp116.nativeObservation(); + window.hcp116Observation.holdSave(); + }); + await page.getByLabel('Product name', { exact: true }).fill(form.title); + await expect + .poll( + async () => + await page.evaluate(() => window.hcp116Observation.state().held) + ) + .toBe(true); + await page + .getByRole('button', { name: 'Save and close', exact: true }) + .click(); + await page.getByText('Identity', { exact: true }).click(); + await page + .getByRole('button', { name: 'Disconnect', exact: true }) + .first() + .click(); + await page.evaluate(() => window.hcp116Observation.release()); + await expect(page.locator('main form')).toHaveCount(0); + await expect(page).toHaveURL(server.url + '/sell'); + expect(await drafts(page)).toHaveLength(1); +}); +test('HCP116 missing draft stays unavailable with safe Selling link and no empty substitute', async ({ + page +}) => { + await navigate(page, '/selling/drafts/' + crypto.randomUUID()); + await page + .getByRole('button', { name: 'Connect extension', exact: true }) + .last() + .click(); + await expect( + page.getByText('This draft is not available here.', { exact: true }) + ).toBeVisible(); + await expect( + page.getByRole('link', { name: 'Back to Selling', exact: true }) + ).toHaveAttribute('href', '/selling'); + await expect(page.locator('main form')).toHaveCount(0); + await expect( + page.getByRole('button', { name: 'Save and close', exact: true }) + ).toHaveCount(0); + expect(await drafts(page)).toHaveLength(0); +}); +test('HCP116 leaving route during original save-close prevents late Selling navigation', async ({ + page +}) => { + await newRoute(page); + await page.evaluate(() => { + window.hcp116Observation = window.hcp116.nativeObservation(); + window.hcp116Observation.holdSave(); + }); + await page.getByLabel('Product name', { exact: true }).fill(form.title); + await expect + .poll( + async () => + await page.evaluate(() => window.hcp116Observation.state().held) + ) + .toBe(true); + await page + .getByRole('button', { name: 'Save and close', exact: true }) + .click(); + await navigate(page, '/search'); + await page.evaluate(() => window.hcp116Observation.release()); + await expect(page).toHaveURL(server.url + '/search'); + await expect(page.locator('#listing-title')).toHaveCount(0); + expect(await drafts(page)).toHaveLength(1); +}); +test('HCP116 overlapping original save-close calls acknowledge latest input only once', async ({ + page +}) => { + await page.evaluate(async (form) => { + const f = window.hcp116Fixture; + await f.open({ mode: 'new' }); + window.hcp116Observation = window.hcp116.nativeObservation(); + window.hcp116Observation.holdSave(); + void f.edit(form); + }, form); + await expect + .poll( + async () => + await page.evaluate(() => window.hcp116Observation.state().held) + ) + .toBe(true); + const actual = await page.evaluate(async (form) => { + const f = window.hcp116Fixture, + first = f.saveClose(), + second = f.saveClose(); + void f.edit({ ...form, title: 'Latest overlapping input' }); + window.hcp116Observation.release(); + return { + results: await Promise.all([first, second]), + rows: await f.inspect(), + snapshot: f.snapshot() + }; + }, form); + expect(actual.results.filter(Boolean)).toHaveLength(1); + expect(actual.snapshot).toBeUndefined(); + expect(actual.rows.drafts).toHaveLength(1); + expect( + ( + JSON.parse( + (actual.rows.drafts[0] as { wire: string }).wire + ) as PublicDraftRecord + ).form.title + ).toBe('Latest overlapping input'); +}); +for (const unknown of [false, true]) + test(`HCP116 genuine ${unknown ? 'unknown signing' : 'signed retained'} operation state prevents an apparently fresh draft submission`, async ({ + page + }) => { + const original = await page.evaluate( + async (unknown) => await window.hcp116Fixture.captured(unknown), + unknown + ); + const before = await page.evaluate( + async () => await window.hcp116Fixture.inspect() + ); + await navigate(page, '/selling/drafts/' + original.draftId); + await page + .getByRole('button', { name: 'Connect extension', exact: true }) + .last() + .click(); + await expect(page.locator('main form')).toBeVisible(); + await expect( + page.getByLabel('Product name', { exact: true }) + ).toHaveAttribute('readonly', ''); + await expect( + page.getByText( + unknown + ? 'The outcome is unknown. Keep the original listing operation for reconciliation.' + : 'Signed listing saved in this browser. No relay acceptance is recorded.', + { exact: true } + ) + ).toBeVisible(); + await expect( + page.getByRole('button', { name: 'Save and close', exact: true }) + ).toHaveCount(0); + await expect( + page.getByRole('button', { name: 'Review listing', exact: true }) + ).toHaveCount(0); + expect( + await page.evaluate(async () => await window.hcp116Fixture.inspect()) + ).toEqual(before); + }); + +test('HCP116 foreign genuine draft exposes only unavailable state and safe Selling link, never resets data', async ({ + page +}) => { + const original = await page.evaluate(async () => { + const captured = await window.hcp116Fixture.captured(); + const rows = await window.hcp116Fixture.inspect(); + await window.hcp116Fixture.close(); + window.hcp116Fixture = await window.hcp116.createFixture(); + return { captured, rows }; + }); + await navigate(page, '/selling/drafts/' + original.captured.draftId); + await page + .getByRole('button', { name: 'Connect extension', exact: true }) + .last() + .click(); + await expect( + page.getByText('This draft is not available here.', { exact: true }) + ).toBeVisible(); + await expect( + page.getByRole('link', { name: 'Back to Selling', exact: true }) + ).toHaveAttribute('href', '/selling'); + await expect(page.locator('main form')).toHaveCount(0); + expect( + await page.evaluate(async () => await window.hcp116Fixture.inspect()) + ).toEqual(original.rows); +}); diff --git a/web/tests/provenance/output.test.mjs b/web/tests/provenance/output.test.mjs @@ -234,6 +234,79 @@ import { auditOutput } from '../../tools/check-output.mjs'; } ); await test( + 'HCP115 exact shared-editor predecessor remains independently compilable', + { timeout: 1800000 }, + async (t) => { + const f = await fixture(t); + const historical = { + 'src/routes/sell/+page.svelte': { + source: + "<script lang=\"ts\">\n import ListingEditor from '../../lib/components/ListingEditor.svelte';\n</script>\n\n<ListingEditor route={{ mode: 'new' }} />\n", + sha256: + '3e99a6121e9ea317d30e631d9edfb05e6596301678f9ae0538e446f0438ae3f4' + }, + 'src/routes/selling/drafts/[draftId=local_id]/+page.svelte': { + source: + "<script lang=\"ts\">\n import { page } from '$app/state';\n import ListingEditor from '../../../../lib/components/ListingEditor.svelte';\n import type { ListingEditorRoute } from '../../../../lib/publishing/listing-editor.ts';\n const route = $derived({\n mode: 'draft',\n draftId: page.params.draftId ?? ''\n } satisfies ListingEditorRoute);\n</script>\n\n<ListingEditor {route} />\n", + sha256: + '98935ebb01f950aee5da850758801c28303b042ba219759c4fb04c4974376a76' + }, + 'src/routes/products/[naddr=naddr]/edit/+page.svelte': { + source: + "<script lang=\"ts\">\n import { page } from '$app/state';\n import ListingEditor from '../../../../lib/components/ListingEditor.svelte';\n import type { ListingEditorRoute } from '../../../../lib/publishing/listing-editor.ts';\n const route = $derived({\n mode: 'edit',\n naddr: page.params.naddr ?? ''\n } satisfies ListingEditorRoute);\n</script>\n\n<ListingEditor {route} />\n", + sha256: + '5c50dc2ba4c5734ffe4bd1c2e406e6699581b374fab3849d5c5a0072d9bad1e6' + }, + 'src/lib/components/ListingEditor.svelte': { + source: + '<script lang="ts">\n import { getContext, onMount } from \'svelte\';\n import CapabilityGate from \'./CapabilityGate.svelte\';\n import Notice from \'./Notice.svelte\';\n import { foodUnits } from \'../contracts/food-availability-v1/values.ts\';\n import type { PublicDraftForm } from \'../contracts/local-records.ts\';\n import {\n IDENTITY_VIEW_CONTEXT,\n identityViewSnapshot,\n subscribeIdentityView,\n connectIdentityView,\n disconnectIdentityView,\n type IdentityViewContext\n } from \'../runtime/view-context.ts\';\n import {\n openListingEditor,\n listingEditorSnapshot,\n editListingEditor,\n closeListingEditor,\n subscribeListingEditor,\n type ListingEditor as Editor,\n type ListingEditorRoute,\n type ListingEditorSnapshot\n } from \'../publishing/listing-editor.ts\';\n import { internalHref } from \'../navigation-url.ts\';\n let { route }: { route: ListingEditorRoute } = $props();\n const context = getContext<IdentityViewContext>(IDENTITY_VIEW_CONTEXT);\n let identity = $state(identityViewSnapshot(context)),\n mounted = $state(false),\n editor = $state.raw<Editor | undefined>(),\n snapshot = $state<ListingEditorSnapshot>(),\n unavailable = $state(false);\n type Form = {\n -readonly [Key in keyof PublicDraftForm]: PublicDraftForm[Key];\n };\n const blankForm = (): Form => ({\n title: \'\',\n description: \'\',\n location: \'\',\n amount: \'\',\n currency: \'\',\n unit: \'\',\n quantity: \'\',\n contactType: \'\',\n contactValue: \'\'\n });\n let form = $state<Form>(blankForm());\n const admittedAuthor = $derived(\n identity.identity.state !== \'guest\' && identity.identity.state !== \'pending\'\n ? identity.identity.publicKey\n : undefined\n );\n const active = $derived(mounted && identity.mounted);\n const visible = $derived(\n snapshot &&\n editor &&\n identity.mounted &&\n identity.identity.state !== \'guest\' &&\n identity.identity.state !== \'pending\' &&\n identity.identity.publicKey === snapshot.owner &&\n listingEditorSnapshot(editor)\n );\n onMount(() => {\n mounted = true;\n const off = subscribeIdentityView(context, (next) => {\n identity = next;\n });\n return () => {\n mounted = false;\n off();\n };\n });\n $effect(() => {\n const resource = route,\n author = admittedAuthor;\n if (!active || !author) {\n editor = undefined;\n snapshot = undefined;\n form = blankForm();\n unavailable = false;\n return;\n }\n const cancellation = new AbortController();\n let alive = true,\n owned: Editor | undefined,\n off = () => {};\n editor = undefined;\n snapshot = undefined;\n form = blankForm();\n unavailable = false;\n void openListingEditor(context, resource, cancellation.signal).then(\n (result) => {\n if (!alive) {\n if (result.status === \'ready\') closeListingEditor(result.editor);\n return;\n }\n if (result.status !== \'ready\') {\n unavailable = true;\n return;\n }\n owned = result.editor;\n editor = owned;\n const next = listingEditorSnapshot(owned);\n if (!next) {\n unavailable = true;\n return;\n }\n snapshot = next;\n form = { ...next.form };\n off = subscribeListingEditor(owned, () => {\n snapshot = owned && listingEditorSnapshot(owned);\n if (!snapshot) {\n unavailable = true;\n form = blankForm();\n }\n });\n }\n );\n return () => {\n alive = false;\n cancellation.abort();\n off();\n if (owned) closeListingEditor(owned);\n form = blankForm();\n };\n });\n function changed() {\n const original = editor;\n if (!original || !listingEditorSnapshot(original)?.editable) return;\n void editListingEditor(original, { ...form });\n }\n function connect() {\n return connectIdentityView(context);\n }\n function disconnect() {\n disconnectIdentityView(context);\n }\n const title = $derived(\n route.mode === \'new\'\n ? \'New listing\'\n : route.mode === \'draft\'\n ? \'Continue draft\'\n : \'Edit listing\'\n );\n</script>\n\n<svelte:head\n ><title>{title} \u00b7 HarvestCircle</title><meta\n name="robots"\n content="noindex"\n /></svelte:head\n>\n<div class="page page--reading stack">\n <a\n href={internalHref(\n route.mode === \'edit\' ? `/products/${route.naddr}` : \'/selling\'\n )}>{route.mode === \'edit\' ? \'Back to listing\' : \'Back to Selling\'}</a\n >\n <h1>{title}</h1>\n {#if !visible}\n <CapabilityGate\n identity={identity.identity}\n required="connection"\n focusTarget="protected"\n onconnect={mounted ? connect : undefined}\n ondisconnect={disconnect}\n />\n {#if unavailable}<Notice\n tone="warning"\n text={route.mode === \'draft\'\n ? \'This draft is not available here.\'\n : route.mode === \'edit\'\n ? \'Supported local listing values are not available for editing. Keep this listing read-only.\'\n : \'Browser storage is unavailable. Your existing local data has not been reset.\'}\n />{:else if identity.identity.state !== \'guest\' && identity.identity.state !== \'pending\'}<p\n role="status"\n >\n Loading local values.\n </p>{/if}\n {:else}\n {#if !visible.editable}<Notice\n tone="info"\n text="These retained local values are read-only until the current listing is checked."\n />{:else}<p>\n Changes are saved in this browser. Browser storage is not a backup.\n </p>{/if}\n <form class="stack" onsubmit={(event) => event.preventDefault()} novalidate>\n <div class="field">\n <label class="label" for="listing-title">Product name</label><input\n id="listing-title"\n type="text"\n value={form.title}\n oninput={(event) => {\n form = { ...form, title: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}\n />\n </div>\n <div class="field">\n <label class="label" for="listing-description">Description</label\n ><textarea\n id="listing-description"\n rows="6"\n value={form.description}\n oninput={(event) => {\n form = { ...form, description: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}></textarea>\n </div>\n <div class="field">\n <label class="label" for="listing-location">Public area</label>\n <p id="listing-location-hint" class="text-small">\n A town or collection area is enough.\n </p>\n <input\n id="listing-location"\n type="text"\n aria-describedby="listing-location-hint"\n value={form.location}\n oninput={(event) => {\n form = { ...form, location: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}\n />\n </div>\n <div class="cluster">\n <div class="field">\n <label class="label" for="listing-amount">Price</label><input\n id="listing-amount"\n type="text"\n inputmode="decimal"\n value={form.amount}\n oninput={(event) => {\n form = { ...form, amount: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}\n />\n </div>\n <div class="field">\n <label class="label" for="listing-currency">Currency</label><input\n id="listing-currency"\n type="text"\n maxlength="3"\n value={form.currency}\n oninput={(event) => {\n form = { ...form, currency: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}\n />\n </div>\n <div class="field">\n <label class="label" for="listing-unit">Per</label><select\n id="listing-unit"\n value={form.unit}\n onchange={(event) => {\n form = { ...form, unit: event.currentTarget.value };\n changed();\n }}\n disabled={!visible.editable}\n ><option value="">Choose a unit</option\n >{#each foodUnits as unit (unit)}<option value={unit}>{unit}</option\n >{/each}</select\n >\n </div>\n </div>\n <div class="field">\n <label class="label" for="listing-quantity"\n >Advertised quantity (optional)</label\n >\n <p id="listing-quantity-unit">\n {form.unit || \'Uses the selected price unit\'}\n </p>\n <input\n id="listing-quantity"\n type="text"\n inputmode="decimal"\n aria-describedby="listing-quantity-unit"\n value={form.quantity}\n oninput={(event) => {\n form = { ...form, quantity: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}\n />\n </div>\n <details>\n <summary>Add public contact details (optional)</summary>\n <div class="stack">\n <p>Only add contact details you want to include publicly.</p>\n <div class="field">\n <label class="label" for="listing-contact-type"\n >Public contact type</label\n ><select\n id="listing-contact-type"\n value={form.contactType}\n onchange={(event) => {\n const value = event.currentTarget.value;\n if (\n value === \'\' ||\n value === \'email\' ||\n value === \'phone\' ||\n value === \'https\'\n ) {\n form = { ...form, contactType: value };\n changed();\n }\n }}\n disabled={!visible.editable}\n ><option value="">No public contact</option><option value="email"\n >Email</option\n ><option value="phone">Phone</option><option value="https"\n >Website</option\n ></select\n >\n </div>\n <div class="field">\n <label class="label" for="listing-contact-value"\n >Public contact details</label\n ><input\n id="listing-contact-value"\n type="text"\n value={form.contactValue}\n oninput={(event) => {\n form = { ...form, contactValue: event.currentTarget.value };\n changed();\n }}\n readonly={!visible.editable}\n />\n </div>\n </div>\n </details>\n </form>\n {#if visible.editable}<p role="status">\n {visible.state === \'saved\'\n ? \'Saved in this browser.\'\n : visible.state === \'saving\'\n ? \'Saving in this browser.\'\n : visible.state === \'failed\'\n ? \'Not saved. Keep your current input here.\'\n : \'Not yet saved.\'}\n </p>\n {#if visible.failure}<Notice\n tone="warning"\n text="Saving did not complete. Keep your current input. Existing local data has not been reset."\n />{/if}{/if}\n {/if}\n</div>\n', + sha256: + 'fed47cd7257ab3fe1878ef5779b74a4a3e01404d93956806477943190ffb2b18' + }, + 'src/lib/publishing/listing-editor.ts': { + source: + "import {\n exactLocalFields,\n type PublicDraftForm\n} from '../contracts/local-records.ts';\nimport { canonicalLocalId } from '../private-handles.ts';\nimport { decodeProductReference } from '../nostr/references.ts';\nimport { inspectLocalTemplate } from '../nostr/local-template.ts';\nimport { projectFoodParts } from '../contracts/food-availability-v1/read.ts';\nimport { buildFoodTemplate } from '../contracts/food-availability-v1/write.ts';\nimport {\n openBrowserDatabase,\n closeBrowserDatabase,\n type BrowserDatabase\n} from '../persistence/database.ts';\nimport {\n createPublicPublicationRepository,\n publicPublicationDraftRepository,\n publicPublicationQuotaRepository,\n readPublicListingIntent\n} from '../persistence/public-publications.ts';\nimport {\n inspectPublicStorage,\n publicInventorySnapshot\n} from '../persistence/quota.ts';\nimport { publicRecordSnapshot } from '../persistence/records.ts';\nimport {\n readPublicDraft,\n publicDraftRepositoryOwner,\n type PublicDraftRepository\n} from '../persistence/drafts.ts';\nimport {\n createPublicDraftController,\n publicDraftControllerSnapshot,\n editPublicDraft,\n flushPublicDraft,\n closePublicDraftController,\n type PublicDraftController\n} from './draft-controller.ts';\nimport {\n identityViewSession,\n identityViewMatchesOwner,\n type IdentityViewContext\n} from '../runtime/view-context.ts';\nimport {\n identitySessionSnapshot,\n subscribeIdentityInvalidation\n} from '../runtime/identity-session.ts';\n\ndeclare const editorBrand: unique symbol;\nexport type ListingEditor = Readonly<{ [editorBrand]: true }>;\nexport type ListingEditorRoute =\n | Readonly<{ mode: 'new' }>\n | Readonly<{ mode: 'draft'; draftId: string }>\n | Readonly<{ mode: 'edit'; naddr: string }>;\nexport type ListingEditorSnapshot = Readonly<{\n mode: ListingEditorRoute['mode'];\n owner: string;\n form: PublicDraftForm;\n editable: boolean;\n draftId: string | null;\n state: 'editing' | 'saving' | 'saved' | 'failed' | 'read-only';\n failure: string | null;\n coordinate: string | null;\n sourceEventId: string | null;\n}>;\ntype Editor = Readonly<{\n current(): boolean;\n retire(): void;\n snapshot(): ListingEditorSnapshot | undefined;\n edit(form: unknown): Promise<boolean>;\n flush(): Promise<boolean>;\n subscribe(listener: () => void): () => void;\n}>;\nconst editors = new WeakMap<ListingEditor, Editor>();\nconst active = new WeakMap<\n IdentityViewContext,\n Readonly<{ stamp: symbol; retire(): void }>\n>();\nconst emptyForm: PublicDraftForm = {\n title: '',\n description: '',\n location: '',\n amount: '',\n currency: '',\n unit: '',\n quantity: '',\n contactType: '',\n contactValue: ''\n};\nfunction routeSnapshot(value: unknown): ListingEditorRoute | undefined {\n try {\n if (exactLocalFields(value, ['mode']) && value.mode === 'new')\n return { mode: 'new' };\n if (\n exactLocalFields(value, ['mode', 'draftId']) &&\n value.mode === 'draft'\n ) {\n const draftId = canonicalLocalId(value.draftId);\n return draftId ? { mode: 'draft', draftId } : undefined;\n }\n if (exactLocalFields(value, ['mode', 'naddr']) && value.mode === 'edit') {\n const reference = decodeProductReference(value.naddr);\n return reference ? { mode: 'edit', naddr: reference.naddr } : undefined;\n }\n } catch {\n return;\n }\n}\n// Owner admission precedes database opening and all protected hydration. Edit\n// mode presents validated local values; independent head authorization is later.\nexport async function openListingEditor(\n context: IdentityViewContext,\n input: unknown,\n signal?: AbortSignal\n): Promise<\n | Readonly<{ status: 'ready'; editor: ListingEditor }>\n | Readonly<{\n status: 'unavailable';\n reason: 'owner' | 'resource' | 'storage' | 'source';\n }>\n> {\n const session = identityViewSession(context),\n route = routeSnapshot(input);\n if (!session || signal?.aborted)\n return { status: 'unavailable', reason: 'owner' };\n const identity = identitySessionSnapshot(session),\n owner = 'publicKey' in identity ? identity.publicKey : undefined;\n if (!owner || !identityViewMatchesOwner(context, owner))\n return { status: 'unavailable', reason: 'owner' };\n if (\n !route ||\n (route.mode === 'edit' &&\n decodeProductReference(route.naddr)?.pubkey !== owner)\n )\n return { status: 'unavailable', reason: 'resource' };\n if (typeof window === 'undefined' || !navigator.locks?.request)\n return { status: 'unavailable', reason: 'storage' };\n active.get(context)?.retire();\n const stamp = Symbol(),\n listeners = new Map<symbol, () => void>(),\n cancellation = new AbortController();\n let alive = true,\n unsubscribe = () => {},\n database: BrowserDatabase | undefined,\n repository: PublicDraftRepository | undefined,\n controller: PublicDraftController | undefined;\n function current() {\n return (\n alive &&\n active.get(context)?.stamp === stamp &&\n identityViewSession(context) === session &&\n identityViewMatchesOwner(context, owner) &&\n (!repository || publicDraftRepositoryOwner(repository) === owner)\n );\n }\n let notifying = false;\n function notify() {\n if (notifying) return;\n notifying = true;\n try {\n for (const [key, listener] of Array.from(listeners.entries()))\n if (listeners.get(key) === listener) {\n try {\n listener();\n } catch {\n /*Presentation observers cannot authorize or retain ownership.*/\n }\n }\n } finally {\n notifying = false;\n }\n }\n function retire() {\n if (!alive) return;\n alive = false;\n unsubscribe();\n signal?.removeEventListener('abort', retire);\n cancellation.abort();\n if (controller) closePublicDraftController(controller);\n if (database) closeBrowserDatabase(database);\n if (active.get(context)?.stamp === stamp) active.delete(context);\n notify();\n listeners.clear();\n }\n active.set(context, { stamp, retire });\n unsubscribe = subscribeIdentityInvalidation(session, retire);\n signal?.addEventListener('abort', retire, { once: true });\n if (signal?.aborted) retire();\n function unavailable(reason: 'resource' | 'storage' | 'source') {\n retire();\n return { status: 'unavailable' as const, reason };\n }\n try {\n const opened = await openBrowserDatabase(cancellation.signal);\n if (opened.state !== 'ready') return unavailable('storage');\n if (!current()) {\n closeBrowserDatabase(opened.owner);\n return unavailable('storage');\n }\n database = opened.owner;\n const publications = createPublicPublicationRepository(database, owner);\n repository = publications && publicPublicationDraftRepository(publications);\n if (!publications || !repository || !current())\n return unavailable('storage');\n const drafts = repository;\n let sourceForm: PublicDraftForm | undefined,\n coordinate: string | null = null,\n sourceEventId: string | null = null;\n if (route.mode === 'edit') {\n const reference = decodeProductReference(route.naddr),\n quota = publicPublicationQuotaRepository(publications);\n if (!reference || !quota) return unavailable('source');\n const inspected = await inspectPublicStorage(quota);\n if (!current() || !inspected.ok) return unavailable('source');\n const inventory = publicInventorySnapshot(quota, inspected.value);\n if (!inventory) return unavailable('source');\n let matching:\n Readonly<{ form: PublicDraftForm; eventId: string }> | undefined;\n for (const item of inventory.rows) {\n if (item.family !== 'public_operation') continue;\n const read = await readPublicListingIntent(publications, item.id);\n if (!current()) return unavailable('source');\n const row =\n read.status === 'found' &&\n publicRecordSnapshot(read.record, owner, item.id);\n if (\n !row ||\n row.family !== 'public_operation' ||\n row.capture.kind !== 30402 ||\n !row.artifact ||\n row.source.type !== 'draft'\n )\n continue;\n const template = inspectLocalTemplate(row.capture.wire, owner, 30402);\n if (!template) continue;\n const projected = projectFoodParts(template);\n if (\n projected.outcome !== 'focused' ||\n projected.projection.identifier !== reference.identifier\n )\n continue;\n const source = await readPublicDraft(drafts, row.source.id);\n if (!current()) return unavailable('source');\n if (!source.ok || source.value.revision !== row.source.revision)\n continue;\n const value = source.value.form,\n p = projected.projection;\n if (value.contactType === '' && value.contactValue !== '') continue;\n const built = buildFoodTemplate({\n identifier: p.identifier,\n title: value.title,\n description: value.description,\n location: value.location,\n amount: value.amount,\n currency: value.currency,\n unit: value.unit,\n ...(value.quantity === '' ? {} : { quantity: value.quantity }),\n published_at: p.published_at,\n created_at: template.created_at,\n status: p.status,\n ...(value.contactType === ''\n ? {}\n : {\n contact: {\n type: value.contactType,\n value: value.contactValue,\n public: true as const\n }\n })\n });\n if (\n !built.ok ||\n JSON.stringify({\n pubkey: owner,\n kind: 30402,\n created_at: template.created_at,\n tags: built.wire_parts.tags,\n content: built.wire_parts.content\n }) !== row.capture.wire\n )\n continue;\n if (matching) return unavailable('source');\n matching = { form: value, eventId: row.artifact.eventId };\n }\n if (!matching) return unavailable('source');\n sourceForm = matching.form;\n coordinate = route.naddr;\n sourceEventId = matching.eventId;\n } else {\n const acquired = await createPublicDraftController(\n drafts,\n emptyForm,\n route.mode === 'draft' ? route.draftId : undefined\n );\n if (!current()) {\n if (acquired) closePublicDraftController(acquired);\n return unavailable('resource');\n }\n controller = acquired;\n if (!controller) return unavailable('resource');\n }\n if (!current()) return unavailable('source');\n const value: Editor = {\n current,\n retire,\n snapshot() {\n if (!current()) {\n retire();\n return;\n }\n const local = controller && publicDraftControllerSnapshot(controller);\n return {\n mode: route.mode,\n owner,\n form: local ? local.form : { ...(sourceForm ?? emptyForm) },\n editable: route.mode !== 'edit',\n draftId: local?.draft?.id ?? null,\n state: local\n ? local.state === 'closed'\n ? 'failed'\n : local.state\n : 'read-only',\n failure: local?.failure ?? null,\n coordinate,\n sourceEventId\n };\n },\n async edit(input) {\n if (!current()) {\n retire();\n return false;\n }\n if (!controller || route.mode === 'edit') return false;\n if (!editPublicDraft(controller, input)) return false;\n notify();\n const pending = flushPublicDraft(controller);\n await Promise.resolve();\n if (!current()) {\n retire();\n return false;\n }\n notify();\n const saved = await pending;\n if (!current()) {\n retire();\n return false;\n }\n notify();\n return saved;\n },\n async flush() {\n if (!current()) {\n retire();\n return false;\n }\n if (!controller || route.mode === 'edit') return false;\n const pending = flushPublicDraft(controller);\n await Promise.resolve();\n if (!current()) {\n retire();\n return false;\n }\n notify();\n const saved = await pending;\n if (!current()) {\n retire();\n return false;\n }\n notify();\n return saved;\n },\n subscribe(listener) {\n if (!current()) return () => {};\n const key = Symbol();\n listeners.set(key, listener);\n return () => {\n listeners.delete(key);\n };\n }\n };\n const editor = Object.freeze({}) as ListingEditor;\n editors.set(editor, value);\n return { status: 'ready', editor };\n } catch {\n return unavailable('storage');\n }\n}\nexport function listingEditorSnapshot(\n editor: ListingEditor\n): ListingEditorSnapshot | undefined {\n return editors.get(editor)?.snapshot();\n}\nexport function editListingEditor(\n editor: ListingEditor,\n form: unknown\n): Promise<boolean> {\n return editors.get(editor)?.edit(form) ?? Promise.resolve(false);\n}\nexport function flushListingEditor(editor: ListingEditor): Promise<boolean> {\n return editors.get(editor)?.flush() ?? Promise.resolve(false);\n}\nexport function closeListingEditor(editor: ListingEditor): void {\n editors.get(editor)?.retire();\n}\nexport function subscribeListingEditor(\n editor: ListingEditor,\n listener: () => void\n): () => void {\n return editors.get(editor)?.subscribe(listener) ?? (() => {});\n}\n", + sha256: + 'f2f1be3c614c861f50293f33f5bf1d3ae1851f4b4452fb9e2f3a7b8963a1d1f9' + } + }; + for (const [name, value] of Object.entries(historical)) { + assert.equal( + createHash('sha256').update(value.source).digest('hex'), + value.sha256 + ); + await writeFile(path.join(f.web, name), value.source); + } + await copyDependencies(t, base, f.web); + await refresh(f); + compile(t, f.web); + const manifest = JSON.parse( + await readFile( + path.join(f.web, '.svelte-kit/output/client/.vite/manifest.json'), + 'utf8' + ) + ); + assert.equal(Object.keys(manifest).length, 43); + assert.ok( + Object.values(manifest).some((row) => row.name === 'view-context') + ); + assert.ok((await f.audit()).length > 0); + const handles = Object.values(manifest).find( + (row) => row.name === 'private-handles' + ); + assert.ok( + handles, + 'Historical HCP115 keeps its exact private-handles compiler role' + ); + handles.imports = ['forged-compiler-edge']; + await writeFile( + path.join(f.web, '.svelte-kit/output/client/.vite/manifest.json'), + JSON.stringify(manifest) + ); + await assert.rejects(f.audit, /compiler/); + } + ); + await test( 'public-only owned lifecycle remains independently compilable', { timeout: 1800000 }, async (t) => { @@ -381,7 +454,7 @@ import { auditOutput } from '../../tools/check-output.mjs'; const f = await fixture(t); const files = await f.audit(); // Exact eleven-route module/page/static admission; CSS stays once-imported. - assert.equal(files.length, 55); + assert.equal(files.length, 54); // The actual SDK payload crosses the reader scratch boundary; a reused // scratch buffer must still preserve every compiler/static byte exactly. const sizes = await Promise.all( @@ -502,7 +575,7 @@ import { auditOutput } from '../../tools/check-output.mjs'; 'thread-dynamic', 'thread-entry-role', 'reply-missing-navigation', - 'reply-missing-handles', + 'reply-missing-owner-key', 'context-resolver-dynamic', 'context-resolver-entry', 'enquiry-view-dynamic', @@ -590,11 +663,19 @@ import { auditOutput } from '../../tools/check-output.mjs'; (/** @type {string} */ value) => manifest[value].name !== 'navigation' ); - if (mutation === 'reply-missing-handles') + if (mutation === 'reply-missing-owner-key') { + const key = Object.keys(manifest).find( + (key) => manifest[key].name === 'public-key' + ); + assert.ok( + key && row.imports.includes(key), + 'Mutate an actual current owner-key compiler edge' + ); row.imports = row.imports.filter( (/** @type {string} */ value) => - manifest[value].name !== 'private-handles' + manifest[value].name !== 'public-key' ); + } await writeFile(file, JSON.stringify(manifest)); await assert.rejects(f.audit, /compiler|duplicate|inventory/); } @@ -619,7 +700,7 @@ import { auditOutput } from '../../tools/check-output.mjs'; } ); for (const name of [ - 'private-handles', + 'public-key', 'public-runtime', 'AccountGate', 'Disclosure' @@ -657,7 +738,7 @@ import { auditOutput } from '../../tools/check-output.mjs'; assert.ok(Buffer.byteLength(expanded) > 64 * 1024); await writeFile(file, expanded); await refresh(f); - assert.equal((await f.audit()).length, 55); + assert.equal((await f.audit()).length, 54); } ); @@ -1157,7 +1238,7 @@ import { auditOutput } from '../../tools/check-output.mjs'; ); for (const name of [ 'ListingEditor', - 'view-context', + 'public-runtime', 'nodes/8', 'nodes/10', 'nodes/12' @@ -1586,7 +1667,7 @@ import { auditOutput } from '../../tools/check-output.mjs'; await writeFile(file, JSON.stringify(manifest)); await assert.rejects( f.audit, - /Undeclared compiler module|Unresolved compiler import|Invalid owned budgets compiler|Static output inventory mismatch|Static output differs from owned compiler input/ + /Undeclared compiler module|Unresolved compiler import|Invalid owned budgets compiler|Invalid owned listing editor compiler graph|Static output inventory mismatch|Static output differs from owned compiler input/ ); }); } diff --git a/web/tests/unit/listing-continuity.test.ts b/web/tests/unit/listing-continuity.test.ts @@ -0,0 +1,34 @@ +import { expect, it } from 'vitest'; +import { render } from 'svelte/server'; +import ListingEditor from '../../src/lib/components/ListingEditor.svelte'; +import * as editor from '../../src/lib/publishing/listing-editor.ts'; +import { draftHref } from '../../src/lib/routes.ts'; +import type { ListingEditorRoute } from '../../src/lib/publishing/listing-editor.ts'; + +it('HCP116 SSR never offers save-close before genuine protected owner admission', () => { + for (const route of [ + { mode: 'new' }, + { mode: 'draft', draftId: '00000000-0000-4000-8000-000000000001' }, + { mode: 'edit', naddr: 'unsupported' } + ] as ListingEditorRoute[]) { + const html = render(ListingEditor, { props: { route } }).body; + expect(html).toContain('Connect to continue'); + expect(html).not.toMatch(/Save and close|<input|<textarea|<form/); + } +}); +it('HCP116 draft href admits only canonical durable native id, never arbitrary navigation', () => { + expect(draftHref('00000000-0000-4000-8000-000000000001')).toBe( + '/selling/drafts/00000000-0000-4000-8000-000000000001' + ); + for (const value of ['../selling', 'https://outside.invalid', '', {}, null]) + expect(draftHref(value)).toBeUndefined(); +}); +it('HCP116 copied presentation cannot gain original save-close custody', async () => { + const action: unknown = Reflect.get(editor, 'saveAndCloseListingEditor'); + expect(typeof action).toBe('function'); + if (typeof action !== 'function') return; + const close = action as (value: object) => Promise<boolean>; + expect(await close({ mode: 'draft', editable: true, saved: true })).toBe( + false + ); +}); diff --git a/web/tests/unit/route-inventory.test.ts b/web/tests/unit/route-inventory.test.ts @@ -27,6 +27,7 @@ const errorState = vi.hoisted(() => ({ })); vi.mock('$app/state', () => ({ page: errorState })); vi.mock('$app/navigation', () => ({ + beforeNavigate: vi.fn(), goto: () => { throw new Error('SSR must not navigate'); } diff --git a/web/tools/check-output.mjs b/web/tools/check-output.mjs @@ -609,12 +609,31 @@ async function listingEditorAdmission(web) { 'src/lib/publishing/listing-editor.ts': 'f2f1be3c614c861f50293f33f5bf1d3ae1851f4b4452fb9e2f3a7b8963a1d1f9' }; + /** @type {Record<string,string>} */ + const continuity = { + 'src/routes/sell/+page.svelte': + '97f22f9a0309621e9acb5f1b328d3376bc9c5affbe5a7ea1b85ece76097b9c08', + 'src/routes/selling/drafts/[draftId=local_id]/+page.svelte': + '1df59a753fbef2bc2ebf77890a79cbd3d7a5bb0dcef34c219df1b5e8043cf787', + 'src/routes/products/[naddr=naddr]/edit/+page.svelte': + '09c3a6bde766045319cd36a00a82ca565f9f3b5cd5322982be9482836f312998', + 'src/lib/components/ListingEditor.svelte': + 'df9cc0f98620459a4667ccaab0c7ccfda42764c229bec61df2e06a48bfd8eb9d', + 'src/lib/publishing/listing-editor.ts': + '9d7ea3f905188ab807b1779c2c0856e39a82cfe598bd071da33fabad66796012' + }; + let historical = true, + current = true; for (const [name, pin] of Object.entries(producers)) { const bytes = await readOwned(web, name); publicText(bytes); - if (createHash('sha256').update(bytes).digest('hex') !== pin) - throw new Error('Invalid owned listing editor source'); + const actual = createHash('sha256').update(bytes).digest('hex'); + historical = historical && actual === pin; + current = current && actual === continuity[name]; } + if (!historical && !current) + throw new Error('Invalid owned listing editor source'); + if (current) return 'continuity'; return true; } /** @param {string} web */ @@ -810,6 +829,7 @@ export async function auditOutput(webDirectory) { const hasListingEditor = hasFullRoutes && (await listingEditorAdmission(web)); if (hasListingEditor && !(hasListingPublication && hasInboxSetup)) throw new Error('Invalid owned listing editor runtime authority'); + const hasListingContinuity = hasListingEditor === 'continuity'; const identityCompilerModule = hasListingEditor ? 'view-context' : hasInboxSetup @@ -873,6 +893,54 @@ export async function auditOutput(webDirectory) { if (hasListingEditor) for (const name of ['ListingEditor', 'view-context', 'public-runtime']) names.add(name); + if (hasListingContinuity) { + names.clear(); + for (const name of [ + 'entry/app', + 'nodes/0', + 'nodes/1', + 'nodes/10', + 'nodes/11', + 'nodes/12', + 'nodes/2', + 'nodes/3', + 'nodes/4', + 'nodes/5', + 'nodes/6', + 'nodes/7', + 'nodes/8', + 'nodes/9', + 'error-template', + 'MessageComposer', + 'ListingEditor', + 'preload-helper', + 'Disclosure', + 'InboxStatus', + 'inbox-view', + 'public-key', + 'routes', + 'Button', + 'client', + 'InboxSetup', + 'legacy', + 'navigation', + 'shared-errors', + 'AccountGate', + 'read', + 'client.svelte', + 'publishers', + 'CapabilityGate', + 'public-runtime', + 'SearchForm', + 'state', + 'references', + 'client-entry', + 'entry/start', + 'entry/payload', + 'negentropy' + ]) + names.add(name); + } const admitted = new Map([['build-info.json', expectedMetadata]]); const seen = new Set(); for (const [key, record] of Object.entries(manifest)) { @@ -956,7 +1024,7 @@ export async function auditOutput(webDirectory) { } } equal([...seen].sort(), [...names].sort(), 'Incomplete compiler modules'); - if (hasPublicRuntime) { + if (hasPublicRuntime && !hasListingContinuity) { const records = Object.entries(manifest); /** @param {string} name */ function requiredRecord(name) { @@ -1236,7 +1304,7 @@ export async function auditOutput(webDirectory) { throw new Error('Invalid owned SDK compiler chunk'); } } - if (hasInboxPresentation) { + if (hasInboxPresentation && !hasListingContinuity) { const records = Object.entries(manifest); const entry = (/** @type {string} */ name) => { const row = records.find(([, r]) => r.name === name); @@ -1596,7 +1664,7 @@ export async function auditOutput(webDirectory) { } } } - if (hasProductPresentation) { + if (hasProductPresentation && !hasListingContinuity) { const records = Object.entries(manifest); const entry = (/** @type {string} */ name) => { const row = records.find(([, r]) => r.name === name); @@ -1763,386 +1831,771 @@ export async function auditOutput(webDirectory) { // Complete measured HCP115 compiler graph, including roles and ordered // edges for all existing consumers. Only actual compiler hashes vary. /** @type {Record<string, unknown>} */ - const expected = { - 'entry/app': { - file: '_app/immutable/entry/app.HASH.js', - name: 'entry/app', - src: '.svelte-kit/generated/build/client-optimized/app.js', - isEntry: true, - imports: [ - 'preload-helper', - 'shared-errors', - 'private-handles', - 'references' - ], - dynamicImports: [ - 'nodes/0', - 'nodes/1', - 'nodes/2', - 'nodes/3', - 'nodes/4', - 'nodes/5', - 'nodes/6', - 'nodes/7', - 'nodes/8', - 'nodes/9', - 'nodes/10', - 'nodes/11', - 'nodes/12', - 'error-template' - ] - }, - 'nodes/0': { - file: '_app/immutable/nodes/0.HASH.js', - name: 'nodes/0', - src: '.svelte-kit/generated/build/client-optimized/nodes/0.js', - isEntry: true, - imports: [ - 'public-key', - 'view-context', - 'public-runtime', - 'client', - 'Button', - 'client.svelte', - 'state', - 'CapabilityGate', - 'Disclosure' - ], - css: ['_app/immutable/assets/0.HASH.css'] - }, - 'nodes/1': { - file: '_app/immutable/nodes/1.HASH.js', - name: 'nodes/1', - src: '.svelte-kit/generated/build/client-optimized/nodes/1.js', - isEntry: true, - imports: ['client', 'client.svelte', 'state', 'legacy'] - }, - 'nodes/10': { - file: '_app/immutable/nodes/10.HASH.js', - name: 'nodes/10', - src: '.svelte-kit/generated/build/client-optimized/nodes/10.js', - isEntry: true, - imports: ['client', 'legacy', 'ListingEditor'] - }, - 'nodes/11': { - file: '_app/immutable/nodes/11.HASH.js', - name: 'nodes/11', - src: '.svelte-kit/generated/build/client-optimized/nodes/11.js', - isEntry: true, - imports: ['client', 'legacy', 'AccountGate'] - }, - 'nodes/12': { - file: '_app/immutable/nodes/12.HASH.js', - name: 'nodes/12', - src: '.svelte-kit/generated/build/client-optimized/nodes/12.js', - isEntry: true, - imports: [ - 'public-key', - 'client', - 'client.svelte', - 'state', - 'ListingEditor' - ] - }, - 'nodes/2': { - file: '_app/immutable/nodes/2.HASH.js', - name: 'nodes/2', - src: '.svelte-kit/generated/build/client-optimized/nodes/2.js', - isEntry: true, - imports: ['client', 'Button', 'routes'] - }, - 'nodes/3': { - file: '_app/immutable/nodes/3.HASH.js', - name: 'nodes/3', - src: '.svelte-kit/generated/build/client-optimized/nodes/3.js', - isEntry: true, - imports: ['client', 'legacy'] - }, - 'nodes/4': { - file: '_app/immutable/nodes/4.HASH.js', - name: 'nodes/4', - src: '.svelte-kit/generated/build/client-optimized/nodes/4.js', - isEntry: true, - imports: ['client', 'AccountGate', 'InboxStatus'] - }, - 'nodes/5': { - file: '_app/immutable/nodes/5.HASH.js', - name: 'nodes/5', - src: '.svelte-kit/generated/build/client-optimized/nodes/5.js', - isEntry: true, - imports: [ - 'public-key', - 'view-context', - 'public-runtime', - 'references', - 'client', - 'Button', - 'client.svelte', - 'state', - 'legacy', - 'inbox-view', - 'InboxStatus', - 'publishers', - 'MessageComposer' - ] - }, - 'nodes/6': { - file: '_app/immutable/nodes/6.HASH.js', - name: 'nodes/6', - src: '.svelte-kit/generated/build/client-optimized/nodes/6.js', - isEntry: true, - imports: ['client', 'legacy'] - }, - 'nodes/7': { - file: '_app/immutable/nodes/7.HASH.js', - name: 'nodes/7', - src: '.svelte-kit/generated/build/client-optimized/nodes/7.js', - isEntry: true, - imports: [ - 'public-key', - 'view-context', - 'public-runtime', - 'references', - 'client', - 'Button', - 'client.svelte', - 'state', - 'CapabilityGate', - 'Disclosure', - 'InboxSetup', - 'MessageComposer' - ] - }, - 'nodes/8': { - file: '_app/immutable/nodes/8.HASH.js', - name: 'nodes/8', - src: '.svelte-kit/generated/build/client-optimized/nodes/8.js', - isEntry: true, - imports: [ - 'public-key', - 'client', - 'client.svelte', - 'state', - 'ListingEditor' - ] - }, - 'nodes/9': { - file: '_app/immutable/nodes/9.HASH.js', - name: 'nodes/9', - src: '.svelte-kit/generated/build/client-optimized/nodes/9.js', - isEntry: true, - imports: [ - 'view-context', - 'public-runtime', - 'references', - 'client', - 'Button', - 'client.svelte', - 'navigation', - 'state', - 'Disclosure', - 'routes', - 'publishers' - ] - }, - 'error-template': { - file: '_app/immutable/chunks/HASH.js', - name: 'error-template', - src: '.svelte-kit/generated/build/shared/error-template.js', - isDynamicEntry: true - }, - 'inbox-view': { - file: '_app/immutable/chunks/HASH.js', - name: 'inbox-view', - imports: [ - 'public-key', - 'private-handles', - 'view-context', - 'public-runtime', - 'references', - 'Button', - 'read' - ] - }, - 'private-handles': { - file: '_app/immutable/chunks/HASH.js', - name: 'private-handles' - }, - routes: { - file: '_app/immutable/chunks/HASH.js', - name: 'routes', - imports: ['references', 'client', 'Button'] - }, - InboxSetup: { - file: '_app/immutable/chunks/HASH.js', - name: 'InboxSetup', - imports: ['view-context', 'public-runtime', 'client', 'Button'] - }, - 'preload-helper': { - file: '_app/immutable/chunks/HASH.js', - name: 'preload-helper' - }, - Disclosure: { - file: '_app/immutable/chunks/HASH.js', - name: 'Disclosure', - imports: ['client'] - }, - AccountGate: { - file: '_app/immutable/chunks/HASH.js', - name: 'AccountGate', - imports: ['view-context', 'client', 'CapabilityGate', 'InboxSetup'] - }, - publishers: { - file: '_app/immutable/chunks/HASH.js', - name: 'publishers', - imports: [ - 'public-key', - 'view-context', - 'public-runtime', - 'Button', - 'read' - ] - }, - InboxStatus: { - file: '_app/immutable/chunks/HASH.js', - name: 'InboxStatus', - imports: [ - 'view-context', - 'public-runtime', - 'client', - 'Button', - 'navigation', - 'CapabilityGate', - 'InboxSetup', - 'inbox-view' - ] - }, - Button: { - file: '_app/immutable/chunks/HASH.js', - name: 'Button', - imports: ['client'] - }, - references: { - file: '_app/immutable/chunks/HASH.js', - name: 'references', - imports: ['public-key'] - }, - client: { - file: '_app/immutable/chunks/HASH.js', - name: 'client' - }, - legacy: { - file: '_app/immutable/chunks/HASH.js', - name: 'legacy', - imports: ['client'] - }, - ListingEditor: { - file: '_app/immutable/chunks/HASH.js', - name: 'ListingEditor', - imports: [ - 'private-handles', - 'view-context', - 'references', - 'client', - 'Button', - 'CapabilityGate', - 'read' - ] - }, - 'public-key': { - file: '_app/immutable/chunks/HASH.js', - name: 'public-key' - }, - navigation: { - file: '_app/immutable/chunks/HASH.js', - name: 'navigation', - imports: ['entry/payload', 'shared-errors', 'client', 'client.svelte'] - }, - 'public-runtime': { - file: '_app/immutable/chunks/HASH.js', - name: 'public-runtime', - imports: [ - 'public-key', - 'preload-helper', - 'private-handles', - 'view-context', - 'Button' - ], - dynamicImports: ['negentropy'] - }, - 'shared-errors': { - file: '_app/immutable/chunks/HASH.js', - name: 'shared-errors' - }, - 'client.svelte': { - file: '_app/immutable/chunks/HASH.js', - name: 'client.svelte', - imports: ['entry/payload', 'shared-errors', 'client'] - }, - MessageComposer: { - file: '_app/immutable/chunks/HASH.js', - name: 'MessageComposer', - imports: [ - 'private-handles', - 'view-context', - 'public-runtime', - 'references', - 'client', - 'Button', - 'navigation', - 'inbox-view', - 'publishers' - ] - }, - 'view-context': { - file: '_app/immutable/chunks/HASH.js', - name: 'view-context', - imports: ['public-key', 'private-handles', 'Button'] - }, - CapabilityGate: { - file: '_app/immutable/chunks/HASH.js', - name: 'CapabilityGate', - imports: ['client', 'Button'] - }, - read: { - file: '_app/immutable/chunks/HASH.js', - name: 'read', - imports: ['view-context'] - }, - state: { - file: '_app/immutable/chunks/HASH.js', - name: 'state', - imports: ['client.svelte'] - }, - 'client-entry': { - file: '_app/immutable/chunks/HASH.js', - name: 'client-entry', - src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/client-entry.js', - isDynamicEntry: true, - imports: ['navigation'] - }, - 'entry/start': { - file: '_app/immutable/entry/start.HASH.js', - name: 'entry/start', - src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/entry.js', - isEntry: true, - imports: ['entry/payload', 'preload-helper'], - dynamicImports: ['client-entry'] - }, - 'entry/payload': { - file: '_app/immutable/entry/payload.HASH.js', - name: 'entry/payload', - src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/payload.js', - isEntry: true - }, - negentropy: { - file: '_app/immutable/chunks/HASH.js', - name: 'negentropy', - src: 'node_modules/.pnpm/applesauce-relay@6.2.1_typescript@6.0.3/node_modules/applesauce-relay/dist/negentropy.js', - isDynamicEntry: true, - imports: ['view-context', 'public-runtime'] - } - }; + const expected = hasListingContinuity + ? { + 'entry/app': { + file: '_app/immutable/entry/app.HASH.js', + name: 'entry/app', + src: '.svelte-kit/generated/build/client-optimized/app.js', + isEntry: true, + imports: [ + 'public-key', + 'preload-helper', + 'shared-errors', + 'references' + ], + dynamicImports: [ + 'nodes/0', + 'nodes/1', + 'nodes/2', + 'nodes/3', + 'nodes/4', + 'nodes/5', + 'nodes/6', + 'nodes/7', + 'nodes/8', + 'nodes/9', + 'nodes/10', + 'nodes/11', + 'nodes/12', + 'error-template' + ] + }, + 'nodes/0': { + file: '_app/immutable/nodes/0.HASH.js', + name: 'nodes/0', + src: '.svelte-kit/generated/build/client-optimized/nodes/0.js', + isEntry: true, + imports: [ + 'public-key', + 'public-runtime', + 'client', + 'Button', + 'client.svelte', + 'state', + 'CapabilityGate', + 'Disclosure' + ], + css: ['_app/immutable/assets/0.HASH.css'] + }, + 'nodes/1': { + file: '_app/immutable/nodes/1.HASH.js', + name: 'nodes/1', + src: '.svelte-kit/generated/build/client-optimized/nodes/1.js', + isEntry: true, + imports: ['client', 'client.svelte', 'state', 'legacy'] + }, + 'nodes/10': { + file: '_app/immutable/nodes/10.HASH.js', + name: 'nodes/10', + src: '.svelte-kit/generated/build/client-optimized/nodes/10.js', + isEntry: true, + imports: [ + 'public-key', + 'client', + 'Button', + 'client.svelte', + 'navigation', + 'state', + 'legacy', + 'routes', + 'ListingEditor' + ] + }, + 'nodes/11': { + file: '_app/immutable/nodes/11.HASH.js', + name: 'nodes/11', + src: '.svelte-kit/generated/build/client-optimized/nodes/11.js', + isEntry: true, + imports: ['client', 'legacy', 'AccountGate'] + }, + 'nodes/12': { + file: '_app/immutable/nodes/12.HASH.js', + name: 'nodes/12', + src: '.svelte-kit/generated/build/client-optimized/nodes/12.js', + isEntry: true, + imports: [ + 'public-key', + 'client', + 'client.svelte', + 'navigation', + 'state', + 'ListingEditor' + ] + }, + 'nodes/2': { + file: '_app/immutable/nodes/2.HASH.js', + name: 'nodes/2', + src: '.svelte-kit/generated/build/client-optimized/nodes/2.js', + isEntry: true, + imports: ['client', 'Button', 'SearchForm', 'routes'] + }, + 'nodes/3': { + file: '_app/immutable/nodes/3.HASH.js', + name: 'nodes/3', + src: '.svelte-kit/generated/build/client-optimized/nodes/3.js', + isEntry: true, + imports: ['client', 'legacy'] + }, + 'nodes/4': { + file: '_app/immutable/nodes/4.HASH.js', + name: 'nodes/4', + src: '.svelte-kit/generated/build/client-optimized/nodes/4.js', + isEntry: true, + imports: ['client', 'AccountGate', 'InboxStatus'] + }, + 'nodes/5': { + file: '_app/immutable/nodes/5.HASH.js', + name: 'nodes/5', + src: '.svelte-kit/generated/build/client-optimized/nodes/5.js', + isEntry: true, + imports: [ + 'public-key', + 'public-runtime', + 'references', + 'client', + 'Button', + 'client.svelte', + 'state', + 'legacy', + 'inbox-view', + 'InboxStatus', + 'publishers', + 'MessageComposer' + ] + }, + 'nodes/6': { + file: '_app/immutable/nodes/6.HASH.js', + name: 'nodes/6', + src: '.svelte-kit/generated/build/client-optimized/nodes/6.js', + isEntry: true, + imports: ['client', 'legacy'] + }, + 'nodes/7': { + file: '_app/immutable/nodes/7.HASH.js', + name: 'nodes/7', + src: '.svelte-kit/generated/build/client-optimized/nodes/7.js', + isEntry: true, + imports: [ + 'public-key', + 'public-runtime', + 'references', + 'client', + 'Button', + 'client.svelte', + 'state', + 'CapabilityGate', + 'Disclosure', + 'InboxSetup', + 'MessageComposer' + ] + }, + 'nodes/8': { + file: '_app/immutable/nodes/8.HASH.js', + name: 'nodes/8', + src: '.svelte-kit/generated/build/client-optimized/nodes/8.js', + isEntry: true, + imports: [ + 'public-key', + 'client', + 'client.svelte', + 'navigation', + 'state', + 'ListingEditor' + ] + }, + 'nodes/9': { + file: '_app/immutable/nodes/9.HASH.js', + name: 'nodes/9', + src: '.svelte-kit/generated/build/client-optimized/nodes/9.js', + isEntry: true, + imports: [ + 'public-runtime', + 'references', + 'client', + 'Button', + 'client.svelte', + 'navigation', + 'state', + 'Disclosure', + 'SearchForm', + 'routes', + 'publishers' + ] + }, + 'error-template': { + file: '_app/immutable/chunks/HASH.js', + name: 'error-template', + src: '.svelte-kit/generated/build/shared/error-template.js', + isDynamicEntry: true + }, + MessageComposer: { + file: '_app/immutable/chunks/HASH.js', + name: 'MessageComposer', + imports: [ + 'public-key', + 'public-runtime', + 'references', + 'client', + 'Button', + 'navigation', + 'inbox-view', + 'publishers' + ] + }, + 'preload-helper': { + file: '_app/immutable/chunks/HASH.js', + name: 'preload-helper' + }, + Disclosure: { + file: '_app/immutable/chunks/HASH.js', + name: 'Disclosure', + imports: ['client'] + }, + InboxStatus: { + file: '_app/immutable/chunks/HASH.js', + name: 'InboxStatus', + imports: [ + 'public-runtime', + 'client', + 'Button', + 'navigation', + 'CapabilityGate', + 'InboxSetup', + 'inbox-view' + ] + }, + 'inbox-view': { + file: '_app/immutable/chunks/HASH.js', + name: 'inbox-view', + imports: [ + 'public-key', + 'public-runtime', + 'references', + 'Button', + 'read' + ] + }, + 'public-key': { + file: '_app/immutable/chunks/HASH.js', + name: 'public-key' + }, + routes: { + file: '_app/immutable/chunks/HASH.js', + name: 'routes', + imports: ['public-key', 'references', 'Button'] + }, + Button: { + file: '_app/immutable/chunks/HASH.js', + name: 'Button', + imports: ['client'] + }, + ListingEditor: { + file: '_app/immutable/chunks/HASH.js', + name: 'ListingEditor', + imports: [ + 'public-key', + 'public-runtime', + 'references', + 'client', + 'Button', + 'CapabilityGate', + 'read' + ] + }, + client: { + file: '_app/immutable/chunks/HASH.js', + name: 'client' + }, + InboxSetup: { + file: '_app/immutable/chunks/HASH.js', + name: 'InboxSetup', + imports: ['public-runtime', 'client', 'Button'] + }, + legacy: { + file: '_app/immutable/chunks/HASH.js', + name: 'legacy', + imports: ['client'] + }, + navigation: { + file: '_app/immutable/chunks/HASH.js', + name: 'navigation', + imports: [ + 'entry/payload', + 'shared-errors', + 'client', + 'client.svelte' + ] + }, + 'shared-errors': { + file: '_app/immutable/chunks/HASH.js', + name: 'shared-errors' + }, + AccountGate: { + file: '_app/immutable/chunks/HASH.js', + name: 'AccountGate', + imports: [ + 'public-runtime', + 'client', + 'CapabilityGate', + 'InboxSetup' + ] + }, + read: { + file: '_app/immutable/chunks/HASH.js', + name: 'read', + imports: ['public-runtime'] + }, + 'client.svelte': { + file: '_app/immutable/chunks/HASH.js', + name: 'client.svelte', + imports: ['entry/payload', 'shared-errors', 'client'] + }, + publishers: { + file: '_app/immutable/chunks/HASH.js', + name: 'publishers', + imports: ['public-key', 'public-runtime', 'Button', 'read'] + }, + CapabilityGate: { + file: '_app/immutable/chunks/HASH.js', + name: 'CapabilityGate', + imports: ['client', 'Button'] + }, + 'public-runtime': { + file: '_app/immutable/chunks/HASH.js', + name: 'public-runtime', + imports: ['public-key', 'preload-helper', 'Button'], + dynamicImports: ['negentropy'] + }, + SearchForm: { + file: '_app/immutable/chunks/HASH.js', + name: 'SearchForm', + imports: ['client', 'Button'] + }, + state: { + file: '_app/immutable/chunks/HASH.js', + name: 'state', + imports: ['client.svelte'] + }, + references: { + file: '_app/immutable/chunks/HASH.js', + name: 'references', + imports: ['public-key'] + }, + 'client-entry': { + file: '_app/immutable/chunks/HASH.js', + name: 'client-entry', + src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/client-entry.js', + isDynamicEntry: true, + imports: ['navigation'] + }, + 'entry/start': { + file: '_app/immutable/entry/start.HASH.js', + name: 'entry/start', + src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/entry.js', + isEntry: true, + imports: ['entry/payload', 'preload-helper'], + dynamicImports: ['client-entry'] + }, + 'entry/payload': { + file: '_app/immutable/entry/payload.HASH.js', + name: 'entry/payload', + src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/payload.js', + isEntry: true + }, + negentropy: { + file: '_app/immutable/chunks/HASH.js', + name: 'negentropy', + src: 'node_modules/.pnpm/applesauce-relay@6.2.1_typescript@6.0.3/node_modules/applesauce-relay/dist/negentropy.js', + isDynamicEntry: true, + imports: ['public-runtime'] + } + } + : { + 'entry/app': { + file: '_app/immutable/entry/app.HASH.js', + name: 'entry/app', + src: '.svelte-kit/generated/build/client-optimized/app.js', + isEntry: true, + imports: [ + 'preload-helper', + 'shared-errors', + 'private-handles', + 'references' + ], + dynamicImports: [ + 'nodes/0', + 'nodes/1', + 'nodes/2', + 'nodes/3', + 'nodes/4', + 'nodes/5', + 'nodes/6', + 'nodes/7', + 'nodes/8', + 'nodes/9', + 'nodes/10', + 'nodes/11', + 'nodes/12', + 'error-template' + ] + }, + 'nodes/0': { + file: '_app/immutable/nodes/0.HASH.js', + name: 'nodes/0', + src: '.svelte-kit/generated/build/client-optimized/nodes/0.js', + isEntry: true, + imports: [ + 'public-key', + 'view-context', + 'public-runtime', + 'client', + 'Button', + 'client.svelte', + 'state', + 'CapabilityGate', + 'Disclosure' + ], + css: ['_app/immutable/assets/0.HASH.css'] + }, + 'nodes/1': { + file: '_app/immutable/nodes/1.HASH.js', + name: 'nodes/1', + src: '.svelte-kit/generated/build/client-optimized/nodes/1.js', + isEntry: true, + imports: ['client', 'client.svelte', 'state', 'legacy'] + }, + 'nodes/10': { + file: '_app/immutable/nodes/10.HASH.js', + name: 'nodes/10', + src: '.svelte-kit/generated/build/client-optimized/nodes/10.js', + isEntry: true, + imports: ['client', 'legacy', 'ListingEditor'] + }, + 'nodes/11': { + file: '_app/immutable/nodes/11.HASH.js', + name: 'nodes/11', + src: '.svelte-kit/generated/build/client-optimized/nodes/11.js', + isEntry: true, + imports: ['client', 'legacy', 'AccountGate'] + }, + 'nodes/12': { + file: '_app/immutable/nodes/12.HASH.js', + name: 'nodes/12', + src: '.svelte-kit/generated/build/client-optimized/nodes/12.js', + isEntry: true, + imports: [ + 'public-key', + 'client', + 'client.svelte', + 'state', + 'ListingEditor' + ] + }, + 'nodes/2': { + file: '_app/immutable/nodes/2.HASH.js', + name: 'nodes/2', + src: '.svelte-kit/generated/build/client-optimized/nodes/2.js', + isEntry: true, + imports: ['client', 'Button', 'routes'] + }, + 'nodes/3': { + file: '_app/immutable/nodes/3.HASH.js', + name: 'nodes/3', + src: '.svelte-kit/generated/build/client-optimized/nodes/3.js', + isEntry: true, + imports: ['client', 'legacy'] + }, + 'nodes/4': { + file: '_app/immutable/nodes/4.HASH.js', + name: 'nodes/4', + src: '.svelte-kit/generated/build/client-optimized/nodes/4.js', + isEntry: true, + imports: ['client', 'AccountGate', 'InboxStatus'] + }, + 'nodes/5': { + file: '_app/immutable/nodes/5.HASH.js', + name: 'nodes/5', + src: '.svelte-kit/generated/build/client-optimized/nodes/5.js', + isEntry: true, + imports: [ + 'public-key', + 'view-context', + 'public-runtime', + 'references', + 'client', + 'Button', + 'client.svelte', + 'state', + 'legacy', + 'inbox-view', + 'InboxStatus', + 'publishers', + 'MessageComposer' + ] + }, + 'nodes/6': { + file: '_app/immutable/nodes/6.HASH.js', + name: 'nodes/6', + src: '.svelte-kit/generated/build/client-optimized/nodes/6.js', + isEntry: true, + imports: ['client', 'legacy'] + }, + 'nodes/7': { + file: '_app/immutable/nodes/7.HASH.js', + name: 'nodes/7', + src: '.svelte-kit/generated/build/client-optimized/nodes/7.js', + isEntry: true, + imports: [ + 'public-key', + 'view-context', + 'public-runtime', + 'references', + 'client', + 'Button', + 'client.svelte', + 'state', + 'CapabilityGate', + 'Disclosure', + 'InboxSetup', + 'MessageComposer' + ] + }, + 'nodes/8': { + file: '_app/immutable/nodes/8.HASH.js', + name: 'nodes/8', + src: '.svelte-kit/generated/build/client-optimized/nodes/8.js', + isEntry: true, + imports: [ + 'public-key', + 'client', + 'client.svelte', + 'state', + 'ListingEditor' + ] + }, + 'nodes/9': { + file: '_app/immutable/nodes/9.HASH.js', + name: 'nodes/9', + src: '.svelte-kit/generated/build/client-optimized/nodes/9.js', + isEntry: true, + imports: [ + 'view-context', + 'public-runtime', + 'references', + 'client', + 'Button', + 'client.svelte', + 'navigation', + 'state', + 'Disclosure', + 'routes', + 'publishers' + ] + }, + 'error-template': { + file: '_app/immutable/chunks/HASH.js', + name: 'error-template', + src: '.svelte-kit/generated/build/shared/error-template.js', + isDynamicEntry: true + }, + 'inbox-view': { + file: '_app/immutable/chunks/HASH.js', + name: 'inbox-view', + imports: [ + 'public-key', + 'private-handles', + 'view-context', + 'public-runtime', + 'references', + 'Button', + 'read' + ] + }, + 'private-handles': { + file: '_app/immutable/chunks/HASH.js', + name: 'private-handles' + }, + routes: { + file: '_app/immutable/chunks/HASH.js', + name: 'routes', + imports: ['references', 'client', 'Button'] + }, + InboxSetup: { + file: '_app/immutable/chunks/HASH.js', + name: 'InboxSetup', + imports: ['view-context', 'public-runtime', 'client', 'Button'] + }, + 'preload-helper': { + file: '_app/immutable/chunks/HASH.js', + name: 'preload-helper' + }, + Disclosure: { + file: '_app/immutable/chunks/HASH.js', + name: 'Disclosure', + imports: ['client'] + }, + AccountGate: { + file: '_app/immutable/chunks/HASH.js', + name: 'AccountGate', + imports: ['view-context', 'client', 'CapabilityGate', 'InboxSetup'] + }, + publishers: { + file: '_app/immutable/chunks/HASH.js', + name: 'publishers', + imports: [ + 'public-key', + 'view-context', + 'public-runtime', + 'Button', + 'read' + ] + }, + InboxStatus: { + file: '_app/immutable/chunks/HASH.js', + name: 'InboxStatus', + imports: [ + 'view-context', + 'public-runtime', + 'client', + 'Button', + 'navigation', + 'CapabilityGate', + 'InboxSetup', + 'inbox-view' + ] + }, + Button: { + file: '_app/immutable/chunks/HASH.js', + name: 'Button', + imports: ['client'] + }, + references: { + file: '_app/immutable/chunks/HASH.js', + name: 'references', + imports: ['public-key'] + }, + client: { + file: '_app/immutable/chunks/HASH.js', + name: 'client' + }, + legacy: { + file: '_app/immutable/chunks/HASH.js', + name: 'legacy', + imports: ['client'] + }, + ListingEditor: { + file: '_app/immutable/chunks/HASH.js', + name: 'ListingEditor', + imports: [ + 'private-handles', + 'view-context', + 'references', + 'client', + 'Button', + 'CapabilityGate', + 'read' + ] + }, + 'public-key': { + file: '_app/immutable/chunks/HASH.js', + name: 'public-key' + }, + navigation: { + file: '_app/immutable/chunks/HASH.js', + name: 'navigation', + imports: [ + 'entry/payload', + 'shared-errors', + 'client', + 'client.svelte' + ] + }, + 'public-runtime': { + file: '_app/immutable/chunks/HASH.js', + name: 'public-runtime', + imports: [ + 'public-key', + 'preload-helper', + 'private-handles', + 'view-context', + 'Button' + ], + dynamicImports: ['negentropy'] + }, + 'shared-errors': { + file: '_app/immutable/chunks/HASH.js', + name: 'shared-errors' + }, + 'client.svelte': { + file: '_app/immutable/chunks/HASH.js', + name: 'client.svelte', + imports: ['entry/payload', 'shared-errors', 'client'] + }, + MessageComposer: { + file: '_app/immutable/chunks/HASH.js', + name: 'MessageComposer', + imports: [ + 'private-handles', + 'view-context', + 'public-runtime', + 'references', + 'client', + 'Button', + 'navigation', + 'inbox-view', + 'publishers' + ] + }, + 'view-context': { + file: '_app/immutable/chunks/HASH.js', + name: 'view-context', + imports: ['public-key', 'private-handles', 'Button'] + }, + CapabilityGate: { + file: '_app/immutable/chunks/HASH.js', + name: 'CapabilityGate', + imports: ['client', 'Button'] + }, + read: { + file: '_app/immutable/chunks/HASH.js', + name: 'read', + imports: ['view-context'] + }, + state: { + file: '_app/immutable/chunks/HASH.js', + name: 'state', + imports: ['client.svelte'] + }, + 'client-entry': { + file: '_app/immutable/chunks/HASH.js', + name: 'client-entry', + src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/client-entry.js', + isDynamicEntry: true, + imports: ['navigation'] + }, + 'entry/start': { + file: '_app/immutable/entry/start.HASH.js', + name: 'entry/start', + src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/entry.js', + isEntry: true, + imports: ['entry/payload', 'preload-helper'], + dynamicImports: ['client-entry'] + }, + 'entry/payload': { + file: '_app/immutable/entry/payload.HASH.js', + name: 'entry/payload', + src: 'node_modules/.pnpm/@sveltejs+kit@3.0.0_@opentelemetry+api@1.9.1_@sveltejs+vite-plugin-svelte@7.3.1_svelte@_6edc02734bfa45cbf85e92e62b52fb36/node_modules/@sveltejs/kit/src/runtime/client/payload.js', + isEntry: true + }, + negentropy: { + file: '_app/immutable/chunks/HASH.js', + name: 'negentropy', + src: 'node_modules/.pnpm/applesauce-relay@6.2.1_typescript@6.0.3/node_modules/applesauce-relay/dist/negentropy.js', + isDynamicEntry: true, + imports: ['view-context', 'public-runtime'] + } + }; for (const record of Object.values(manifest)) { const actual = { ...record }; actual.file = actual.file.includes('/chunks/')