Diagnostics
Diagnostics explain calculation health and metadata quality. They are part of the public calculation model, not private debug output.
When this matters
Use diagnostics when you need to show validation issues, inspect graph health or test that a calculator ran without metadata problems.
How it works
CalculatorRunResponse includes a diagnostics field beside the calculator
metadata and report:
This excerpt assumes client, calculatorId and payload are already checked
application values. It returns an Effect for your application host to run.
import { CalculationQuery } from "@taxkit/calculators/schemas";
import { Effect, Option } from "effect";
const issueCount = client.calculatorApi
.calculate({
params: { calculatorId },
payload,
query: CalculationQuery.make({
help: Option.some(Option.some("errors")),
}),
})
.pipe(Effect.map((response) => response.diagnostics.graphIssues.length));Expected output for the current take-home pay success fixture is:
0Trace and graph data
Trace data records which rule ran, what it used, what it produced and which sources support it. Graph data exposes dependency edges and validation issues through the calculator graph endpoint.