commit 460f323f22a2b2b8f737a48134a6d3475cdb8257
parent 2b15f2532626a1f9db82d932f342d38dfed9bc96
Author: triesap <tyson@radroots.org>
Date: Sun, 11 Oct 2026 13:24:44 +0000
web: audit copy and disconnect cleanup across all surfaces (HCP-128)
- Replace obsolete Messages copy with its connection and unlock condition.
- Verify private metadata and late logout callbacks with actual browser flows.
- Preserve exact compiler producers and reject false delivery copy.
- Keep bounded canary evidence distinct from full qualification.
Diffstat:
8 files changed, 239 insertions(+), 1 deletion(-)
diff --git a/web/src/lib/components/AccountGate.svelte b/web/src/lib/components/AccountGate.svelte
@@ -46,7 +46,7 @@
onprobe={view.mounted ? probe : undefined}
/>
<p class="notice">
- Private views and editing are unavailable during development.
+ Messages stay hidden until you connect and explicitly unlock your inbox.
</p>
<InboxSetup />
</div>
diff --git a/web/tests/e2e/inbox-view.spec.ts b/web/tests/e2e/inbox-view.spec.ts
@@ -454,6 +454,21 @@ test('logout during held actual extension decryption clears presentation and pre
expect(await page.evaluate(() => window.hcp101Fixture.snapshot().count)).toBe(
0
);
+ expect(
+ await page.evaluate(() => window.hcp101Fixture.snapshot())
+ ).toMatchObject({
+ state: 'unavailable',
+ count: 0,
+ queued: 0,
+ lastCheckedAt: null
+ });
+ await expect(
+ page.getByRole('button', { name: 'Read new messages (1)', exact: true })
+ ).toHaveCount(0);
+ await expect(page.getByText(/Last checked at/)).toHaveCount(0);
+ expect(
+ await page.evaluate(() => window.hcp101Fixture.encryptedUnchanged())
+ ).toBe(true);
expect(events).toEqual([]);
expect(requests).toEqual([]);
});
diff --git a/web/tests/e2e/privacy-output.spec.ts b/web/tests/e2e/privacy-output.spec.ts
@@ -0,0 +1,88 @@
+import { expect, test } from '@playwright/test';
+import { encodeProductReference } from '../../src/lib/nostr/references.ts';
+import { createStaticHarness } from '../integration/harness/static.ts';
+
+test('HCP128 actual Messages SSR describes the connection and unlock condition', async ({
+ request
+}) => {
+ const server = await createStaticHarness();
+ try {
+ const response = await request.get(server.url + '/messages', {
+ headers: { Accept: 'text/html' }
+ });
+ expect(response.status()).toBe(200);
+ const html = await response.text();
+ expect(html).toContain(
+ 'Messages stay hidden until you connect and explicitly unlock your inbox.'
+ );
+ expect(html).not.toContain('unavailable during development');
+ } finally {
+ await server.close();
+ }
+});
+
+test('HCP128 real private routes keep generic noindex metadata through hydration and reload without extension effects', async ({
+ page
+}) => {
+ const coordinate = encodeProductReference({
+ kind: 30402,
+ pubkey: '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
+ identifier: 'HCP128_TEST_ONLY_PUBLIC_COORDINATE'
+ });
+ expect(coordinate).toBeTruthy();
+ const handle = '12345678-1234-4234-8234-123456789abc';
+ // Generic means independent of private content or peer identity. The
+ // approved editor uses finite route-mode labels, not a product-only title.
+ const paths = [
+ ['/messages', 'HarvestCircle'],
+ ['/messages/' + handle, 'HarvestCircle'],
+ ['/sell', 'New listing · HarvestCircle'],
+ ['/selling', 'HarvestCircle'],
+ ['/selling/drafts/' + handle, 'Continue draft · HarvestCircle'],
+ ['/products/' + coordinate + '/edit', 'Edit listing · HarvestCircle']
+ ] as const;
+ const server = await createStaticHarness();
+ const errors: string[] = [];
+ const external: string[] = [];
+ page.on('pageerror', (error) => errors.push(error.message));
+ try {
+ await page.route('**/*', (route) => {
+ if (new URL(route.request().url()).origin === server.url)
+ return route.continue();
+ external.push(route.request().url());
+ return route.abort();
+ });
+ await page.addInitScript(() => {
+ Object.defineProperty(window, 'nostr', {
+ configurable: true,
+ get() {
+ throw Error('HCP128 unrequested extension access');
+ }
+ });
+ });
+ for (const [pathname, title] of paths) {
+ for (const navigate of [
+ () => page.goto(server.url + pathname),
+ () => page.reload()
+ ]) {
+ expect((await navigate())?.status()).toBe(200);
+ await expect(
+ page
+ .getByRole('navigation', { name: 'Primary' })
+ .getByRole('button', { name: 'Connect extension', exact: true })
+ ).toBeEnabled();
+ await expect(page).toHaveTitle(title);
+ await expect(page.locator('meta[name="robots"]')).toHaveAttribute(
+ 'content',
+ 'noindex'
+ );
+ expect(new URL(page.url()).pathname).toBe(pathname);
+ expect(new URL(page.url()).search + new URL(page.url()).hash).toBe('');
+ }
+ }
+ expect(errors).toEqual([]);
+ expect(external).toEqual([]);
+ } finally {
+ await server.close();
+ }
+});
diff --git a/web/tests/e2e/reply-composer.spec.ts b/web/tests/e2e/reply-composer.spec.ts
@@ -422,6 +422,9 @@ for (const crossSecond of [false, true]) {
test('typing is memory only with no autosave SDK discovery publication or order transition', async ({
page
}) => {
+ const messages: string[] = [];
+ page.on('console', (message) => messages.push(message.text()));
+ page.on('pageerror', (error) => messages.push(error.message));
await ready(page);
const before = await page.evaluate(async () => ({
native: await window.hcp104Fixture.native(),
@@ -455,6 +458,15 @@ test('typing is memory only with no autosave SDK discovery publication or order
sentinel
)
).toBe(false);
+ // This controlled composer is mounted on Search, not a private route.
+ // Real private title/noindex qualification is in privacy-output.spec.ts.
+ expect(await page.locator('head').textContent()).not.toContain(sentinel);
+ expect(page.url()).not.toContain(encodeURIComponent(sentinel));
+ expect(messages.join('\n')).not.toContain(sentinel);
+ await expect(composer(page).getByText(/unsaved memory/)).toBeVisible();
+ await expect(
+ composer(page).getByText('It does not accept an order.', { exact: false })
+ ).toBeVisible();
});
test('explicit Send creates an actual self-first paired reply with the authenticated peer and direct inner parent', async ({
@@ -717,6 +729,8 @@ test('logout during actual held signer work hides the draft and refuses late pee
await expect(composer(page).getByLabel('Reply', { exact: true })).toHaveCount(
0
);
+ expect(await page.locator('body').textContent()).not.toContain(sentinel);
+ expect(await page.locator('head').textContent()).not.toContain(sentinel);
});
test('copied controllers and arbitrary private or product hashes cannot borrow reply custody', async ({
diff --git a/web/tests/integration/privacy-output.test.ts b/web/tests/integration/privacy-output.test.ts
@@ -0,0 +1,50 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readdir, readFile } from 'node:fs/promises';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { createStaticHarness } from './harness/static.ts';
+
+await test('HCP128 actual static Messages response keeps generic noindex metadata and condition copy', async () => {
+ const server = await createStaticHarness();
+ try {
+ const response = await fetch(server.url + '/messages', {
+ headers: { Accept: 'text/html' }
+ });
+ assert.equal(response.status, 200);
+ const html = await response.text();
+ assert.match(html, /<title>HarvestCircle<\/title>/);
+ assert.match(html, /<meta name="robots" content="noindex"/);
+ assert.ok(
+ html.includes(
+ 'Messages stay hidden until you connect and explicitly unlock your inbox.'
+ )
+ );
+ assert.ok(!html.includes('unavailable during development'));
+ } finally {
+ await server.close();
+ }
+});
+
+await test('HCP128 every actual static artifact excludes private fixture bodies and production fixture secrets', async () => {
+ const root = fileURLToPath(new URL('../../build/', import.meta.url));
+ let checked = 0;
+ async function inspect(directory: string) {
+ for (const item of await readdir(directory, { withFileTypes: true })) {
+ const file = path.join(directory, item.name);
+ assert.ok(!item.isSymbolicLink());
+ if (item.isDirectory()) await inspect(file);
+ else {
+ assert.ok(item.isFile());
+ const content = await readFile(file, 'utf8');
+ assert.doesNotMatch(
+ content,
+ /HCP104_UNSENT_MEMORY_ONLY|PRIVATE OWNER B SENTINEL|HC_TEST_ONLY_SECRET|-----BEGIN (?:[A-Z ]*PRIVATE KEY|OPENSSH)/
+ );
+ checked++;
+ }
+ }
+ }
+ await inspect(root);
+ assert.ok(checked > 0, 'must inspect actual generated static files');
+});
diff --git a/web/tests/provenance/output.test.mjs b/web/tests/provenance/output.test.mjs
@@ -1888,6 +1888,31 @@ import { auditOutput } from '../../tools/check-output.mjs';
}
);
}
+ for (const mutation of [
+ 'Order placed. Guaranteed delivery.',
+ 'Messages are delivered to the person.'
+ ]) {
+ await check(
+ 'privacy copy rejects changed AccountGate ' + mutation,
+ async (t) => {
+ const f = await fixture(t);
+ const file = path.join(
+ f.web,
+ 'src/lib/components/AccountGate.svelte'
+ );
+ const source = await readFile(file, 'utf8');
+ const current =
+ 'Messages stay hidden until you connect and explicitly unlock your inbox.';
+ assert.ok(source.includes(current));
+ await writeFile(file, source.replace(current, mutation));
+ await refresh(f);
+ await assert.rejects(
+ f.audit,
+ /Invalid owned operational flags source/
+ );
+ }
+ );
+ }
for (const attribute of [
'rel="noopener noreferrer"',
'referrerpolicy="no-referrer"'
diff --git a/web/tests/unit/status-copy.test.ts b/web/tests/unit/status-copy.test.ts
@@ -5,6 +5,43 @@ import {
type OperationFact
} from '../../src/lib/presentation/status-copy';
describe('finite evidence-specific presentation', () => {
+ it('all target facts keep relay acceptance and exact readback distinct from person delivery or remote reading', () => {
+ for (const role of ['public', 'recipient', 'archive'] as const)
+ for (const outcome of [
+ 'pending',
+ 'accepted',
+ 'refused',
+ 'timed-out',
+ 'unknown'
+ ] as const)
+ for (const readback of [
+ 'confirmed',
+ 'not-observed',
+ 'unknown'
+ ] as const) {
+ const copy = receiptCopy({
+ role,
+ outcome,
+ readback,
+ eventId: 'event-A',
+ destination: 'target-A'
+ });
+ expect(copy.text + ' ' + copy.readback).not.toMatch(
+ /order placed|delivered to|person received|remote (?:seen|read)|guaranteed|complete sync/i
+ );
+ if (outcome !== 'accepted')
+ expect(copy.text).not.toContain(' accepted the event.');
+ if (outcome === 'accepted')
+ expect(copy.text).toContain('relay accepted the event.');
+ expect(copy.readback).toBe(
+ readback === 'confirmed'
+ ? 'Exact read-back is confirmed for this event and target.'
+ : readback === 'not-observed'
+ ? 'Exact read-back was not observed for this event and target.'
+ : 'Exact read-back is unknown.'
+ );
+ }
+ });
it('never maps unsupported or unknown to success', () => {
for (const state of ['unknown', 'new-future-state', null, undefined, 42])
expect(statusCopy(state as OperationFact)).toEqual({
diff --git a/web/tools/check-output.mjs b/web/tools/check-output.mjs
@@ -238,6 +238,10 @@ async function operationalFlagsAdmission(web) {
if (!shell.includes('../runtime/capabilities.ts')) return false;
/** @type {Record<string,string>} */
const producers = {
+ // Exact previous AccountGate remains compatibility history; the only
+ // current alternative changes its obsolete condition copy below.
+ 'src/lib/components/AccountGate.svelte':
+ '642925e1819628263810dd42624e97cadf29818f84a42ef49a86ad1f196888ca',
'src/lib/catalog/observations.ts':
'7386470e698156f2480de1d6c9fcffacab507f97d2f4006df926db467327120c',
'src/lib/catalog/product-view.ts':
@@ -441,6 +445,11 @@ async function operationalFlagsAdmission(web) {
if (
identity !== pin &&
!(
+ name === 'src/lib/components/AccountGate.svelte' &&
+ identity ===
+ '95c04e52fdc7c706c84af9d8d842a1b19db2a0ba2e0f5f04e5b68c7d95be1ab0'
+ ) &&
+ !(
name === 'src/routes/products/[naddr=naddr]/+page.svelte' &&
identity ===
'10d98f1a306cfe216b57d6b990254335a7b21a8c42e558a54b2d471c49858069'