dotFactory Create account
All workflow ideas
Weekday schedule

Improve test coverage

Check coverage first. If it is already above 85%, skip the agent; otherwise add focused tests and pause for review.

Workflow

One decision · two possible paths
1
Cron trigger
Measure coverage
Decision point
Is coverage above 85%?
Path 1

Coverage is sufficient

coverage > 85%
1Skip test generation
Only this matching path runs
Path 2

Coverage needs work

coverage ≤ 85%
1Add focused tests
2Review the change
Only this matching path runs
Paths join
Record coverage result
Factory definition
.fct
type CoverageReport = { percent: int, summary: text }

type ReviewDecision = enum { approve, revise }

trigger weekdays:
  kind: cron
  config: { schedule: "0 8 * * 1-5" }
  out: { expression: text, scheduled_at: time, fired_at: time }

runner coding_agent:
  kind: opencode
  in: open
  out: open

step check_coverage:
  runner: coding_agent
  in:
    prompt: "Measure test coverage and report the percentage. Do not edit files."
    repo: { url: "https://github.com/acme/app", ref: "main" }
  out: { report: CoverageReport }

step add_tests:
  runner: coding_agent
  when: check_coverage.report.percent <= 85
  in:
    prompt: "Coverage is at or below 85%. Add focused tests for uncovered behavior."
    repo: { url: "https://github.com/acme/app", ref: "main" }
    report: check_coverage.report
  out: { report: CoverageReport }

step review:
  kind: gate
  when: check_coverage.report.percent <= 85
  in: { report: add_tests.report }
  out: { decision: ReviewDecision, note: text? }

step result:
  kind: file
  config: { path: "out/coverage.json" }
  in:
    report?: add_tests.report
    coverage: check_coverage.report
    decision: review.decision
    note?: review.note
Illustrative factory code. Connect the runner, repository access, and tools for your environment.