@@ -258,6 +258,77 @@ NcdbMerger().merge(["run1.cdb", "run2.cdb"], "merged.cdb")
258258| ` strings.bin ` | Deduplicated string table |
259259| ` history.json ` | Test/merge history nodes |
260260| ` sources.json ` | Source file references |
261+ | ` v2/test_registry.bin ` | Per-test name and seed registry (v2 history) |
262+ | ` v2/test_stats.bin ` | Welford pass/fail/flake statistics per test (v2 history) |
263+ | ` v2/bucket_index.bin ` | Time-bucketed history index for fast date-range queries |
264+ | ` v2/history/*.bin ` | Compressed per-bucket test run records |
265+ | ` testplan.json ` | Embedded testplan with testpoints and stage assignments |
266+ | ` waivers.json ` | Glob-pattern coverage waivers with expiry and approver |
267+
268+ ### V2 Binary Test History
269+
270+ NCDB ` v2 ` history stores per-test run records in time-bucketed binary files,
271+ enabling queries over millions of runs without loading full data. Key APIs:
272+
273+ ``` python
274+ from ucis.ncdb.ncdb_ucis import NcdbUCIS
275+
276+ db = NcdbUCIS(" coverage.cdb" )
277+
278+ # Record a test run
279+ db.add_test_run(" uart_smoke" , seed = 12345 , status = 0 /* pass */ )
280+
281+ # Query recent history for a test
282+ records = db.query_test_history(" uart_smoke" , ts_from = ... , ts_to = ... )
283+
284+ # Get aggregate stats (flake score, CPU mean, CUSUM)
285+ stats = db.get_test_stats(" uart_smoke" )
286+ print (f " flake= { stats.flake_score:.3f } " )
287+
288+ # Top flaky and failing tests
289+ print (db.top_flaky_tests(n = 10 ))
290+ print (db.top_failing_tests(n = 10 ))
291+ ```
292+
293+ CLI equivalents:
294+
295+ ``` bash
296+ # Show recent history for a test
297+ pyucis history query coverage.cdb uart_smoke --from 2025-01-01
298+
299+ # Show top 10 flaky tests
300+ pyucis history stats coverage.cdb --top-flaky 10
301+ ```
302+
303+ ### Testplan Embedding
304+
305+ ``` python
306+ from ucis.ncdb.testplan_hjson import import_hjson
307+ from ucis.ncdb.testplan_closure import compute_closure
308+ from ucis.ncdb.reports import report_testpoint_closure, format_testpoint_closure
309+
310+ # Import an OpenTitan-style Hjson testplan
311+ plan = import_hjson(" uart.hjson" )
312+ db.setTestplan(plan)
313+
314+ # Compute closure and format a report
315+ results = compute_closure(plan, db)
316+ summary = report_testpoint_closure(results)
317+ print (format_testpoint_closure(summary))
318+ ```
319+
320+ CLI equivalents:
321+
322+ ``` bash
323+ # Embed a testplan
324+ pyucis testplan import coverage.cdb uart.hjson
325+
326+ # Compute closure with V2 stage gate
327+ pyucis testplan closure coverage.cdb --stage V2
328+
329+ # Export JUnit XML for CI dashboard
330+ pyucis testplan export-junit coverage.cdb --out closure_results.xml
331+ ```
261332
262333## Documentation
263334
0 commit comments