Free, Community Edition

AI wrote the function. See what it actually does.

The tests and the HTML report are where AI-written database code becomes visible. Generate them, run them against the real database, and read exactly what each function does before you trust it.

Where the output shows up

Community Edition. You wrote a function, or an assistant did. One command generates the tests, runs them, and writes a report you open in the browser.

  1. Install pgTAP and plpgsql_check; connect with UNITAUTOGEN_DSN or the PG* variables.
  2. Run the default command and point it at an HTML report:
unitautogen --schema public --html report.html --out unit_tests
  1. Open report.html. Every function is there with its coverage; click one for its per-test results and annotated source.

Put it in the assistant's loop

The assistant that wrote the function can check its own work against the report, but only if you tell it to, step by step.

  1. Install once. The binary, plus pgTAP and plpgsql_check in your development database. Connect with UNITAUTOGEN_DSN or the PG* variables.
  2. Add a project rule, or paste the prompt below, so the assistant runs UnitAutogen every time it writes or changes a function.
  3. Give the assistant this prompt.
After you add or change any PL/pgSQL function, run this and wait for it to finish.

  unitautogen --schema public --json report.json --html report.html --out unit_tests

Then read report.json. For every function you touched:
  1. Confirm its branch coverage is 100 percent.
  2. Open its generated test in unit_tests/ and read the value each branch returns.
  3. If a branch is uncovered, or a returned value is not what I asked for, change
     the function and run the command again.

Never edit or delete the generated tests to make them pass. When you are done, tell me
which functions you changed, their coverage, and any behaviour in the report I should confirm.

What the report makes visible

  • One row per function, with its measured line and branch coverage
  • Click a function for each generated test and whether it passed
  • The annotated source, covered lines in green and uncovered in red
  • Each expected value captured by running the real function, so the report shows what the code does, not what it was meant to do
  • Every uncovered line explained, so a branch the AI left unreachable is named, not hidden
A function drill-down showing per-test results and the annotated source with covered and uncovered lines

Why AI-written code needs it

You did not write the function, so you cannot hold its behaviour in your head, and the model's own summary of what it did is one more guess.

This is transparency, not a gate. It shows you what the AI produced. Once you have looked and you trust it, the same generated tests become your regression guardrail, so the next change that moves that behaviour fails before production.

What platforms suggest

The platform points you to local pgTAP tests you run and read as you build.