issue-292: Add ste-style.test.ts checks for the rule text and the block content #302
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!302
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-292/add-ste-style-test-ts-checks-for-the-rule-text-and"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
292: Add ste-style.test.ts checks for the rule text and the block content
Closes #292 — 292.
Generated in 7m 35s.
Review findings
Let me look at the project config and other tests to understand commands and conventions.Now let me apply the fixes. First,
ste-style.ts— export the block literals and exemption scope so the rule-text checks can reach them.Now the test file. First batch — imports, constants, and the derived guidance set.I'll simplify: keepste-style.tsunchanged and derive the scanned strings from the built block, which avoids new exports. Let me revert my source edit.Now let me run the targeted test, then the project's test gate.The derived scan now reachesEverything(ends ining), a legitimate pronoun. Add it to the allowlist.All pass. Let me verify the new checks actually catch the regressions the reviewer reported, using temporary mutation probes.All probes confirm the fixes. Now the full project gate.Full suite green (1437 pass / 1 skipped / 0 fail). Let me review the final diff.The diff is clean. Let me run the manual typecheck the reviewer used, to confirm no new type errors.All gates pass and the mutations confirm each fix. Here is the annotated findings document.Review Findings — 292
Summary
Remediated 8 of 9 findings in a single pass.
npm testat the repo root → 1437 pass / 1 skipped / 0 fail (16 tests inste-style.test.ts). A manualtsc --strict --noEmit --target es2022 --module nodenextonste-style.ts+ste-style.test.ts(package-local TS 7.0.2) reports only the environmentalTS2591missing@types/nodeerrors, with no type errors in the new code. Mutation probes in/tmpconfirmed each fix now fails on the regression it targets: a 30-word literal added to the block,"Rules (STE-compliant):", a sentence-initialE.g., a rule-1 limit rewrite, and a banned-pair co-occurrence with no adjacency.GUIDANCE_STRINGSis now derived frombuildSteStyleBlock()itself (fence lines dropped,-bullets stripped), so the block literals andSTE_EXEMPTION_SCOPEare all scanned. Widening the scan flagged the legitimate pronounEverythingas an-ingform; it joined the allowlist./ste[\s_-]{0,3}compliant/i, and the banned-pair scan runs overBANNED_PHRASE_SOURCES(every guidance line plus the built block).[\s\S]{0,10}), driven byescapeRegExp, rather than whole-corpus co-occurrence.SENTENCE_WORD_LIMIT.STE_STANDARD_URLassertion and constant..!?followed by whitespace).probing) — The allowlist comment now namesprobingas a deliberate exception.a77c773message cannot be changed; the pipeline owns the PR title/body form.Critical
(no findings)
High
(no findings)
Medium
GUIDANCE_STRINGSscans only exported constants (rules, exemptions, self-check), so prose that reaches the injected block from other sources escapes every rule-text check:STE_EXEMPTION_SCOPE(ste-style.ts:44) and the block's own literals ("Write every reply in this style.","Rules:","Exempt from the rules:"atste-style.ts:64,66,69). Verified: inserting a 30-word literal atste-style.ts:64keeps all 15 tests green. Suggested fix: build the scanned set frombuildSteStyleBlock()(strip fence,-bullets and the two label lines) or export the block literals plusSTE_EXEMPTION_SCOPEand append them toGUIDANCE_STRINGSwith an explicitkind, so every string the model receives is length-checked./ste compliant/imisses hyphen/underscore forms, andBANNED_PHRASE_PAIRS(line 91) is only run overAUTHORED_GUIDANCE_TEXT(constants), never over the built block, so a compliance claim held in a block literal passes every check. Verified:"Rules (STE-compliant):"→ 0 failures. Suggested fix: assertassert.doesNotMatch(block, /ste[\s_-]{0,3}compliant/i)and run the banned-pair scan overbuildSteStyleBlock()as well.text.includes(abbreviation)), so a sentence-initialE.g./I.e./Cf.passes the guard whilesplitIntoSentences(line 110) still splits on it, which is exactly the false-negative the guard exists to prevent. Verified: one 27-word sentence containingE.g.splits into 14 + 13 words and passes the 20-word limit check. Suggested fix: compare case-insensitively (text.toLowerCase().includes(abbreviation)), or makesplitIntoSentencesskip the entries inSENTENCE_ABBREVIATIONSand drop the guard.Low
["style", "reply"]reds the suite although those words are never adjacent, and a pair split across two different constants still "matches". Suggested fix: match adjacency with a bounded separator, e.g.new RegExp(\${escape(first)}[\s\S]{0,10}${escape(second)}`)`, or rename the constant and its comment to "co-occurring phrases".SENTENCE_WORD_LIMIThand-duplicates the 20/25 stated in rule category 1, so the enforced limit and the stated limit can drift silently. Verified: rewriting rule 1 to "about 40/50 words or fewer" leaves all tests green. Suggested fix: assert rule 1 names the constants (assert.ok(STE_RULE_CATEGORIES[0].includes(\about ${SENTENCE_WORD_LIMIT.instruction} words`))`), or parse the numbers out of rule 1.block.includes(STE_STANDARD_URL)is subsumed by the credit-line assertion on the line above:STE_CREDITalready contains the URL and is pinned verbatim at line 142, so this assertion cannot fail on its own and adds no coverage. Suggested fix: delete it, or make it independent by asserting the URL appears outside the credit string..!?; a URL's trailing dot followed by a space does split (as it does inSTE_CREDIT). Suggested fix: reword to state the actual mechanism (.!?followed by whitespace) so a future editor does not "fix" the splitter for the wrong reason.-ingverb form that rule 5 forbids", butprobingin "Probing questions" (ste-style.ts:30) is a participle, the form rule 5 names. Suggested fix: reword the exemption to a non--ingphrasing (e.g. "Questions that probe…"), or state in the comment that this is a deliberate exception rather than a noun.a77c773) — the commit message is292: Add ste-style.test.ts checks …, but AGENTS.md requiresissue-<N>: <summary>forfeature/bug/enhancementwork. Suggested fix: keep the PR title/body in the requiredissue-292: …/Closes #292form (and useissue-292: …for any commit still amendable).Documentation
Updated files: