Skip to content

refactor: rename workflow store surface#216

Merged
devkade merged 1 commit into
devfrom
refactor/issue-209-file-workflow-store
May 17, 2026
Merged

refactor: rename workflow store surface#216
devkade merged 1 commit into
devfrom
refactor/issue-209-file-workflow-store

Conversation

@devkade
Copy link
Copy Markdown
Owner

@devkade devkade commented May 17, 2026

Summary

  • Renames the application store port from KapiStore to WorkflowStore.
  • Renames the concrete file-backed implementation from FileKapiStore to FileWorkflowStore for source/runtime probe call sites.
  • Keeps a temporary FileKapiStore compatibility export so existing test/external imports continue to compile while follow-up slices remove remaining references.
  • Updates the product-name audit doc with the completed store-surface rename and remaining service/test compatibility work.

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 / FileKapiStore even 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

  1. Rename source and every test in one PR
    • Pros: removes all FileKapiStore references in one pass.
    • Cons: about 295 changed lines, likely over the review size gate.
  2. Rename only the source-facing store port and implementation, with a temporary compatibility export
    • Pros: small, reviewable, preserves compile/runtime compatibility, lets follow-up slices update tests/importers safely.
    • Cons: one intentional compatibility export remains until follow-up cleanup.
  3. Do nothing until KapiService is renamed
    • Pros: avoids compatibility aliasing.
    • Cons: leaves an easy, bounded store-surface cleanup blocked behind a larger service-class rename.

Selected 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.ts
    • Renamed the application persistence port from KapiStore to WorkflowStore.
  • src/adapters/file-store.ts
    • Renamed the concrete class from FileKapiStore to FileWorkflowStore.
    • Updated the implemented interface to WorkflowStore.
    • Added export { FileWorkflowStore as FileKapiStore }; as a temporary compatibility bridge.
  • src/application/workflow-service.ts
    • Updated constructor typing to depend on WorkflowStore.
  • src/adapters/workflow-service-factory.ts
    • Updated local service construction to instantiate FileWorkflowStore.
  • autoresearch.sh
    • Updated runtime probe imports and construction to use FileWorkflowStore.
  • docs/product-name-audit.md
    • Recorded the store-surface rename and noted that compatibility imports remain for follow-up slices.

Why 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:

