refactor: rename adapter workflow helpers#223
Conversation
|
@kapi-agent review Head SHA: 7b535a9 What changed:
Why this closes prior feedback:
Verification:
Residual scan: |
There was a problem hiding this comment.
kapi-agent review
Verdict: APPROVE
Final approval summary
Review journey
The PR’s original goal is to continue issue #209 by removing product-prefixed internal helper names while preserving public and persisted Kapi contracts. The semantic scope is narrow: private adapter/domain helper renames plus an architecture regression guard and one audit-doc update. There was no prior kapi-agent feedback cycle for this PR, so no unresolved ping-pong items remain.
What changed
The PR renames internal helpers in:
src/adapters/file-store.tssrc/adapters/autoresearch-bridge.tssrc/adapters/worker-substrate.tssrc/domain/workflow-validation.tssrc/domain/run-contract-prompt-renderer.ts
It also adds a guard in test/architecture.test.ts and records the cleanup in docs/product-name-audit.md.
Why this is correct
The changed identifiers are private implementation helpers. The diffs preserve call sites and logic while replacing product-prefixed names with semantic workflow/state names. User-facing messages, persisted workflow IDs, tool names, slash commands, and external kapi-agent/kapi-review contracts remain unchanged, which matches the stated migration boundary.
Evidence
- Verifier gate: PASS.
- Size gate: PASS, 67 changed lines under the semantic review threshold.
- Revision-explanation status: not required; explanation present in PR body.
- Ilchul review harness: PASS as gate evidence, neutral/comment with no blocking findings.
- Verified evidence includes
npm ci && npm run verifypassing, including tests, type/check gates, unused checks, and quality budgets. - Inspected changed source, test, and audit-doc paths.
Remaining risks and approval rationale
Remaining risk is low and limited to missed internal naming cases outside this slice. The added architecture guard reduces regression risk for the renamed helper set. Approval is justified because the PR is bounded, behavior-preserving, verified, and does not alter public or persisted contracts.
Blocking issues
None.
Warnings / risks
test/architecture.test.tsguards a specific set of old helper names. Future product-name leakage outside that explicit regex will still need separate audit coverage.- Local review workspace showed an uncommitted executable-bit change on
src/cli/kapi-review-cli.ts, but it is not part of the PR head commit inspected here.
Suggestions
- As follow-up slices continue, consider keeping the audit guard list close to the latest residual scan so it remains easy to tell which product-name hits are intentionally public/persisted versus internal leakage.
Looks good
- The refactor is private identifier-only and preserves runtime behavior.
- Public Kapi contract text and external integration names are intentionally retained.
- The architecture test creates a concrete regression guard for the renamed adapter/domain helper surface.
docs/product-name-audit.mdis updated in the same change, keeping documentation aligned with implementation.
Verification notes
- Verifier gate status: PASS —
npm ci && npm run verifyexited 0. - Size gate status: PASS — 67 changed lines, below 200.
- Revision-explanation status: not required now; found in PR body.
- Ilchul harness gate: PASS — no blocking findings.
- PR evidence also reports targeted QA commands and
git diff --checkpassing.
Engine: pi
Summary
Linked issue
Refs #209
Problem
Issue #209 is removing reusable internal
kapiimplementation leakage while preserving public/persisted Kapi contracts. After the presentation-helper slice, remaining active code still had private helper names such asprepareWritableKapiFile,assertKapiAncestorsAreNotSymlinks,removeKapiOwnedSymlink,assertKapiOwnedBranchName,hasValidKapiBranchPrefix, andformatKapiRules.Options considered
Selected approach
Selected option 2. This PR changes only internal private helper identifiers and leaves user-facing text, slash commands, tool names, workflow IDs, and external integration names unchanged.
Implementation by file/surface
src/adapters/file-store.ts:prepareWritableStateFile,assertStateAncestorsAreNotSymlinks.src/adapters/autoresearch-bridge.ts:removeManagedSymlink,isManagedAutoresearchTarget.src/adapters/worker-substrate.ts:assertWorkflowOwnedBranchName.src/domain/workflow-validation.ts:hasValidWorkflowBranchPrefix.src/domain/run-contract-prompt-renderer.ts:formatWorkflowRules.test/architecture.test.ts: regression guard for the old helper names.docs/product-name-audit.md: records this cleanup slice.Why this fixes it
The renamed symbols were reusable internal helper concepts, not public compatibility surfaces. Semantic names keep the boundary explicit while preserving Kapi-labeled runtime/user contracts.
QA / Verification
npm test -- test/architecture.test.ts— pass; package script runs the fulltest/*.test.tssuite plus the requested file.npm run check— pass.npm run check:unused— pass.npm run quality:budgets— pass with existing non-failingcode_smells=52warning.git diff --check— pass.Anomalies observed
npm test -- test/architecture.test.tsruns the full suite because the package script expandstest/*.test.tsbefore the extra argument.src/cli/kapi-review-cli.tsexecutable mode; it was reset before commit.Risks / Follow-up
Kapi*/kapi*names while preserving documented public contracts.kapi-agent review expectations
kapi-agent/reviewsuccess are required before merge.