refactor: rename presentation workflow helpers#213
Conversation
|
@kapi-agent review Revision explanation for current head What changed:
Why this closes the prior feedback:
Verification:
|
There was a problem hiding this comment.
kapi-agent review
Verdict: APPROVE
Final approval summary
Review journey
This PR is a bounded refactor slice for issue #209. The semantic scope is limited to renaming generic internal presentation workflow/tool helper exports away from product-prefixed Kapi* names while preserving public compatibility surfaces such as tool names, labels, workflow IDs, and the kapi-agent integration. There is no prior kapi-agent review ping-pong on this PR.
What changed
The current revision updates:
src/presentation/tools.ts:KapiToolDefinition→WorkflowToolDefinitionsrc/presentation/hooks.ts:shouldBlockKapiToolCall→shouldBlockWorkflowToolCallsrc/presentation/ui.ts:formatKapiError→formatWorkflowError- Presentation imports/re-exports in
command-ui-actions.tsandtool-ui-actions.ts - Tests in
test/hook-policy.test.tsandtest/architecture.test.ts - Audit documentation in
docs/product-name-audit.md
Why this is correct
The change keeps runtime behavior intact: user-facing strings and external contracts still intentionally use Kapi names, while only internal generic helper identifiers are renamed. The new architecture guard prevents the old generic presentation helper names from re-entering src/presentation.
Evidence
Verifier gate: PASS. npm ci && npm run verify completed successfully.
Size gate: PASS. 41 changed lines, below the 200-line semantic review threshold.
Revision-explanation status: not required for this initial kapi-agent review, and explanation is present in the PR body.
Ilchul review harness gate: PASS with neutral/comment output and zero blocking findings.
I inspected the changed source, test, and audit paths and confirmed the rename is consistent.
Remaining risks and approval rationale
Remaining risk is low and limited to internal import churn. Larger product-prefixed exported names such as KapiService and related types remain intentionally out of scope for later slices. Approval is justified because the scope is narrow, tests and architecture guards pass, and no blocking correctness, safety, or workflow-contract issue remains.
Blocking issues
None.
Warnings / risks
src/presentation/ui.tsstill returns the user-facing message prefixKapi action failed:. This appears intentional because public/user-facing Kapi surfaces are explicitly preserved.- Broader product-name cleanup remains incomplete by design; future slices should continue to distinguish internal reusable identifiers from persisted/public contracts.
Suggestions
- In a later slice, consider adding similarly targeted architecture guards for the next planned internal identifiers once their compatibility boundary is decided.
Looks good
- The refactor is mechanically consistent across imports, exports, and call sites.
- The architecture test directly protects against regression of the renamed presentation helpers.
- Public tool names, event labels, workflow IDs, and integration names remain untouched, preserving artifact/workflow contract compatibility.
Verification notes
Verifier gate: PASS — npm ci && npm run verify exited 0.
Size gate: PASS — 41 changed lines, with low semantic risk.
Revision-explanation status: not required; found.
Ilchul harness: PASS — neutral/comment, zero blocking findings.
Engine: pi
Summary
Kapi*names.Linked issue
Refs #209
Problem
Issue #209 is removing historical
kapiproduct-name leakage from reusable internal code while preserving intentional public compatibility surfaces.After the service filename/factory slices, several generic presentation helpers still used product-prefixed internal names:
These helpers are not serialized workflow IDs, public command labels, or
kapi-agentintegration contracts. They are generic presentation/tool plumbing and should use semantic names.Options considered
Kapitext at once.Selected approach
Selected option 1.
This PR renames only generic internal presentation helper/type exports. It deliberately leaves public
Kapilabels,kapi_start_workflowtool names,kapi-workflowevent labels,/kapi-*workflow IDs,kapi-agent, andkapi-reviewuntouched.Implementation by file/surface
src/presentation/tools.tsKapiToolDefinition→WorkflowToolDefinition.formatWorkflowErrorfor tool error formatting.src/presentation/hooks.tsshouldBlockKapiToolCall→shouldBlockWorkflowToolCall.src/presentation/ui.tsformatKapiError→formatWorkflowError.src/presentation/tool-ui-actions.tsandsrc/presentation/command-ui-actions.tstest/hook-policy.test.tstest/architecture.test.tsdocs/product-name-audit.mdWhy this fixes it
The generic presentation helper exports no longer carry product-prefixed names. The architecture test now fails if
KapiToolDefinition,shouldBlockKapiToolCall, orformatKapiErrorre-enter presentation source.This is still a partial #209 slice, so this PR uses
Refs #209rather thanCloses #209.QA / Verification
npm test -- test/architecture.test.ts test/hook-policy.test.ts test/presentation-command-behavior.test.ts— pass; package script ran the full suite, 521 tests, 510 pass, 11 skipped.npm run check— pass.npm run check:unused— pass.npm run quality:budgets— pass with existing non-failingcode_smells=52warning.git diff --check— pass.Residual old helper-name scan:
Changed-line count:
Independent review:
Anomalies observed
npm test -- <files>runs the full suite because the package script istsx --test test/*.test.ts.src/cli/kapi-review-cli.tsexecutable-bit churn recurred during verification.Risks / Follow-up
KapiService,KapiStore,KapiRegistryEntry, andKapiAgentPrReviewStateremain for later Remove remaining kapi identifiers from internal codebase #209 slices.Kapiwhere they are compatibility or user-facing surfaces.kapi-review,kapi-agent,/kapi-*, and serializedkapi-*workflow IDs remain intentional compatibility/external integration surfaces.kapi-agent review
@kapi-agent review.REQUEST_CHANGES, orCOMMENT, request re-review with a same-comment current-head revision explanation.