rg -n 'FileKapiStore|\bKapiStore\b' src/application src/adapters autoresearch.sh docs/product-name-audit.md
src/adapters/file-store.ts:392:export { FileWorkflowStore as FileKapiStore };

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 full test/*.test.ts suite 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:

  • n/a — type/export rename slice covered by typecheck, full test-suite run, runtime-probe script import updates, and diff check.

Anomalies observed

Symptom Evidence Impact Action
Full mechanical test rename would exceed the size gate. Working-tree experiment showed ~295 changed lines when every FileKapiStore test import/use was renamed. Split required to keep reviewable PR size. This PR keeps a temporary alias; follow-up slices can migrate tests/importers and then remove it.
Package test script ignores targeted-looking file args and runs the full suite. npm test -- test/service-store... invoked tsx --test test/*.test.ts ...; 521 tests ran. Slower but stronger coverage. Reported here.
Test/check commands flipped src/cli/kapi-review-cli.ts executable bit locally. git status showed unrelated mode-only churn after verification. Would pollute the PR if staged. Reset mode to 100644 before commit.
quality:budgets still warns on code_smells=52. npm run quality:budgets output. Existing non-failing budget warning; unchanged by this slice. No action in this rename PR.

Risks / Follow-up

  • Remaining Remove remaining kapi identifiers from internal codebase #209 store cleanup: update test fixtures / any external compatibility importers from FileKapiStore to FileWorkflowStore, then remove the temporary alias.
  • Remaining larger source cluster: KapiService should be renamed separately to WorkflowService or equivalent with compatibility handling.
  • Existing persisted workflow IDs, slash commands, event names, external kapi-agent literals, and user-facing Kapi historical text remain intentionally unchanged.

kapi-agent review

  • Expected reviewer-only bot behavior: automatic formal review after PR open; if absent after a short wait, request with @kapi-agent review.
  • Merge gate: latest kapi-agent approval/check must apply to the current head before merge.
  • Re-review rule: after stale approval, REQUEST_CHANGES, or COMMENT, request re-review with a same-comment current-head revision explanation:
    • @kapi-agent review
    • Revision explanation for current head <HEAD_SHA>
    • What changed
    • Why this closes the prior feedback
    • Verification

@devkade
Copy link
Copy Markdown
Owner Author

devkade commented May 17, 2026

@kapi-agent review

Revision explanation for current head bc44c29048c94bd7d8e3fba981e5e647f5ae8598:

What changed:

  • Renamed the application persistence port from KapiStore to WorkflowStore.
  • Renamed source/runtime-probe use of the file-backed store from FileKapiStore to FileWorkflowStore.
  • Kept a temporary FileKapiStore compatibility export so existing test/external imports keep compiling while follow-up slices migrate them.
  • Updated the product-name audit doc with this partial store-surface cleanup and remaining compatibility follow-up.

Why this closes the prior feedback:

  • The source-facing store abstraction and local service factory now use semantic workflow names without changing persisted workflow state or runtime contracts.
  • The only source-area FileKapiStore residual is an explicit compatibility export, documented as follow-up work.
  • Changed-line size stays well below the kapi-agent budget: 27 changed lines.

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 521 tests / 510 pass / 11 skipped.
  • npm run quality:budgets — pass with existing non-failing code_smells=52 warning.
  • 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.

@devkade
Copy link
Copy Markdown
Owner Author

devkade commented May 17, 2026

@kapi-agent review

Revision explanation for current head bc44c29e40972bcaee195bad33116977031959ca:

What changed:

  • Renamed the application persistence port from KapiStore to WorkflowStore.
  • Renamed source/runtime-probe use of the file-backed store from FileKapiStore to FileWorkflowStore.
  • Kept a temporary FileKapiStore compatibility export so existing test/external imports keep compiling while follow-up slices migrate them.
  • Updated the product-name audit doc with this partial store-surface cleanup and remaining compatibility follow-up.

Why this closes the prior feedback:

  • The source-facing store abstraction and local service factory now use semantic workflow names without changing persisted workflow state or runtime contracts.
  • The only source-area FileKapiStore residual is an explicit compatibility export, documented as follow-up work.
  • Changed-line size stays well below the kapi-agent budget: 27 changed lines.

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 521 tests / 510 pass / 11 skipped.
  • npm run quality:budgets — pass with existing non-failing code_smells=52 warning.
  • 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.

Copy link
Copy Markdown

@kapi-agent kapi-agent Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: KapiStore renamed to WorkflowStore.
  • src/adapters/file-store.ts: FileKapiStore renamed to FileWorkflowStore, with a temporary compatibility export FileKapiStore.
  • src/application/workflow-service.ts: constructor dependency now uses WorkflowStore.
  • src/adapters/workflow-service-factory.ts and autoresearch.sh: runtime construction now uses FileWorkflowStore.
  • 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 verify exited 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 temporary FileKapiStore compatibility export should be removed in a follow-up once tests and any external importers migrate to FileWorkflowStore.
  • src/application/ports.ts: KapiStore itself 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 FileWorkflowStore before 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

Copy link
Copy Markdown

@kapi-agent kapi-agent Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: KapiStore is now WorkflowStore.
  • src/adapters/file-store.ts: concrete implementation is now FileWorkflowStore, with FileKapiStore retained as a temporary compatibility export.
  • src/application/workflow-service.ts: service constructor depends on WorkflowStore.
  • src/adapters/workflow-service-factory.ts and autoresearch.sh: runtime construction now uses FileWorkflowStore.
  • 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 verify exited 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, and docs/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 temporary FileKapiStore alias should be removed after tests and any external importers migrate to FileWorkflowStore.
  • Product-name cleanup remains incomplete by design: KapiService and persisted/external kapi-* contracts remain out of scope.

Suggestions

  • In a follow-up PR, migrate tests from FileKapiStore to FileWorkflowStore, then remove the compatibility export.
  • Consider a similarly bounded compatibility slice for KapiService once 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

@devkade devkade merged commit cd63c80 into dev May 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant