[builders] Valid use step directives are missed after raw backticks
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 365
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 169
Description
Bug
@workflow/builders 4.1.10 can report hasUseStep: false for a valid use step directive when a raw triple-backtick sequence appears earlier in the file and a template literal appears after the directive.
Minimal reproduction
// Markdown fence marker: ```
export async function brokenStep() {
"use step";
return `ok`;
}
The same result occurs when the first line is a regex literal:
const openFence = /```/;
export async function brokenStep() {
"use step";
return `ok`;
}
Run the detector:
import { readFileSync } from "node:fs";
import { detectWorkflowPatterns } from "@workflow/builders";
const source = readFileSync("step.ts", "utf8");
console.log(detectWorkflowPatterns(source));
Actual
{
hasUseWorkflow: false,
hasUseStep: false,
hasDirective: false,
hasSerde: false
}
Expected
hasUseStep should be true. Comments and regex literals elsewhere in the file should not affect directive discovery.
Notes
The current detector masks template-literal-looking spans before masking comments. The template-literal regex runs against raw source, so it can pair backticks from comments or regex literals with a later template literal and mask the real directive between them.
Please add regression cases for both examples above.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the detectWorkflowPatterns entry point in @workflow/builders and reproduce the issue with the two TypeScript examples containing raw triple backticks or a regex literal. Add regression cases for both examples; done means hasUseStep is true and comments or regex literals elsewhere do not affect directive discovery.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100