3.4 KiB
Task 2 Report: Reuse shared PageHeader on G03
Status
Complete. Commit: 9362c47 (refactor: reuse shared header on G03).
Changed files
pages/genealogy/g03-create-genealogy.vuetests/g03-visual-states-contract.ps1tests/g03-create-flow-contract.ps1tests/g03-document-flow-contract.ps1
RED
Command:
& powershell -ExecutionPolicy Bypass -File tests/g03-visual-states-contract.ps1
& powershell -ExecutionPolicy Bypass -File tests/g03-create-flow-contract.ps1
& powershell -ExecutionPolicy Bypass -File tests/g03-document-flow-contract.ps1
Exit code: 1.
Failure evidence:
G03 must use PageHeader with its dynamic title and custom back handlerMissing G03 flow contract: import PageHeader from "@/components/PageHeader.vue";G03 must not retain private header token: flow-header
GREEN
Command:
& powershell -ExecutionPolicy Bypass -File tests/g03-visual-states-contract.ps1
& powershell -ExecutionPolicy Bypass -File tests/g03-create-flow-contract.ps1
& powershell -ExecutionPolicy Bypass -File tests/g03-document-flow-contract.ps1
git diff --check
Result: exit code 0; all three focused contracts emitted PASS, and git diff --check exited cleanly. Git emitted only LF-to-CRLF informational warnings for the four changed files.
Self-review
- Replaced only the private G03 header with
PageHeader, using the required dynamic title,custom-back, and existinggoBackhandler. - Added the single shared-header import.
- Removed all six specified private header style groups and the obsolete header asset reference.
- Preserved G03 forms, dialogs, actions, backgrounds, data, and the existing two-step
goBack()branching unchanged. - Updated contracts to require the shared header and reject private header tokens.
Concerns
- The known App-Plus
step=ancestorroute-parameter issue was deliberately not modified, as required. - No remaining task-specific concern.
Follow-up: strict dynamic-title quotes
Fixed tests/g03-visual-states-contract.ps1 so its PageHeader title regex requires the Vue expression's internal single quotes. In the PowerShell single-quoted pattern, each required single quote is written as ''.
Regression commands:
# RED: old pattern incorrectly matched a candidate with double-quoted internal titles.
$ErrorActionPreference = 'Stop'; $pattern = '(?s)<PageHeader\s+:title="isAncestorStep \? .\u5F55\u5165\u9996\u4EE3\u4EBA\u7269. : .\u521B\u5EFA\u5BB6\u8C31."\s+custom-back\s+@back="goBack"\s*/>'; $title1 = -join [char[]]@(0x5F55, 0x5165, 0x9996, 0x4EE3, 0x4EBA, 0x7269); $title2 = -join [char[]]@(0x521B, 0x5EFA, 0x5BB6, 0x8C31); $invalid = '<PageHeader :title="isAncestorStep ? "' + $title1 + '" : "' + $title2 + '"" custom-back @back="goBack" />'; if ($invalid -match $pattern) { throw 'Dynamic-title regex incorrectly matches double-quoted internal titles' }
# GREEN and focused verification
& powershell -ExecutionPolicy Bypass -File tests/g03-visual-states-contract.ps1
& powershell -ExecutionPolicy Bypass -File tests/g03-create-flow-contract.ps1
& powershell -ExecutionPolicy Bypass -File tests/g03-document-flow-contract.ps1
git diff --check
Output summary: the RED probe failed with Dynamic-title regex incorrectly matches double-quoted internal titles; after the fix, the strict-quote probe and all three G03 contracts emitted PASS, and git diff --check exited 0.
Commit: a0d19f4 (test: tighten G03 shared header contract).