issue-293: Extract buildGrillPrompt() and add the prompt-integration test #303
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!303
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-293/extract-buildgrillprompt-and-add-the-prompt-integr"
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?
293: Extract buildGrillPrompt() and add the prompt-integration test
Closes #293 — 293.
Generated in 5m 57s.
Review findings
Now let me apply the fixes. Starting with the README typecheck line (Medium 1):Now the type-consolidation fix (Medium 2) and moving the state→input mapping into
prompt.ts(Medium 3). Firstprompt.ts:Nowindex.ts— replace the duplicated type declarations with type-only imports and use the moved mapper:Now rewrite the test file to (a) reword the header comment and (b) cover the untested branches and the state→input seam:Now let's run the grillme tests and the documented typecheck:All 15 pass. Now the full project gate:Full suite green (1452 pass / 0 fail / 1 unrelated skip). Let me verify the module graph and review the full diff:All gates pass and the module graph loads cleanly. Here are the annotated findings.Review Findings — 293
Summary
Fixed all Medium findings and the Low documentation/comment finding. In
extensions/grillme/README.md, the typecheck module inventory now includesprompt.ts. Inextensions/grillme/prompt.ts, the duplicatedGrillPrompt*unions are now the single source of truth —index.tsdrops its localIntent/ResearchMode/GrillPhase/GrillAlternativedeclarations in favour of type-only aliased imports. The state→prompt mapper moved intoprompt.tsastoGrillPromptInput()(called byindex.ts), andprompt.test.tsnow covers the phase branches (interview/output-selection/output), all three research modes, the output-preference fallback, and the state→input seam. Theprompt.test.tsheader comment was reworded to describe the real invariant. Gates:node --test extensions/grillme/*.test.tspassed (450 pass / 0 fail),npm testpassed (1452 pass / 0 fail / 1 unrelated skip), and the documentedtsc --noEmit … index.ts bash-filter.ts prompt.ts ste-style.ts widget.tstypecheck passed. Left unresolved: theAGENTS.md:26commit-message finding, which is an MR-creation-time action and cannot be fixed without committing/amending, which this stage forbids.Critical
High
Medium
extensions/grillme/README.md:90— the documented typecheck line enumerates the extension's modules (index.ts bash-filter.ts ste-style.ts widget.ts) and now omits the newprompt.ts, so the enumeration no longer matches the module set. This is the exact line PR #301 (issue 291) updated whenste-style.tswas added, and the pipeline's docs-sync scope (pilotpathsREADME.md,docs/**/*.md) does not coverextensions/grillme/README.md, so nothing downstream will fix it. Impact is documentation-only (tsc checksprompt.tstransitively viaindex.ts— verified), but the list is the module inventory. Suggested fix:--allowImportingTsExtensions index.ts bash-filter.ts prompt.ts ste-style.ts widget.ts.extensions/grillme/prompt.ts:16(withextensions/grillme/index.ts:18-22) —GrillPromptIntent/GrillPromptResearchMode/GrillPromptPhase/GrillPromptAlternativeare declared a second time, copied fromindex.ts'sIntent/ResearchMode/GrillPhase/GrillAlternativewith comments that say only "Matches the … inindex.ts" — two sources of truth for the same unions, with the prompt module unable to be the authority. Verified behaviour:tsccatches a divergence (Type 'Intent' is not assignable to type 'GrillPromptIntent') whenIntentis widened, butnode --test/type-stripping does not, andnpm testis the only configured gate — so drift is silently loadable. Suggested fix: makeprompt.tsauthoritative and delete the local declarations inindex.ts, e.g.import type { GrillPromptIntent as Intent, GrillPromptResearchMode as ResearchMode, GrillPromptPhase as GrillPhase, GrillPromptAlternative } from "./prompt.ts";(type-only import, soindex.tsstill owns runtime behaviour), or move the shared unions intoprompt.ts-exported aliases thatindex.tsre-uses forGrillState.extensions/grillme/prompt.ts:114— the extracted template is now testable but only two of its substitutions are asserted.outputPhaseGuidance()'s three branches are untested (theoutputbranch carries the "ask the user instead of bypassing or faking success" rule plusGITHUB_REPO_PERMISSION_GUIDANCE, theoutput-selectionbranch carries the mandatory-phase rule), as areRESEARCH_GUIDANCE[input.researchMode]and thedescribeOutputPreference()fallback; theindex.tsseam is untested too, becausetoPromptInput()(index.ts:78) hand-copies the 9-field mapping thatinterviewSample()mirrors by hand, so a swapped field would not fail any test. Suggested fix: add cases toprompt.test.tsforphase: "output"(assertGITHUB_REPO_PERMISSION_GUIDANCEandgrill_finish_output_phase),phase: "output-selection",phase: "interview", each of the threeresearchModestrings, and an empty/whitespaceoutputPreference(assert the "(none set; …)" text); and movetoPromptInput()intoprompt.ts(e.g.toGrillPromptInput(state)) so the state→prompt mapping is covered rather than re-typed in the test fixture.Low
extensions/grillme/prompt.test.ts:5— the header comment justifies the extraction with "importing it would pull in pi and TypeBox, whichnode --testdoes not have", but both peers resolve in this checkout (node_modules/@earendil-works/pi-coding-agent,node_modules/typebox, also underextensions/grillme/node_modules—node -e "await import('./extensions/grillme/index.ts')"loads fine from the repo root), andnode --testwould too. The real, verified invariant is the dependency-free import chain (prompt.ts→ste-style.ts, so the suite runs with nonode_modules— re-checked in a copy with none present). Suggested fix: reword to "the handler is not exported, and importingindex.tswould couple the suite to pi and TypeBox; the builder is extracted so the prompt can be asserted without those imports" and keep the "runs with nonode_modules" claim on the dependency-free chain alone.AGENTS.md:26— the branch commit is6b081d5 293: Extract buildGrillPrompt() and add the prompt-integration test, but the repo convention forfeature/bug/enhancementisissue-<N>: <summary>(issue-293: …); the merged squash commit and PR title from the previous two changes in this series areissue-292: …/issue-291: …. Suggested fix: useissue-293: <summary>for the commit/MR title at MR-creation time (Closes #293in the body); no source change is needed.Documentation
Updated files: