You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(site): Document the consolidated findings report
usage.adoc gains a report section — the configuration-key table
(`database-audits.report.*`), the default report location, and the fix-fidelity
levels; archetype.adoc documents the `reportFormat` and `fixFormat` parameters in
the property table and command examples; index.adoc mentions the report in the
overview.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016phSDvM51hkfSYdjcGQrwz
@@ -148,6 +154,21 @@ Pass only the ones that differ.
148
154
| both
149
155
| When `true`, annotates every generated test with JUnit's `@Disabled`, so the suite is generated and compiles but does not run. (`SchemaEntityValidationAuditIT` is annotated on the class rather than the method, so its Spring context never loads.) Useful for scaffolding the audits into a project that does not pass them yet — remove the `@Disabled` annotations to enable audits one at a time.
150
156
157
+
| `reportFormat`
158
+
| `asciidoc`
159
+
| both
160
+
| Format of the consolidated findings report the auto-registered listener writes when a run has findings: `asciidoc`, `markdown`, or `text`. Seeded into the generated `junit-platform.properties` as `database-audits.report.format`. See the link:usage.html#_consolidated_findings_report[Consolidated findings report] guide.
161
+
162
+
| `fixFormat`
163
+
| `liquibase-xml`
164
+
| both
165
+
| Per-finding remediation the report emits: `liquibase-xml` (a `databaseChangeLog` fragment), `sql` (raw DDL), or `none` (findings only). Seeded as `database-audits.report.fix-format`.
166
+
167
+
| `fixPlacement`
168
+
| `both`
169
+
| both
170
+
| Where the report places each audit's fixes: `both` (default — inline under each audit and in a consolidated section), `inline` (only under each audit), or `section` (only the consolidated block). Seeded as `database-audits.report.fix-placement`.
171
+
151
172
| `dataSourceName`
152
173
| `none`
153
174
| both
@@ -203,7 +224,7 @@ Pass only the ones that differ.
Copy file name to clipboardExpand all lines: integration/src/site/asciidoc/usage.adoc
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -375,3 +375,85 @@ schemas are handled naturally.
375
375
*before Hibernate builds it* — so your own (production) datasource configuration is untouched. Also connect that
376
376
datasource with `preferQueryMode=simple` (see <<postgresql-jdbc-requirement>>); otherwise run only the catalog and
377
377
JPA audits against that datasource.
378
+
379
+
== Consolidated findings report
380
+
381
+
Every audit failure is also collected into a single report file, written automatically at the end of the test run
382
+
by a JUnit `TestExecutionListener` shipped in the integration jar and auto-registered via `META-INF/services` — no
383
+
setup and no console scraping. The listener is *inert when the run is clean*: it writes nothing unless there are
384
+
findings, so unrelated test runs are unaffected.
385
+
386
+
The report groups findings by audit family and audit, reproducing each finding's message, and can additionally emit
387
+
a remediation for each finding — raw SQL DDL or a Liquibase changeset.
388
+
389
+
[NOTE]
390
+
====
391
+
The report is populated from *per-audit* assertion failures — the per-audit ITs the archetype generates, or any
392
+
test that calls an individual `*AuditAssertion` bean. The `DatabaseAuditAssertions` facade
393
+
(`assertAllClean` / `assertCatalogClean` / …) aggregates its failures into one combined `AssertionError`, which the
394
+
report does not itemize; prefer the per-audit assertions when you want the consolidated report.
395
+
====
396
+
397
+
=== Configuration
398
+
399
+
Set these JUnit Platform configuration parameters in `src/test/resources/junit-platform.properties` (each is also
400
+
honored as a same-named system property):
401
+
402
+
|===
403
+
| Key | Default | Description
404
+
405
+
| `database-audits.report.enabled`
406
+
| `true`
407
+
| Master switch. `false` disables the report entirely.
408
+
409
+
| `database-audits.report.format`
410
+
| `asciidoc`
411
+
| Report format: `asciidoc`, `markdown`, or `text`.
412
+
413
+
| `database-audits.report.fix-format`
414
+
| `liquibase-xml`
415
+
| Per-finding remediation: `liquibase-xml` (a `databaseChangeLog` fragment), `sql` (raw DDL), or `none` (findings only).
416
+
417
+
| `database-audits.report.fix-placement`
418
+
| `both`
419
+
| Where fixes appear: `both` (default — inline under each audit and in a consolidated section), `inline` (only under each audit), or `section` (only the consolidated block).
420
+
421
+
| `database-audits.report.output-file`
422
+
| `target/database-audit-report.<ext>`
423
+
| Where the report is written; the default extension follows the format (`md` / `adoc` / `txt`).
424
+
|===
425
+
426
+
[source,properties]
427
+
----
428
+
# src/test/resources/junit-platform.properties
429
+
database-audits.report.format=asciidoc
430
+
database-audits.report.fix-format=liquibase-xml
431
+
database-audits.report.fix-placement=both
432
+
----
433
+
434
+
=== Fix fidelity
435
+
436
+
Generated fixes are labeled by how faithfully they remediate the finding, because not every finding carries enough
437
+
information for an exact fix:
438
+
439
+
* *precise* — executable, dialect-correct DDL that fully fixes the finding (e.g. `CREATE INDEX` for an unindexed
440
+
foreign key, `DROP INDEX` for a redundant index, `ALTER COLUMN … TYPE` for a foreign-key type mismatch).
441
+
* *template* — DDL with a `TODO` you must complete (e.g. a missing primary key's key columns cannot be inferred from
442
+
the catalog).
443
+
* *best-effort* — an index suggestion whose relation is parsed from the `EXPLAIN` plan; verify the columns.
444
+
* *advisory* — no DDL; a full-table `UPDATE`/`DELETE` needs a `WHERE` clause in code, not a schema change.
445
+
446
+
In `liquibase-xml` mode only *precise* fixes become runnable `<changeSet>` elements — built from Liquibase's
0 commit comments