feat(core): pluggable zero-token verifiers for verifyTaskflow#84
feat(core): pluggable zero-token verifiers for verifyTaskflow#84hirisov wants to merge 1 commit into
Conversation
Add a verifier seam to the verify/compile layer so a host can register
domain-specific static checks that run alongside the built-in structural
detectors — same report, same Mermaid overlay, same runtime preflight.
- verifyTaskflow(flow, { verifiers }) — options-object 2nd arg. Built-in
detectors run first (unchanged), then each TaskflowVerifier against the same
sanitized flow, in registration order.
- New TaskflowVerifier interface + VerifierIssue; plugin issues are stamped
category "plugin" with source = verifier name. IssueCategory (closed union)
gains "plugin"; VerificationIssue gains optional source. Fail-closed: a
throwing or malformed verifier is normalized to one error/plugin issue and
the remaining verifiers still run.
- compileTaskflow forwards CompileOptions.verifiers, so plugin issues overlay
on the Mermaid diagram + report like built-ins.
- RuntimeDeps.verifiers flows into both imperative dynamic-subflow verify sites
(ctx_spawn, flow{def}) and the event-kernel inline-def site. A top-level
preflight in executeTaskflow blocks only on plugin error-severity issues —
built-in detectors stay advisory at the top level, so existing flows are
unaffected. Opt-in: hosts that register no verifiers get identical behavior.
Pure functions, zero new runtime dependencies. Programmatic API only — no
project-local discovery and no built-in shell-command lint (both deferred per heggria#82).
Refs heggria#82
|
Thanks for the focused implementation. The API direction matches the accepted v1 scope in #82, and I verified the PR at 54f8397. Local validation is healthy: typecheck passed, taskflow-core built successfully, the 12 new tests passed, the full suite passed 1954/1954 outside the filesystem sandbox, and git diff --check passed. I do not think this is ready to merge yet because the following runtime and boundary cases are not closed:
Non-blocking follow-ups: render VerificationIssue.source in human-readable compile/runtime diagnostics, and avoid running imperative inline-child verifiers twice. The GitHub Actions run is currently action_required with zero jobs, so CI still needs approval and a real green run after the fixes. Happy to re-review an update. |
Checklist
pnpm run typecheckpasses.pnpm testpasses for this change (see Tests — 5 pre-existing failures onmainare unrelated).git commit -s).Related issue
Closes #82
What changed
Implements the v1 scope accepted in #82: a pluggable, zero-token verifier seam on the existing verify/compile layer. A host registers domain-specific static checks that run alongside the built-in structural detectors — merged into the same
VerificationResult, the same compile Mermaid/report overlay, and the same runtime preflight.verifyTaskflow(flow, { verifiers })— extensible options shape. Built-in detectors run first (unchanged), then eachTaskflowVerifieragainst the same sanitized flow, in registration order.TaskflowVerifier({ name, verify }) +VerifierIssue. Plugin issues are stampedcategory: "plugin"withsource: <name>; the closedIssueCategoryunion gains"plugin"andVerificationIssuegains optionalsource. Verifiers can't impersonate built-in categories.error/pluginissue; the remaining verifiers still run.compileTaskflowforwardsCompileOptions.verifiers, so plugin issues overlay on the diagram + report like built-ins.RuntimeDeps.verifiersis threaded into every place verification already runs: both imperative dynamic-subflow sites (ctx_spawn, inlineflow{def}) and the event-kernel inline-def site. A top-level preflight inexecuteTaskflowblocks only on plugin error-severity issues — built-in detectors stay advisory at the top level, as before. Opt-in and behavior-preserving: hosts that register no verifiers get byte-for-byte identical behavior.Scope (per #82): programmatic Core API only — no project-local discovery, no built-in shell-command lint (both deferred). Pure functions; zero new runtime dependencies.
Tests
12 new tests in
packages/taskflow-core/test/verify-pluggable.test.ts: ordering, warning/error semantics, fail-closed (throwing + malformed), safeFlow sanitization, back-compat, compile Mermaid/report overlay, no-spend runtime blocking on both the imperative and event-kernel engines, and a regression test that the top-level gate keys offcategory === "plugin"(notsource).Test status: typecheck passes. The full
pnpm testsuite has 5 pre-existing failures onmain—CacheStore: clear,peek: is read-only,F8: saveFlow hint,findProjectFlowsDir: stops at home dir,first-run trace: sink built— all environment/flaky (filesystem + home-dir dependent; one flips pass/fail between runs) and present on the base branch. Verified by stashing the diff and re-running: this PR adds 0 new failures.Sign-off
Not DCO-signed; happy to amend with
git commit -sif required.Screenshots / TUI output
N/A — no TUI/render change.