-
Notifications
You must be signed in to change notification settings - Fork 0
Add software design documentation, requirements files, and expand review-sets #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2e69a50
Initial plan
Copilot 2e52e42
Add design documentation and update review-sets in .reviewmark.yaml
Copilot c4b360e
Address PR review feedback: add requirements files, ValidationTests, …
Copilot f9b9229
Rename requirements files per convention and split OTS into per-compo…
Copilot f21af7f
Add unit-context/program requirements, rename Index.cs to ReviewIndex…
Copilot 819798f
Add ReviewEvidence record documentation to review-index.md
Copilot 20cc0a1
Fix requirements test linkages to match actual test method names
Copilot 68f4dbc
Update docs/design/review-mark-configuration.md
Malcolmnixon 6d322cf
Update docs/design/program.md
Malcolmnixon acfd7b6
Update docs/reqstream/unit-program.yaml
Malcolmnixon 4395bf0
Update docs/design/review-index.md
Malcolmnixon 1fce71c
Update docs/design/review-index.md
Malcolmnixon ae75b57
Update docs/design/context.md
Malcolmnixon 4453f02
Update docs/design/system.md
Malcolmnixon ab82537
Update docs/design/definition.yaml
Malcolmnixon beef75d
Update docs/reqstream/unit-path-helpers.yaml
Malcolmnixon 5456ec7
Update docs/design/review-mark-configuration.md
Malcolmnixon 5bbfed4
Revise design docs to focus on WHAT/WHY rather than implementation HOW
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Context | ||
|
|
||
| ## Purpose | ||
|
|
||
| The `Context` software unit is responsible for parsing command-line arguments and | ||
| providing a unified interface for output and logging throughout the tool. It acts as | ||
| the primary configuration carrier, passing parsed options from the CLI entry point | ||
| to all processing subsystems. | ||
|
|
||
| ## Properties | ||
|
|
||
| The following properties are populated by `Context.Create()` from the command-line | ||
| arguments: | ||
|
|
||
| | Property | Type | Description | | ||
| | -------- | ---- | ----------- | | ||
| | `Version` | bool | Requests version display | | ||
| | `Help` | bool | Requests help display | | ||
| | `Silent` | bool | Suppresses console output | | ||
| | `Validate` | bool | Requests self-validation run | | ||
| | `Lint` | bool | Requests configuration linting | | ||
| | `ResultsFile` | string? | Path for TRX/JUnit test results output | | ||
| | `DefinitionFile` | string | Path to the `.reviewmark.yaml` configuration | | ||
| | `PlanFile` | string? | Output path for the Review Plan document | | ||
| | `PlanDepth` | int | Heading depth for the Review Plan | | ||
| | `ReportFile` | string? | Output path for the Review Report document | | ||
| | `ReportDepth` | int | Heading depth for the Review Report | | ||
| | `IndexPaths` | string[]? | Paths to scan when building an evidence index | | ||
| | `WorkingDirectory` | string | Base directory for resolving relative paths | | ||
| | `Enforce` | bool | Fail if any review-set is not Current | | ||
| | `Elaborate` | bool | Expand file lists in generated documents | | ||
|
|
||
| ## Argument Parsing | ||
|
|
||
| `Context.Create(string[] args)` is a factory method that processes the argument | ||
| array sequentially, recognizing both flag arguments (e.g., `--validate`) and | ||
| value arguments (e.g., `--plan <path>`). Unrecognized arguments are silently | ||
| ignored. The resulting `Context` instance holds the fully parsed state. | ||
|
Malcolmnixon marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Output Methods | ||
|
|
||
| | Method | Description | | ||
| | ------ | ----------- | | ||
| | `WriteLine(string)` | Writes a line to the console (unless `Silent` is set) and to the log file | | ||
| | `WriteError(string)` | Writes an error line to the console and to the log file | | ||
|
|
||
| ## Exit Code | ||
|
|
||
| `Context.ExitCode` reflects the current error status of the tool run. It is set to | ||
| a non-zero value when an error is detected. The value of `ExitCode` is returned from | ||
| `Program.Main()` as the process exit code. | ||
|
|
||
| ## Logging | ||
|
|
||
| When a log file path is provided via the relevant CLI argument, `Context` opens and | ||
| holds the log file handle for the duration of the tool run. All output written through | ||
| `WriteLine` and `WriteError` is duplicated to the log file. | ||
|
|
||
| ## Resource Cleanup | ||
|
|
||
| `Context` implements `IDisposable`. Disposal closes the log file handle if one is | ||
| open. `Program.Main()` constructs `Context` inside a `using` statement to guarantee | ||
| timely disposal regardless of how the tool exits. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| resource-path: | ||
| - docs/design | ||
| - docs/template | ||
| input-files: | ||
| - docs/design/title.txt | ||
| - docs/design/introduction.md | ||
| - docs/design/system.md | ||
| - docs/design/context.md | ||
| - docs/design/glob-matcher.md | ||
| - docs/design/index.md | ||
|
Malcolmnixon marked this conversation as resolved.
Outdated
|
||
| - docs/design/path-helpers.md | ||
| - docs/design/program.md | ||
| - docs/design/review-mark-configuration.md | ||
| - docs/design/validation.md | ||
| template: template.html | ||
| table-of-contents: true | ||
| number-sections: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # GlobMatcher | ||
|
|
||
| ## Purpose | ||
|
|
||
| The `GlobMatcher` software unit resolves an ordered list of glob patterns into a | ||
| concrete, sorted list of file paths relative to a base directory. It provides the | ||
| file enumeration primitive used by the Configuration subsystem to expand the | ||
| `needs-review` and `review-set` file lists defined in `.reviewmark.yaml`. | ||
|
|
||
| ## Algorithm | ||
|
|
||
| `GlobMatcher.GetMatchingFiles(baseDirectory, patterns)` processes patterns in the | ||
| order they are declared. Each pattern is evaluated as follows: | ||
|
|
||
| ```mermaid | ||
| graph TD | ||
| A[For each pattern in order] --> B{Starts with '!'?} | ||
| B -->|yes| C[Remove '!' prefix → exclusion pattern] | ||
| B -->|no| D[Inclusion pattern] | ||
| C --> E[Remove matching paths from result set] | ||
| D --> F[Add matching paths to result set] | ||
| F --> A | ||
| E --> A | ||
| A --> G[Sort result set] | ||
| G --> H[Return as relative paths with forward slashes] | ||
| ``` | ||
|
|
||
| Patterns are evaluated against the base directory using standard glob semantics. | ||
| The `**` wildcard matches any number of path segments (recursive matching). | ||
|
|
||
| ## Return Value | ||
|
|
||
| The method returns a sorted list of relative file paths. Path separators are | ||
| normalized to forward slashes regardless of the host operating system, ensuring | ||
| consistent fingerprint computation across platforms. | ||
|
|
||
| ## Usage | ||
|
|
||
| `GlobMatcher.GetMatchingFiles()` is called by `ReviewMarkConfiguration` to resolve: | ||
|
|
||
| - The `needs-review` file list, which represents all files subject to review | ||
| - Each `review-set` file list, which represents the files covered by a specific review record |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Introduction | ||
|
|
||
| This document describes the software design for the ReviewMark project. | ||
|
|
||
| ## Purpose | ||
|
|
||
| ReviewMark is a .NET command-line tool for automated file-review evidence management | ||
| in regulated environments. It computes cryptographic fingerprints of defined file-sets, | ||
| queries a review evidence store for corresponding review records, and produces compliance | ||
| documents on each CI/CD run. | ||
|
|
||
| This design document describes the internal architecture, subsystems, and software units | ||
| that together implement the ReviewMark tool. It is intended to support development, | ||
| review, and maintenance activities. | ||
|
|
||
| ## Scope | ||
|
|
||
| This design document covers: | ||
|
|
||
| - The software system decomposition into subsystems and software units | ||
| - The responsibilities and interfaces of each software unit | ||
| - The algorithms and data flows used for fingerprinting, evidence lookup, and document generation | ||
| - The self-validation framework | ||
|
|
||
| This document does not cover: | ||
|
|
||
| - External CI/CD pipeline configuration | ||
| - Evidence store setup or administration | ||
| - Requirements traceability (see the Requirements Specification) | ||
|
|
||
| ## Software Architecture | ||
|
|
||
| The following diagram shows the decomposition of the ReviewMark software system into | ||
| subsystems and software units. | ||
|
|
||
| ```text | ||
| ReviewMark (Software System) | ||
| ├── CLI Subsystem | ||
| │ ├── Program (Software Unit) | ||
| │ └── Context (Software Unit) | ||
| ├── Configuration Subsystem | ||
| │ ├── ReviewMarkConfiguration (Software Unit) | ||
| │ └── GlobMatcher (Software Unit) | ||
| ├── Index Subsystem | ||
| │ ├── ReviewIndex (Software Unit) | ||
| │ └── PathHelpers (Software Unit) | ||
| └── Validation (Software Unit) | ||
| ``` | ||
|
|
||
| ## Audience | ||
|
|
||
| This document is intended for: | ||
|
|
||
| - Software developers working on ReviewMark | ||
| - Quality assurance teams performing design verification | ||
| - Project stakeholders reviewing architectural decisions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # PathHelpers | ||
|
|
||
| ## Purpose | ||
|
|
||
| The `PathHelpers` software unit provides safe path construction utilities that | ||
| prevent path traversal attacks. It is used by the Index subsystem when constructing | ||
| file system paths to evidence PDF files referenced in the evidence index. | ||
|
|
||
| ## SafePathCombine() | ||
|
|
||
| `PathHelpers.SafePathCombine(basePath, relativePath)` combines a trusted base path | ||
| with an untrusted relative path from the evidence index, validating that the result | ||
| does not escape the base directory. | ||
|
|
||
| The algorithm is: | ||
|
|
||
| ```mermaid | ||
| graph TD | ||
| A[Receive basePath and relativePath] --> B{relativePath contains '..' segments?} | ||
| B -->|yes| C[Throw exception: path traversal rejected] | ||
| B -->|no| D{relativePath is rooted?} | ||
| D -->|yes| E[Throw exception: absolute path rejected] | ||
| D -->|no| F[Combine basePath and relativePath] | ||
| F --> G{Combined path starts with basePath?} | ||
| G -->|no| H[Throw exception: traversal detected after combination] | ||
| G -->|yes| I[Return combined path] | ||
| ``` | ||
|
|
||
| The double-check strategy (pre-validation of segments plus post-combination | ||
| verification) defends against edge cases such as URL-encoded separators or | ||
| platform-specific path normalization that might otherwise bypass a single check. | ||
|
|
||
| ## Security Rationale | ||
|
|
||
| Evidence index files may be loaded from external sources (file shares or URLs). | ||
| The `file` field in each index record is supplied by the evidence store and must | ||
| be treated as untrusted input. Without path validation, a maliciously crafted | ||
| index could direct the tool to read or reference files outside the intended | ||
| evidence directory. `SafePathCombine` eliminates this attack surface. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.