feat(02-04): harness A26+A27(strict)+A28 — meta.json 8-field + multi-tab urls[] STRICT + REQ-archive-layout (D-P2-02/03 + DEC-011 Amendment 1)

Wave 3 closure task 3 — extends the UAT harness with 3 new assertions
(A26 + A27 + A28) for empirical verification of the D-P2-02/D-P2-03
contracts + REQ-archive-layout end-to-end through a real Chrome instance.

Page side (tests/uat/extension-page-harness.ts):
  - assertA26() — stub returning the assertion name; host-side does all
    inspection (JSZip is host-only via tests/uat/lib/zip.ts).
  - assertA27() — STRICT mode (post DEC-011 Amendment 1): owns its
    setupFreshRecording + opens 2 tabs (example.com + iana.org) +
    activates each (chrome.tabs.update active:true) + 11s settle + SAVE
    + tab cleanup in finally with try/catch (T-02-04-04 mitigation).
    Returns A27.1 (SAVE ack) + tabAUrl + tabBUrl for the host driver.
  - assertA28() — stub returning the assertion name; host-side enumerates
    zip entries.
  - __mokoshHarness surface extended from 25 → 28 methods.

Host side (tests/uat/lib/harness-page-driver.ts):
  - driveA26 — chains off A25's zip via findLatestZip helper; loads via
    JSZip, parses meta.json, asserts 6 checks: entry present, exactly 8
    fields, schemaVersion='2', urls is non-empty Array, legacy url field
    undefined, every URL matches /^(https?|chrome-extension):\\/\\//.
  - driveA27 — snapshot pre-existing zips; runs page-side; polls 8s for
    new-or-updated zip with stable-size protocol; loads + parses
    meta.json; asserts 8 STRICT checks per DEC-011 Amendment 1: SAVE ack,
    meta.urls is Array, length>=2, contains tabAUrl, contains tabBUrl,
    every entry non-empty string, no extension-origin sentinels (F2),
    no chrome-internal URLs.
  - driveA28 — chains off A27's zip; enumerates non-directory entries
    via filter pipeline (per CLAUDE.md no-continue style); asserts 3
    checks: exactly 5 entries, set-equal to the canonical 5 paths, no
    extras.
  - findLatestZip helper added for A26/A28 chaining (mtime-sort wins).
  - JSZip imported at top (mirrors tests/uat/lib/zip.ts pattern).

Orchestrator (tests/uat/harness.test.ts):
  - Imports driveA26/A27/A28 + wraps each with handles.downloadsDir.
  - Drivers array extends from 25 → 28 (running total 29/29 with A0).
  - Architecture banner updated to mention A26+A27+A28.

FORBIDDEN_HOOK_STRINGS impact: NONE. A26/A28 are host-side JSZip ops;
A27 uses chrome.tabs.create + chrome.tabs.update + chrome.tabs.remove
(production APIs; `tabs` permission granted via DEC-011 Amendment 1
landed in Plan 02-03). Tier-1 inventory stays at 12.

Verification (pre-commit):
  - npx tsc --noEmit: clean.
  - npm run build: exit 0; dist/ populated.
  - 4 new manifest gates (Tier-1 + SW-bundle-import) verified in followup.

Closes Plan 02-04 Task 3 (Wave 3 functional contract). Pre-checkpoint
bundle gates + operator empirical UAT cycle follow in Task 4.
This commit is contained in:
2026-05-20 17:16:35 +02:00
parent b6b3f377b8
commit 20e06a6a58
3 changed files with 757 additions and 2 deletions

View File

@@ -93,6 +93,10 @@ import {
driveA24,
// Plan 02-04 Task 2 — REQ-archive-export-latency (5s ceiling)
driveA25,
// Plan 02-04 Task 3 — meta.json 8-field + multi-tab strict + REQ-archive-layout
driveA26,
driveA27,
driveA28,
getManifestVersion,
} from './lib/harness-page-driver';
import {
@@ -261,7 +265,7 @@ async function assertA0_GrepGate(): Promise<{
*/
async function main(): Promise<number> {
process.stdout.write('\nMokosh Plan 01-13 + 01-14 + 02-04 — UAT harness orchestrator\n');
process.stdout.write('Architecture: A0 pre-flight + extension-internal page driver (A1..A14, A15..A17, A18..A22, A23, A24, A25)\n');
process.stdout.write('Architecture: A0 pre-flight + extension-internal page driver (A1..A14, A15..A17, A18..A22, A23, A24, A25, A26, A27, A28)\n');
process.stdout.write('='.repeat(72) + '\n');
// A0 pre-flight (no Chrome launch needed; runs against built dist/).
@@ -319,6 +323,16 @@ async function main(): Promise<number> {
// dispatch→file-on-disk latency check (mirrors A5/A12/A13 wrapping).
const driveA25Wrapped: (page: import('puppeteer').Page) => Promise<AssertionRecord> =
(page) => driveA25(page, handles.downloadsDir);
// Plan 02-04 Task 3 — driveA26/A27/A28 need downloadsDir for host-side
// zip inspection (JSZip-parse meta.json + zip-layout enumeration). A26
// chains off A25's zip (no new SAVE); A27 owns its SAVE (multi-tab);
// A28 chains off A27's zip (no new SAVE).
const driveA26Wrapped: (page: import('puppeteer').Page) => Promise<AssertionRecord> =
(page) => driveA26(page, handles.downloadsDir);
const driveA27Wrapped: (page: import('puppeteer').Page) => Promise<AssertionRecord> =
(page) => driveA27(page, handles.downloadsDir);
const driveA28Wrapped: (page: import('puppeteer').Page) => Promise<AssertionRecord> =
(page) => driveA28(page, handles.downloadsDir);
const drivers: ReadonlyArray<{
readonly name: string;
@@ -398,6 +412,22 @@ async function main(): Promise<number> {
// with A24's still-pending state). The 11s segment-settle is NOT
// counted toward the 5s budget — only the SAVE dispatch.
{ name: 'A25', drive: driveA25Wrapped },
// Plan 02-04 Task 3 A26: D-P2-02 + D-P2-03 meta.json 8-field shape.
// Chains off A25's zip (no new SAVE); host-side JSZip-parse meta.json
// and asserts the 8-field shape with urls[] + schemaVersion='2'.
{ name: 'A26', drive: driveA26Wrapped },
// Plan 02-04 Task 3 A27: STRICT multi-tab urls[] post DEC-011 Amendment 1.
// Opens 2 tabs sequentially + activates each + 11s settle + SAVE; host-side
// asserts meta.urls contains BOTH example.com + iana.org (length>=2
// REQUIRED; FAILS on length<2; no extension-origin sentinels; no
// chrome-internal URLs). Owns its SAVE dispatch (multi-tab tracker
// state needs both onActivated events to fire BEFORE the SAVE).
{ name: 'A27', drive: driveA27Wrapped },
// Plan 02-04 Task 3 A28: REQ-archive-layout strict 5-entry zip-layout.
// Chains off A27's zip (no new SAVE); host-side enumerates zip entries
// and asserts EXACTLY 5 paths: video/last_30sec.webm, rrweb/session.json,
// logs/events.json, screenshot.png, meta.json (set-equality; no extras).
{ name: 'A28', drive: driveA28Wrapped },
];
const buffers = { swConsole: handles.swConsole, offConsole: handles.offConsole };