Repository navigation
#93: coverage matrix - #94
Conversation
… ui-tests.json into coverage-matrix.json - New package packages/services/coverage_matrix (living-doc-service-coverage-matrix 0.1.0): builder, a lineage table over both inputs, and the service. - One entity per User Story and Functionality, a row per active or deprecated criterion with the scenarios that link it, summaries from CoverageSummary.from_rows, and planned_summary. - The run-time FIELD_LOSS check compares against the documentation input only, with selected_stats over the counted criteria. - The CLI registers coverage-matrix with --doc-input, --tests-input, --output, --view and --fail-under (checked after the write). - The action runs every command it declares: NOT_AVAILABLE_YET and its refusal are gone, and integration.yml runs coverage-matrix. - The root requirements.txt pins living-doc-utilities==0.8.0, and its Dependabot entry ignores it, as the package entries do. Closes #93
…es and improve documentation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Build and validate coverage matrices packages/services/coverage_matrix/src/..., packages/services/coverage_matrix/tests/*, packages/services/coverage_matrix/README.md |
The service validates documentation and test inputs, builds criterion rows and coverage summaries, records lineage and metadata, checks for field loss, and writes the artifact. Tests cover builder, service, lineage, and golden output behavior. |
Register package and QA targets Makefile, requirements.txt, .github/dependabot.yml, .claude/commands/implement-task.md, .github/agents/* |
The package is added to installation and Makefile targets. Dependabot and per-package QA guidance include the new package and alias. |
Add CLI command apps/cli/src/living_doc_cli/commands/coverage_matrix.py, apps/cli/src/living_doc_cli/main.py, apps/cli/tests/*, apps/cli/README.md, apps/cli/pyproject.toml |
The CLI registers coverage-matrix with required inputs, view selection, and an optional finite --fail-under threshold. Tests cover artifact output, input errors, threshold handling, and logging. |
Enable action and integration runs main.py, action.yml, tests/test_main.py, .github/workflows/integration.yml, tests/fixtures/collector-gh/README.md |
The action entry point accepts coverage-matrix after input validation. Integration checks verify successful artifact generation, output paths, metadata, and the threshold failure after writing. |
Update project and command documentation README.md, DEVELOPER.md, SPEC.md, .github/copilot-instructions.md, .claude/agents/test-author.md |
Documentation describes the command’s inputs, output, validation, coverage summaries, and threshold behavior. Maintainer instructions and package references are updated. |
Priority:
Estimated code review effort: 4 (Complex) | ~50 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant CLI
participant coverage_matrix
participant validate_inputs
participant build_coverage_matrix
participant artifact_writer
CLI->>coverage_matrix: Provide documentation and tests inputs
coverage_matrix->>validate_inputs: Validate inputs
validate_inputs-->>coverage_matrix: Return validated inputs
coverage_matrix->>build_coverage_matrix: Build matrix from inputs
build_coverage_matrix-->>coverage_matrix: Return matrix result
coverage_matrix->>artifact_writer: Write after metadata and field-loss checks
artifact_writer-->>coverage_matrix: Return written artifact
coverage_matrix-->>CLI: Return result and apply fail-under after writing
Possibly related PRs
- AbsaOSS/living-doc-toolkit#90: Adds envelope metadata and warning-forwarding utilities, and defines the UI-test input flow used by this service.
- AbsaOSS/living-doc-toolkit#88: Adds shared input validation and run-context utilities used by the coverage-matrix service.
Suggested labels: enhancement
Merge Risk: 
Minimal · up to 36e84
-
No actionable merge-blocking risk remains; the change is ready for normal merge checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#93requires the coverage-matrix package, command, artifact transformation, validation, lineage checks, metadata, warning forwarding, view handling, fail-under behavior, action and CLI integration, tests, documentation, and configuration. The PR summary reports implementation for each requirement. It also reportsmake qasuccess, coverage-matrix tests, golden and full-sample checks, and integration workflow checks.
Full details: Out of Scope Changes check
-
Explanation
The changes remain within issue
#93scope. The package, CLI, action, entry point, fixtures, golden output, documentation, dependency configuration, CI workflow, and repository registration directly support the requested command and integration. The agent and developer guidance updates document the same package and quality checks. No unrelated product behavior is identified.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 16.07% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 112 functions across 14 files. (20 skipped: 20 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks each row in view
It links the tests to stories too
The matrix lands in files with care
A threshold checks the totals there
Then hops away with carrots to spare
Comment @coderabbitai help to get the list of available commands.
Overview
Adds
coverage-matrix, the third and last command the action runs. It reads onedoc-source.jsonand oneui-tests.jsonthrough the shared input validation and writescoverage-matrix.jsonon theliving-doc-utilities0.8.0contract. Coverage is counted per acceptance criterion. A criterion that declares aspects or a keyword is one plain row until per-aspect coverage arrives, so the canon's worked example of 1/3 for an aspect criterion is not computed yet.Entities and rows. Every User Story and every Functionality has an
entities[]entry, whatever its state and whether or not it has a counted criterion. User Stories come first, then Functionalities, each in input order. There is no Feature entity. An entity has a row peractiveordeprecatedcriterion, in its own order. A row lists thescenario_idof each scenario that links that criterion, each scenario once and in input order. It iscoveredwith at least one scenario andnot_coveredwith none, and carries no aspect and no keyword. A link to a criterion without a row (unknown,plannedorin_review) counts nowhere, and in this change it raises no warning. Nothing is sorted.Summaries. Each entity's
summaryand the rootsummarycome fromCoverageSummary.from_rows, the root's over every row of every entity.planned_summarycounts theplannedcriteria of User Stories and Functionalities by target version, or as backlog when they have none. Anin_reviewcriterion is in neither.--viewand--fail-under.--view inner|release(defaultinner) setsdocument.viewand nothing else: both views have the same rows and counts.--fail-under Nis the CLI's gate. The file is written first; then a rootcoverage_pctbelowN, ornullbecause nothing is counted, logs one[ERROR]line and exits 1. In the action, that leaves the file in place and sets nooutput-path.Nmust be a finite number, as the action's input check already requires:nanorinfis click's usage error, exit 2, with no file written, because no percentage is belownanand the gate would never fail. The gate comparescoverage_pctas written, rounded to one decimal place, and the CLI README links the canon's rounding rule.Envelope with two inputs.
metadata.sourceis the documentation input's, with each of the tests input'ssystemsit lacks added once.metadata.source_inputs[]holds the documentation entry, then the tests entry. Each keeps its input'sschema_version,producer,run,sourceandstats.metadata.runis the CI run,producer.buildisnull, and the four counts a caller reports are0.context.Lineage. One table in the package covers both inputs: 162
doc-sourcepaths and 12ui-testspaths. It maps entity identity, criterionidandstate, andscenario_id, and drops everything else with a reason. The tests runassert_completefor both contracts; the command never calls it. The run-time check runs once, before the write, against the documentation entry'sselected_statsonly. Those stats are computed over what the matrix counts: the User Stories and Functionalities, each with itsactiveanddeprecatedcriteria, and no Feature. Both choices avoid a falseFIELD_LOSS, each measured on the fixtures:plannedwrites no row. It would fail onacceptance_criteria[].idand.state, so a project with only planned work would get no matrix.scenarios[].scenario_id.With the counted selection, the fixtures, the full samples and the all-planned file pass, and a builder that empties every row still fails. Because both entity lists map to the same output paths, a criterion lost from one list while the other fills the path is a partial drop. R11 does not detect a partial drop, and the package README says so.
Matching. Matching is by entity id and criterion id only. The deleted matcher's org/repo disambiguation is not rebuilt: input validation stops a repeated entity or criterion id with
DUPLICATE_ENTITY_ID/DUPLICATE_AC_ID, and a second documentation file withMULTIPLE_DOCUMENTATION_SOURCES.Action and pin.
main.pylosesNOT_AVAILABLE_YETand its refusal, and every page that said a command is not available yet now says all three run. The rootrequirements.txt, which the action installs, now pinsliving-doc-utilities==0.8.0like every package. The root Dependabotpipentry ignores it, as the package entries do. The package is registered in theMakefile,requirements.txt,.github/dependabot.yml,apps/cliand the pages that list packages.Version impact. Additive, no bump (
SPEC.md§ Cross-cutting contract changes). It adds a new package,living-doc-service-coverage-matrix0.1.0, and the CLI'scoverage-matrixcommand with its options and error lines. The action'scommand: coverage-matrix, which exited 1 with the placeholder "not available yet" refusal from #85, now runs. No input, option, output, exit code or error line ofnormalize-docsornormalize-testschanges, and no artifact contract changes: the toolkit writescoverage-matrix-v1.0.0asliving-doc-utilities0.8.0defines it.Release Notes
coverage-matrix: reads onedoc-source.jsonand oneui-tests.jsonand writescoverage-matrix.jsonon theliving-doc-utilities0.8.0contract. It counts per acceptance criterion and adds a summary per User Story, per Functionality and for the whole matrix, plus a planned-work summary.--fail-underfails the run when the matrix's coverage percentage is below the number, or there is none; the file is written first. A value that is not a finite number, such asnanorinf, is a usage error.coverage-matrixchecks its field-lineage table against the documentation input before it writes: a field with data in the counted records that arrives empty stops the run withFIELD_LOSS.requirements.txtpinsliving-doc-utilities0.8.0, as every package does.Framework
Related
Closes #93
Contract Rules
sourceis copied from the one documentation input, plus the tests input's systems. Thesource_inputs[]entries and the producer follow R6 and R7: artifact rules, § The metadata envelope, R6, R7.activeanddeprecatedin both views.document.viewchanges no count, andin_reviewandplannedcriteria have no row. The entity and matrix summaries come fromCoverageSummary.from_rows, andplanned_summaryhastotal=backlog+ targeted: rendering, § Coverage, § Coverage summary, § Planned work summary.MISSING_INPUTfor a coverage run without one of its inputs, throughDUPLICATE_AC_ID), and forwarded warnings: errors, § Codes, § Forwarded warnings.selected_statscomputed over the counted records: component checks, § R11.selected_statsby the view filter. This command's view filters nothing, and its count rule plays that part. The contract pages do not state that reading yet; it is recorded on Add thecoverage-matrixcommand, which turnsdoc-source.jsonandui-tests.jsonintocoverage-matrix.json#93 (Additional Context) for a later contract change.make no-vendored-schemasis clean;read_artifactas contract models, and the matrix is written withwrite_artifactfrom one;AcCoverage, and per-aspect coverage, the keyword and the test-link warnings come in a later change, as Add thecoverage-matrixcommand, which turnsdoc-source.jsonandui-tests.jsonintocoverage-matrix.json#93 states.No disagreement with the canon was found.
Verification
make qapassed: core 67 tests, normalize-docs 70, normalize-tests 20, coverage-matrix 42 (100 % coverage), CLI 46, root 59. Pylint 10.00 in every package; Black, ruff, mypy and deptry clean;no-vendored-schemasclean.US-001:US-001-01covered (1 scenario),-02not covered,-04(deprecated) covered (1); 66.7.FUNC-001:-01covered (3),-02not covered,-03covered (1); 66.7.FUNC-002(planned): no row; 0 counted,null.planned_summary: total 2, backlog 1,{"1.1.0": 1}.source_input='doc-source-v1.0.0'. The output equals the committed golden withgenerated_atmasked.FIELD_LOSS; six entities (US-010,FUNC-001andFUNC-003with no row); 7 counted rows, 3 covered, 42.9. Theirplanned_summary(4, backlog 2,{"1.6.0": 1, "1.7.0": 1}) and their entity and row ids equalfull_sample("coverage-matrix-v1.0.0")'s.pip install -r requirements.txt, as the action installs it, runscoverage-matrixthroughmain.pyand setsoutput-path. The newintegration.ymlscripts ran locally on the repository's venv: theaction-runassertions, and the isolation job's outcome check and three replays.Acceptance criteria
A bare
builder.py,lineage.py,service.pyortests/test_*.pypath is underpackages/services/coverage_matrix/(src/living_doc_service_coverage_matrix/for the modules);tests/test_main.pyis the root's.validate_inputs, failing before any transform:packages/services/coverage_matrix/src/living_doc_service_coverage_matrix/service.py:67;tests/test_service.py:115. Typed builder:builder.py:167-169,tests/test_builder.py:62-75. No schema vendored.MULTIPLE_DOCUMENTATION_SOURCESone line each,DUPLICATE_ENTITY_IDandDUPLICATE_AC_IDone line each listing every place:apps/cli/tests/test_coverage_matrix.py:176,:194,:209.entity_idandAcLink.idonly:builder.py:51-58,tests/test_builder.py:206.--helpnames no retired artifact:apps/cli/tests/test_coverage_matrix.py:64.active/deprecated; adeprecatedrow counts:builder.py:40-47,:61-85;tests/test_builder.py:78,:88,:136.CoverageSummary.from_rows;planned_summary, within_reviewin neither:builder.py:84,:88-102,:203;tests/test_builder.py:117,:150.--fail-underpasses at 66.7, fails at 66.8,nullfails, file written:apps/cli/src/living_doc_cli/commands/coverage_matrix.py:90-103;apps/cli/tests/test_coverage_matrix.py:119,:129,:143. A non-finite value is a usage error:apps/cli/src/living_doc_cli/commands/coverage_matrix.py:29-37,:60;apps/cli/tests/test_coverage_matrix.py:163.--viewsetsdocument.view, no count changes:builder.py:200;tests/test_builder.py:222,tests/test_service.py:68.source,source_inputs[]order,run,producer.build, forwarding:builder.py:105-111,:194-199;service.py:80;tests/test_builder.py:231,:243,:288,:302;tests/test_service.py:199.assert_completein tests only, run-time check against the documentation entry's countedselected_stats; all-planned passes, a dropped mapped field fails and writes nothing:lineage.py:133;builder.py:114-152;service.py:28-38;tests/test_lineage.py:10-18;tests/test_service.py:221,:260,:275.tests/test_service.py:91.packages/services/coverage_matrix/tests/expected/coverage-matrix.json;tests/test_service.py:60.action-runstep.github/workflows/integration.yml:127-166; isolation job:231,:255,:271; entry pointtests/test_main.py:501,:521;NOT_AVAILABLE_YETgone frommain.py, its tests and the pages.requirements.txt:3,.github/dependabot.yml:40-41; registration:Makefile:23,:28,:91,.github/dependabot.yml:120-141,DEVELOPER.md§ Monorepo Layout.make qagreen;integration.ymlruns on this PR.Summary by CodeRabbit
coverage-matrixcommand to the CLI and GitHub Action. It combines documentation and UI-test inputs into a coverage report, with inner and release views.