fix(02): revise plans per checker (B1 + 4 flags) — add tabs permission for D-P2-02
- BLOCKER B1: add `tabs` to manifest.json permissions (DEC-011 Amendment 1 cites Phase 2 D-P2-02 meta.urls feature as justification). Honors D-P2-02 "all tabs visible" wording verbatim. Updates manifest-i18n test expected permission list lockstep. - F1: add A28 harness assertion for REQ-archive-layout strict zip-layout verification (5 entries, no extras). - F2: createArchive empty-tracker fallback removed; logs warn + sets urls:[] instead of fake [extension-origin URL]. 02-01 RED test pins empty-tracker → urls:[]. - F3: 02-02 Task 3 prose deliberation struck; typed `blob-url-mint-failed` throw is the resolved-only contract. - F4: 02-02 Task 3 verify block adds full-suite `npm test` after focused test runs. - A27 strict-mode (Plan 02-04): REQUIRES both URLs in meta.urls; FAILS on length < 2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,11 +25,11 @@ must_haves:
|
||||
truths:
|
||||
- "Three RED test files exist and fail under the current HEAD (cc042a5) with concrete failure messages, NOT timeouts or missing imports."
|
||||
- "blob-url-download.test.ts pins downloadArchive() calling chrome.downloads.download with url starting with 'blob:' (not 'data:application/zip;base64,')."
|
||||
- "meta-json-urls-schema.test.ts pins SessionMetadata.urls as string[] and createArchive emitting meta.json with urls (not url)."
|
||||
- "strict-meta-json-validation.test.ts pins ISO-8601 Z-suffix timestamp, non-empty urls[], semver extensionVersion, non-negative totalEvents, exactly 8 fields."
|
||||
- "meta-json-urls-schema.test.ts pins SessionMetadata.urls as string[], createArchive emitting meta.json with urls (not url), AND the F2-pinned empty-tracker contract (urls: [] for whole-desktop-no-tab sessions; NO sentinel fallback)."
|
||||
- "strict-meta-json-validation.test.ts pins ISO-8601 Z-suffix timestamp, urls is an Array of filter-matching URLs (empty PERMITTED per F2 resolution), semver extensionVersion, non-negative totalEvents, exactly 8 fields."
|
||||
- "All 3 files use Vitest describe+it patterns matching existing tests/background/*.test.ts conventions (vi.fn() chrome.* stubs; jsdom or node env per existing patterns)."
|
||||
- "Tier-1 FORBIDDEN_HOOK_STRINGS unit-test gate remains GREEN (12 entries unchanged — this plan adds no test-hook symbols)."
|
||||
- "153/153 baseline vitest count rises to 153 + N (where N = number of new it() blocks; expected ~10-14)."
|
||||
- "153/153 baseline vitest count rises to 153 + N (where N = number of new it() blocks; expected ~16 after F2 added Test 5 to meta-json-urls-schema.test.ts)."
|
||||
artifacts:
|
||||
- path: "tests/background/blob-url-download.test.ts"
|
||||
provides: "RED pin: downloadArchive calls chrome.downloads.download({ url: blob:..., filename })"
|
||||
@@ -229,8 +229,14 @@ Existing test conventions (read these for stub patterns):
|
||||
'chrome-extension://abc/popup.html'; assert `meta.urls` equals
|
||||
`['https://example.com', 'chrome-extension://abc/popup.html']` (per CONTEXT.md
|
||||
"URL filter" specifics block).
|
||||
- All 4 tests MUST fail under current HEAD: Test 1 via tsc compile failure (urls missing on type);
|
||||
Test 2 via `meta.url` present + `meta.urls` undefined; Test 3+4 via the tab-tracking module
|
||||
- Test 5 ("empty-tracker → meta.urls === []", per F2 plan-checker iteration 1):
|
||||
mock the tab-tracking source to return an EMPTY array (whole-desktop-no-tab session);
|
||||
invoke createArchive; assert `meta.urls` is EXACTLY `[]` (empty Array; not undefined; not
|
||||
`[extension-origin-URL]`; not `null`). This pins the F2 resolution: NO sentinel fallback.
|
||||
The empty array is the canonical representation of a whole-desktop recording with no browser
|
||||
tabs open at SAVE time.
|
||||
- All 5 tests MUST fail under current HEAD: Test 1 via tsc compile failure (urls missing on type);
|
||||
Test 2 via `meta.url` present + `meta.urls` undefined; Test 3+4+5 via the tab-tracking module
|
||||
not existing yet (these will throw import errors — acceptable as the RED signal).
|
||||
</behavior>
|
||||
<action>
|
||||
@@ -256,10 +262,10 @@ Existing test conventions (read these for stub patterns):
|
||||
<automated>npx vitest run tests/background/meta-json-urls-schema.test.ts 2>&1 | grep -E "(FAIL|RED|failed|TS\d+)" | head -10</automated>
|
||||
</verify>
|
||||
<done>
|
||||
File exists, 4 it() blocks under a single describe. Test 1 fails via tsc compile error on missing
|
||||
`urls` field. Tests 2-4 fail with assertion errors OR import errors (latter for the missing
|
||||
File exists, 5 it() blocks under a single describe. Test 1 fails via tsc compile error on missing
|
||||
`urls` field. Tests 2-5 fail with assertion errors OR import errors (latter for the missing
|
||||
tab-url-tracker module). NONE pass under current HEAD.
|
||||
Commit message: `test(02-01): RED — pin meta.json urls[] schema + dedup/filter semantics (D-P2-02)`.
|
||||
Commit message: `test(02-01): RED — pin meta.json urls[] schema + dedup/filter + empty-tracker semantics (D-P2-02 + F2)`.
|
||||
</done>
|
||||
</task>
|
||||
|
||||
@@ -270,14 +276,15 @@ Existing test conventions (read these for stub patterns):
|
||||
- Test 1 ("meta.json has exactly 8 fields"): Object.keys(meta).length === 8.
|
||||
- Test 2 ("timestamp is ISO-8601 with Z suffix"):
|
||||
`/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/.test(meta.timestamp)`.
|
||||
- Test 3 ("urls is a non-empty string[] of valid URLs"):
|
||||
`Array.isArray(meta.urls) && meta.urls.length >= 1 && meta.urls.every(u => /^(https?|chrome-extension):\/\//.test(u))`.
|
||||
Note: CONTEXT.md `<specifics>` allows empty urls[] for "purely whole-desktop recording without
|
||||
browser-tab interaction" — but D-P2-02 also says "the operator's primary tab at SAVE time should
|
||||
always be in the array if it has a valid URL", and CONTEXT.md `<decisions>` D-P2-03 mandates
|
||||
"urls array non-empty" as a schema validation rule. Resolve in favor of the strict-validation
|
||||
rule from D-P2-03 (non-empty required). Document the resolution inline in the test as a
|
||||
block comment citing both CONTEXT.md sources.
|
||||
- Test 3 ("urls is an Array of valid URLs; empty IS PERMITTED for whole-desktop sessions"):
|
||||
`Array.isArray(meta.urls) && meta.urls.every(u => /^(https?|chrome-extension):\/\//.test(u))`.
|
||||
Per F2 (plan-checker iteration 1 resolution): the empty-tracker case is MEANINGFUL (whole-desktop
|
||||
recording with no browser tabs open). The strict-validation rule from D-P2-03 ("urls array
|
||||
non-empty") is RELAXED to PERMIT empty arrays here; CONTEXT.md `<specifics>` permissive clause
|
||||
wins over the original D-P2-03 strict clause. Operator empirical workflow (Plan 02-04 Task 4
|
||||
Step 2) verifies the non-empty case via the multi-tab path. Document this resolution inline
|
||||
in the test as a block comment citing both CONTEXT.md sources AND the F2 plan-checker
|
||||
iteration 1 decision.
|
||||
- Test 4 ("extensionVersion matches semver"): `/^\d+\.\d+\.\d+$/.test(meta.extensionVersion)`.
|
||||
- Test 5 ("totalEvents is non-negative integer"):
|
||||
`Number.isInteger(meta.totalEvents) && meta.totalEvents >= 0`.
|
||||
@@ -347,9 +354,9 @@ Existing test conventions (read these for stub patterns):
|
||||
|
||||
<verification>
|
||||
- `npx vitest run tests/background/blob-url-download.test.ts` → 3 RED.
|
||||
- `npx vitest run tests/background/meta-json-urls-schema.test.ts` → 4 RED.
|
||||
- `npx vitest run tests/build/strict-meta-json-validation.test.ts` → 8 RED.
|
||||
- `npm test` → previously-153 GREEN + N RED (15 ± 1 RED from this plan). Acceptable window —
|
||||
- `npx vitest run tests/background/meta-json-urls-schema.test.ts` → 5 RED (includes F2 empty-tracker → urls:[] pin).
|
||||
- `npx vitest run tests/build/strict-meta-json-validation.test.ts` → 8 RED (Test 3 RELAXED to permit empty urls[]).
|
||||
- `npm test` → previously-153 GREEN + N RED (16 ± 1 RED from this plan). Acceptable window —
|
||||
Plans 02-02 + 02-03 close all RED before phase closure.
|
||||
- `grep -c '\.skip' tests/background/blob-url-download.test.ts tests/background/meta-json-urls-schema.test.ts tests/build/strict-meta-json-validation.test.ts` → 0.
|
||||
- Tier-1 grep gate: `npx vitest run tests/background/no-test-hooks-in-prod-bundle.test.ts` GREEN
|
||||
|
||||
Reference in New Issue
Block a user