fix: validate missing child requirement references and fix test compilation errors#156
Conversation
Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/7c60a53b-cbb6-499a-94b9-0787e3c5e691 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
…ion errors Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/7c60a53b-cbb6-499a-94b9-0787e3c5e691 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
test/DemaConsulting.ReqStream.Tests/Tracing/TestMissingChild.cs
Outdated
Show resolved
Hide resolved
…e TestMissingChild.cs Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/46a3be6f-2b81-42bb-9bd3-e1f94a679047 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
test/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoaderTests.cs
Outdated
Show resolved
Hide resolved
…rence_ReportsError Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/0a2bb730-b79a-40a4-a673-fc9ba9b9b2f8 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves requirements model validation by detecting and reporting references to non-existent child requirement IDs during load/lint, and updates unit tests and formal requirements to match the new behavior.
Changes:
- Add error-level linting for unknown child requirement references during cycle validation.
- Update/add unit tests to cover the new validation behavior and fix previously-invalid test YAML.
- Add a formal requirement documenting the new lint behavior and linking it to the corresponding test.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/DemaConsulting.ReqStream/Modeling/RequirementsLoader.cs | Emits an error LintIssue when a requirement’s children: list references an ID not present in the loaded requirements. |
| test/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoaderTests.cs | Adds a regression test ensuring unknown child references produce a lint error. |
| test/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoadParsingTests.cs | Fixes YAML test data by defining the previously-referenced child requirement IDs. |
| docs/reqstream/modeling/requirements.yaml | Adds ReqStream-Lint-UnknownChildReference requirement documenting the new validation behavior and mapping to the new test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoaderTests.cs
Outdated
Show resolved
Hide resolved
|
@copilot apply changes based on the comments in this thread |
…ValidateCyclesFrom, improve assertions Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/1ee16f98-852e-4dab-96fb-0f4d4543adea Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Applied in 315c3f5: all |
Pull Request
Description
Performed formal reviews of all 12 review-sets defined in
.reviewmark.yamlusing the code-review agent. Found and fixed critical issues discovered during the reviews.1. Build failure — invalid property reference in linter test (Critical)
issue.Messagewhich does not exist onLintIssue— the correct property isissue.Description. This caused a CS1061 compilation error across all target frameworks.Tracing/) with a non-standard filename, and used an incorrect naming prefix.test/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoaderTests.csasRequirementsLoader_Load_WithUnknownChildReference_ReportsError, following theClassName_Method_Scenario_Resultnaming convention used across the Modeling test files and correct Modeling subsystem placement. RemovedTestMissingChild.csentirely.2. Missing child requirement reference validation (High)
RequirementsLoader.ValidateCyclesFromsilently ignored child requirement IDs that don't exist in the requirements tree. A typo in achildren:list would go undetected, causing silent failures in trace matrix generation.ValidateCyclesFromto emit an error-levelLintIssuewhen a child requirement ID is not found. Simplified the implementation to use a singleTryGetValuecall (eliminating a redundantContainsKey+ laterTryGetValuedouble-lookup).3. Pre-existing test used undefined child IDs (Medium)
Requirements_Load_RequirementWithChildren_ParsesChildrenCorrectlyreferenced child IDsAUTH-001andAUTH-002that were not defined as requirements in the test YAML, which now (correctly) fails validation.4. Test naming convention corrected across
RequirementsLoaderTests.cs(Code Quality)RequirementsLoaderTests.csused the incorrectLinter_Lint_*/Linter_ProgramRun_*prefix, which references a non-existent subsystem and unit.ClassName_Method_Scenario_Resultconvention:Linter_Lint_*→RequirementsLoader_Load_*andLinter_ProgramRun_WithLintFlag_RunsLinter→Program_Run_WithLintFlag_RunsLinter. Updated all corresponding test name references indocs/reqstream/modeling/requirements.yamlanddocs/reqstream/program.yaml.5. New requirement added
ReqStream-Lint-UnknownChildReferencetodocs/reqstream/modeling/requirements.yamlto formally capture the new validation behaviour with traceability toRequirementsLoader_Load_WithUnknownChildReference_ReportsError.Type of Change
Related Issues
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
dotnet build --configuration Releasedotnet test --configuration Releasedotnet run --project src/DemaConsulting.ReqStream --configuration Release --framework net10.0--no-build -- --validateCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
cspell "**/*.{md,cs}"markdownlint "**/*.md"yamllint .Testing
Documentation
Additional Notes
Files changed:
src/DemaConsulting.ReqStream/Modeling/RequirementsLoader.cs— add unknown child reference validation; simplifyValidateCyclesFromto singleTryGetValuetest/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoaderTests.cs— rename all tests toClassName_Method_*convention; addRequirementsLoader_Load_WithUnknownChildReference_ReportsErrorwith specific assertionstest/DemaConsulting.ReqStream.Tests/Modeling/RequirementsLoadParsingTests.cs— fix test to include child requirement definitionsdocs/reqstream/modeling/requirements.yaml— addReqStream-Lint-UnknownChildReferencerequirement; update all test name referencesdocs/reqstream/program.yaml— updateProgram_Run_WithLintFlag_RunsLintertest name reference