Skip to content

refactor(core): executor reads verification from CompiledStep, not the spec#84

Merged
SingleSourceStudios merged 1 commit into
mainfrom
refactor/executor-consumes-compiled-verification
May 27, 2026
Merged

refactor(core): executor reads verification from CompiledStep, not the spec#84
SingleSourceStudios merged 1 commit into
mainfrom
refactor/executor-consumes-compiled-verification

Conversation

@SingleSourceStudios
Copy link
Copy Markdown
Collaborator

@SingleSourceStudios SingleSourceStudios commented May 27, 2026

Closes #73.

Summary

The dry-run executor (packages/core/executor.ts) read each step's verification from the un-compiled spec (spec.steps[name].verification) when building per-step quality-gate definitions, even though #64 added CompiledStep.verification (CompiledVerification | null) to the compiled artifact for exactly this purpose. This is the consumer-side counterpart to #64: the runtime now reads the compiled artifact and no longer reaches back into the source spec.

  • Switch the read to compiledStep.verification, which is already in scope at the call site (dryRun compiles the spec and holds the CompiledStep). The compiler maps on_fail_message -> message, so behaviour is identical: same check expression, same failure message.
  • No signature or plumbing change was needed.

Data-flow finding

The executor already had the CompiledStep in scope at the read site (executor.ts:226), so this is a local read switch, not a plumbing change.

Scope

packages/core only (executor.ts + tests). The LangGraph adapter and all executionPlan consumption are untouched (that is #75).

Tests

  • Parametrised characterization across all five OnFailAction values plus the absent case, pinning that an authored verification surfaces its message as a quality-gate result and is preserved through the source switch.
  • A loop-closing test (executor.verification-source.test.ts) wraps compileWorkflow to attach a verification to the compiled step while the source spec carries none, proving the executor reads the compiled artifact and no longer the spec. Verified RED before the fix.

Test Plan

  • npm run build:core && npm run build
  • npm test (489 passed)
  • npm run typecheck
  • npm run lint (no new errors; 5 pre-existing out-of-scope errors unchanged)
  • node spec/fixtures/run-fixtures.mjs (29 passed)

🤖 Generated with Claude Code


Summary by cubic

Switches the dry-run executor to read step verification from the compiled artifact (CompiledStep.verification) instead of the source spec. This keeps quality-gate behavior the same while removing runtime dependence on the authoring spec.

  • Refactors
    • Read from compiledStep.verification (not spec.steps[name].verification); preserves check and message (on_fail_message -> message).
    • No API or plumbing changes; localized to packages/core/executor.ts.

Written for commit 05c1028. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

  • Tests

    • Added test suite validating step verification results surface in dry-run quality-gate entries
    • Added test ensuring verification is sourced from compiled workflow artifact
  • Bug Fixes

    • Fixed dry-run quality-gate construction to source verification from compiled workflow instead of uncompiled source

Review Change Stack

…e spec

#64 added CompiledStep.verification (CompiledVerification | null) so recovery
semantics survive compilation, but the dry-run executor still reached into
spec.steps[name].verification when building the per-step quality-gate
definitions. That left the runtime depending on the un-compiled spec for a
value the compiled artifact already carries.

Switch the read to compiledStep.verification, which is already in scope at the
call site (the executor compiles the spec and holds the CompiledStep). The
compiler maps on_fail_message -> message, so behaviour is identical: same check
expression, same failure message in the gate result. No signature or plumbing
change was needed.

Tests: parametrised characterization across all five OnFailAction values plus
the absent case, pinning that an authored verification surfaces its message as a
quality-gate result and is preserved through the source switch. A loop-closing
test wraps compileWorkflow to attach a verification to the compiled step while
the source spec carries none, proving the executor reads the compiled artifact
and no longer the spec.

Scope is the verification read only; executionPlan consumption is #75.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57badc8a-1af9-4787-80fb-27badc0adbf1

📥 Commits

Reviewing files that changed from the base of the PR and between 04c6a5c and 05c1028.

📒 Files selected for processing (3)
  • packages/core/executor.test.ts
  • packages/core/executor.ts
  • packages/core/executor.verification-source.test.ts

📝 Walkthrough

Walkthrough

The executor now reads step verification metadata from the compiled workflow artifact (compiledStep.verification) rather than the uncompiled source spec. Quality-gate definitions use the compiled artifact's message field to populate gate results, validated by tests covering all OnFailAction values and empty verification cases.

Changes

Compiled Verification Integration

Layer / File(s) Summary
Compiled verification source in executor and contract test
packages/core/executor.ts, packages/core/executor.verification-source.test.ts
Executor's dry-run quality-gate construction now reads compiledStep.verification instead of originalStep.verification. Quality gates use the compiled artifact's message field. New test mocks the compiler to inject verification into compiled steps and validates the executor surfaces that compiled message in quality-gate results.
Quality-gate behavior across OnFailAction values
packages/core/executor.test.ts
Import OnFailAction type and add parameterized tests that verify the verification failure message appears in qualityGateResults for each OnFailAction value (retry, escalate, skip, abort, revise). Also test that zero quality-gate results are produced when a step carries no verification.

Possibly Related PRs

  • SingularityAI-Dev/logic-md#71: Companion compiler change that preserves verification.on_fail into CompiledStep.verification, enabling the executor to read the complete verification metadata from the compiled artifact.

Poem

A rabbit hops through compiled dreams,
Where verification once read old seams;
Now gates are built from artifact's truth,
No backward glances—clean proof!
One source of wisdom, pure and bright. 🐰✨

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main refactoring: switching the executor to read verification from CompiledStep instead of the spec.
Description check ✅ Passed The description fully covers the PR objectives, implementation details, scope, testing approach, and test results against the provided template.
Linked Issues check ✅ Passed All coding requirements from #73 are met: executor now reads CompiledStep.verification instead of spec.steps[name].verification, behavior is preserved, and no plumbing changes were needed.
Out of Scope Changes check ✅ Passed All changes are scoped to packages/core as stated; executor.ts and related tests were modified as required, with LangGraph adapter and executionPlan consumers correctly left untouched.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/executor-consumes-compiled-verification

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

@SingleSourceStudios SingleSourceStudios merged commit 25f90b6 into main May 27, 2026
4 checks passed
@SingleSourceStudios SingleSourceStudios deleted the refactor/executor-consumes-compiled-verification branch May 27, 2026 06:46
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.

refactor(core): executor reads verification from the un-compiled spec, not CompiledStep.verification

1 participant