Skip to content

Commit 48065c6

Browse files
committed
fix: keep host parity smoke source-contained
1 parent cd530aa commit 48065c6

1 file changed

Lines changed: 39 additions & 18 deletions

File tree

‎scripts/test-host-parity-remaining.js‎

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ const path = require('path')
1717
const { spawnSync } = require('child_process')
1818
const { adaptHostOutput, runHostAdapter } = require('../hooks/_runtime/lifecycle-host-adapters.cjs')
1919
const { buildLifecycleHookOutput } = require('../hooks/_runtime/lifecycle-hook-output.cjs')
20-
const { composeEntryCheckBlock } = require('./lib/host-parity-scorecard.js')
21-
const { evaluateGrokHostParity } = require('./lib/host-parity-scorecard.js')
20+
const {
21+
composeEntryCheckBlock,
22+
evaluateGrokHostParity,
23+
formatGrokTurnChecklistMarkdown
24+
} = require('./lib/host-parity-scorecard.js')
2225

2326
const hookOut = buildLifecycleHookOutput({ env: {}, enforcementMode: 'safety-only' })
2427

@@ -63,19 +66,33 @@ const codexOut = adaptHostOutput('codex', 'PreToolUse', {
6366
})
6467
assert.strictEqual(codexOut.hookSpecificOutput.permissionDecision, 'deny')
6568

66-
// Compose entry check + website page exists
69+
function readIfExists(file) {
70+
return fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : null
71+
}
72+
73+
// Compose entry check + HostParity public/source surface.
74+
// website/ is a maintainer-local optional doc site (see website/README.md);
75+
// clean GitHub Actions checkouts must validate source-contained semantics rather
76+
// than requiring untracked generated website docs to exist.
6777
const block = composeEntryCheckBlock({ project: 'demo', status: 'PASS' })
6878
assert.match(block, /### DevCodex · 入口检查/)
6979
const sitePage = path.join(__dirname, '../website/docs/intro/host-parity-grok.md')
70-
assert.ok(fs.existsSync(sitePage), 'website intro host-parity-grok.md must exist')
71-
const siteText = fs.readFileSync(sitePage, 'utf8')
72-
assert.match(siteText, /devcodex grok/)
73-
assert.match(siteText, /HostParity/)
74-
assert.match(siteText, /GrokTurnChecklist/)
75-
assert.match(siteText, /repairSteps/)
76-
assert.match(siteText, /Skill 强制包|Skill bundle|Intent → Skill/i)
77-
assert.match(siteText, /scan-hygiene|ttfv-first-delivery/)
78-
assert.match(siteText, /UnalignedLedger|U-A1|未对齐|cannotClaim/i)
80+
const siteText = readIfExists(sitePage)
81+
const checklistText = formatGrokTurnChecklistMarkdown()
82+
const hostParitySurface = siteText || checklistText
83+
assert.match(hostParitySurface, /HostParity|GrokTurnChecklist/)
84+
assert.match(hostParitySurface, /GrokTurnChecklist/)
85+
assert.match(hostParitySurface, /scan-hygiene|ttfv-first-delivery/)
86+
if (siteText) {
87+
assert.match(siteText, /devcodex grok/)
88+
assert.match(siteText, /repairSteps/)
89+
assert.match(siteText, /Skill 强制包|Skill bundle|Intent → Skill/i)
90+
assert.match(siteText, /UnalignedLedger|U-A1|未对齐|cannotClaim/i)
91+
} else {
92+
const websiteReadme = fs.readFileSync(path.join(__dirname, '../website/README.md'), 'utf8')
93+
assert.match(websiteReadme, /不进入公开 Git 默认跟踪/)
94+
assert.match(websiteReadme, /website 视为 optional/)
95+
}
7996
assert.ok(fs.existsSync(path.join(__dirname, 'fixtures/host-parity/unaligned-ledger.v1.json')))
8097

8198
// Platform request semantic fixture (source-contained for clean checkout / CI)
@@ -124,13 +141,17 @@ if (fs.existsSync(path.join(workspaceRoot, 'AGENTS.md'))) {
124141
assert.ok(['full-capable', 'partial'].includes(card.tier))
125142
}
126143

127-
// philosophy Auto honesty
144+
// Optional maintainer website surfaces.
128145
const philosophy = path.join(__dirname, '../website/docs/intro/philosophy.md')
129-
assert.match(fs.readFileSync(philosophy, 'utf8'), /宿主诚实分列(Auto)/)
130-
assert.match(fs.readFileSync(philosophy, 'utf8'), /Grok Build/)
146+
const philosophyText = readIfExists(philosophy)
147+
if (philosophyText) {
148+
assert.match(philosophyText, /宿主诚实分列(Auto)/)
149+
assert.match(philosophyText, /Grok Build/)
150+
}
131151

132-
// rspress sidebar link
133-
const rspress = fs.readFileSync(path.join(__dirname, '../website/rspress.config.ts'), 'utf8')
134-
assert.match(rspress, /host-parity-grok/)
152+
const rspress = readIfExists(path.join(__dirname, '../website/rspress.config.ts'))
153+
if (rspress) {
154+
assert.match(rspress, /host-parity-grok/)
155+
}
135156

136157
console.log('host parity remaining deliverables smoke passed')

0 commit comments

Comments
 (0)