refactor: rename workflow store surface#216
Conversation
|
@kapi-agent review Revision explanation for current head What changed:
Why this closes the prior feedback:
Verification:
|
|
@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’s original goal is a bounded refactor for issue #209: rename the workflow persistence store surface away from product-prefixed KapiStore / FileKapiStore naming. The semantic scope is narrow: application port naming, file-backed store class naming, factory/runtime-probe call sites, and the product-name audit doc. There was no prior kapi-agent review on this head, so no fix ping-pong was required.
What changed
src/application/ports.ts:KapiStorerenamed toWorkflowStore.src/adapters/file-store.ts:FileKapiStorerenamed toFileWorkflowStore, with a temporary compatibility exportFileKapiStore.src/application/workflow-service.ts: constructor dependency now usesWorkflowStore.src/adapters/workflow-service-factory.tsandautoresearch.sh: runtime construction now usesFileWorkflowStore.docs/product-name-audit.md: records the completed store-surface rename and remaining service-name follow-up.
Why this is correct
The implementation changes are type-only / symbol-name refactors around the same concrete behavior. The compatibility export preserves the existing FileKapiStore test/import surface while allowing new source-facing code to use the semantic FileWorkflowStore name. I did not see behavior changes to persistence paths, artifact safety checks, workflow state format, or runtime contracts.
Evidence
- Verifier gate: PASS —
npm ci && npm run verifyexited 0. - Size gate: PASS — 27 changed lines, under the 200-line semantic review threshold.
- Revision-explanation status: not required; found anyway.
- Ilchul harness gate: PASS — neutral/comment result, 0 blocking findings.
- Inspected committed diff for the changed source, runtime probe, and audit doc paths.
Remaining risks and approval rationale
Remaining risk is limited to the intentional temporary compatibility alias and the follow-up need to migrate tests/importers off FileKapiStore. That risk is documented and does not block this PR because the alias keeps current imports compiling and the verifier passed. Approval is justified because the scope is narrow, behavior-preserving, documented, and covered by the project verification gate.
Blocking issues
None.
Warnings / risks
src/adapters/file-store.ts: the temporaryFileKapiStorecompatibility export should be removed in a follow-up once tests and any external importers migrate toFileWorkflowStore.src/application/ports.ts:KapiStoreitself does not have a compatibility type alias. Given this is a private package and no remaining in-repo references exist, this is acceptable for this slice.
Suggestions
- In the cleanup follow-up, migrate test imports to
FileWorkflowStorebefore removing the alias to keep the final diff mechanical and easy to review.
Looks good
- The source-facing factory and runtime probe paths now instantiate
FileWorkflowStore. - The compatibility bridge is explicit rather than hidden.
- The audit doc accurately records both the completed rename and the remaining service-name work.
- No storage format, path safety, or artifact workflow semantics appear to change.
Verification notes
Verifier gate status: PASS — npm ci && npm run verify exited 0.
Size gate status: PASS — 27 changed lines < 200.
Revision-explanation status: not required; found.
Ilchul harness: PASS with 0 blocking findings.
Engine: pi
There was a problem hiding this comment.
kapi-agent review
Verdict: APPROVE
Final approval summary
Review journey
This PR’s goal is a bounded refactor for issue #209: move the workflow persistence store naming away from product-prefixed KapiStore / FileKapiStore. The semantic scope is narrow: application port naming, file-backed store class naming, runtime/factory construction sites, and the product-name audit doc. Prior kapi-agent approval already exists for this same head, and the revision explanation is present.
What changed
src/application/ports.ts:KapiStoreis nowWorkflowStore.src/adapters/file-store.ts: concrete implementation is nowFileWorkflowStore, withFileKapiStoreretained as a temporary compatibility export.src/application/workflow-service.ts: service constructor depends onWorkflowStore.src/adapters/workflow-service-factory.tsandautoresearch.sh: runtime construction now usesFileWorkflowStore.docs/product-name-audit.md: documents the completed store-surface rename and remaining follow-up.
Why this is correct
This is a symbol/name refactor around the same persistence behavior. The compatibility export preserves existing test and external imports, so the PR does not create a breaking API cliff while source-facing runtime construction moves to semantic workflow terminology. No persisted paths, workflow IDs, artifact names, state schema, or external command contracts are changed.
Evidence
- Verifier gate: PASS —
npm ci && npm run verifyexited 0. - Size gate: PASS — 27 changed lines, below the semantic review threshold.
- Revision-explanation status: not required for this re-review, but found.
- Ilchul harness gate: PASS — neutral/comment result with zero blocking findings.
- Inspected files:
src/application/ports.ts,src/application/workflow-service.ts,src/adapters/file-store.ts,src/adapters/workflow-service-factory.ts,autoresearch.sh, anddocs/product-name-audit.md.
Remaining risks and approval rationale
Remaining risk is intentionally limited to the temporary FileKapiStore compatibility export and test/importer migration follow-up. That risk is documented and non-blocking because it preserves compatibility while narrowing the source-facing product-name surface. Approval is justified because the behavior is unchanged, verification passes, and no blocking correctness, safety, workflow-contract, or maintainability issue remains.
Blocking issues
None.
Warnings / risks
src/adapters/file-store.ts: the temporaryFileKapiStorealias should be removed after tests and any external importers migrate toFileWorkflowStore.- Product-name cleanup remains incomplete by design:
KapiServiceand persisted/externalkapi-*contracts remain out of scope.
Suggestions
- In a follow-up PR, migrate tests from
FileKapiStoretoFileWorkflowStore, then remove the compatibility export. - Consider a similarly bounded compatibility slice for
KapiServiceonce the store rename has landed.
Looks good
- The refactor keeps runtime behavior and persisted workflow contracts stable.
- Source-facing factory and runtime probes now construct
FileWorkflowStore. - Documentation clearly records the remaining compatibility surface and follow-up direction.
Verification notes
Verifier gate status: PASS — npm ci && npm run verify exited 0.
Size gate status: PASS — 27 changed lines, below 200.
Revision-explanation status: not required now, found.
Ilchul review harness: PASS with zero blocking findings.
Engine: pi
Summary
KapiStoretoWorkflowStore.FileKapiStoretoFileWorkflowStorefor source/runtime probe call sites.FileKapiStorecompatibility export so existing test/external imports continue to compile while follow-up slices remove remaining references.Linked issue
Refs #209
Problem
Issue #209 is removing reusable internal product-prefixed identifiers after the Ilchul/runtime naming direction changed. After the registry-entry rename, the storage abstraction still exposed
KapiStore/FileKapiStoreeven though it represents a generic workflow persistence port and file-backed workflow-state store.A full mechanical replacement across every test fixture would exceed the kapi-agent changed-line budget for one slice. This PR therefore removes the product-prefixed store names from the source-facing service/factory/runtime-probe path first while preserving a temporary compatibility export for remaining tests and any out-of-tree importers.
Options considered
FileKapiStorereferences in one pass.KapiServiceis renamedSelected approach
Selected option 2.
This keeps the PR small and under the size gate while moving the actual source implementation and application port to semantic workflow names. The compatibility export is explicit and documented as temporary follow-up work rather than silently leaving source call sites product-prefixed.
Implementation by file/surface
src/application/ports.tsKapiStoretoWorkflowStore.src/adapters/file-store.tsFileKapiStoretoFileWorkflowStore.WorkflowStore.export { FileWorkflowStore as FileKapiStore };as a temporary compatibility bridge.src/application/workflow-service.tsWorkflowStore.src/adapters/workflow-service-factory.tsFileWorkflowStore.autoresearch.shFileWorkflowStore.docs/product-name-audit.mdWhy this fixes it
The generic workflow persistence port and concrete file store are no longer named after Kapi in the source-facing implementation path. New source code now imports/constructs
WorkflowStore/FileWorkflowStore, while the temporary alias avoids breaking existing test fixtures in the same PR.Residual scan for the source-facing area:
Changed-line size: 27 total changed lines (
15 insertions + 12 deletions).QA / Verification
npm run check— pass.npm run check:unused— pass.npm test -- test/service-store.test.ts test/active-pointer-safety.test.ts test/artifact-metadata.test.ts test/autoresearch-bridge.test.ts test/context-artifact-persistence.test.ts test/worker-dispatch-guard.test.ts— pass; package script ran the fulltest/*.test.tssuite plus repeated args: 521 tests, 510 pass, 11 skipped.npm run quality:budgets— pass with existing non-failing warning:code_smells=52.git diff --check— pass.rg -n 'FileKapiStore|\bKapiStore\b' src/application src/adapters autoresearch.sh docs/product-name-audit.md— only intentional temporary compatibility export remains.Manual smoke, if applicable:
Anomalies observed
FileKapiStoretest import/use was renamed.npm test -- test/service-store...invokedtsx --test test/*.test.ts ...; 521 tests ran.src/cli/kapi-review-cli.tsexecutable bit locally.git statusshowed unrelated mode-only churn after verification.100644before commit.quality:budgetsstill warns oncode_smells=52.npm run quality:budgetsoutput.Risks / Follow-up
FileKapiStoretoFileWorkflowStore, then remove the temporary alias.KapiServiceshould be renamed separately toWorkflowServiceor equivalent with compatibility handling.kapi-agentliterals, and user-facing Kapi historical text remain intentionally unchanged.kapi-agent review
@kapi-agent review.REQUEST_CHANGES, orCOMMENT, request re-review with a same-comment current-head revision explanation:@kapi-agent reviewRevision explanation for current head <HEAD_SHA>What changedWhy this closes the prior feedbackVerification