-
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 all 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,59 @@ | ||
| # 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 or unsupported arguments | ||
| cause `Context.ParseArgument` to throw an `ArgumentException`, which callers of | ||
| `Context.Create` are expected to handle and surface as a CLI error. The resulting | ||
| `Context` instance holds the fully parsed state when argument parsing succeeds. | ||
|
|
||
| ## 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. |
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/review-index.md | ||
| - 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,32 @@ | ||
| # 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. Patterns prefixed with `!` are exclusion patterns; all | ||
| others are inclusion patterns. Each inclusion pattern adds matching paths to the | ||
| result set; each exclusion pattern removes matching paths from the result set. | ||
| Because patterns are applied in declaration order, a later pattern can re-include | ||
| files excluded by an earlier one, or exclude files included by an earlier one. The | ||
| `**` wildcard matches any number of path segments, enabling recursive matching. | ||
| After all patterns are processed, the result set is sorted and returned. | ||
|
|
||
| ## 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,35 @@ | ||
| # 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 validation steps are: | ||
|
|
||
| 1. Reject any relative path that contains `..` segments (explicit traversal attempt). | ||
| 2. Reject any relative path that is rooted (absolute path supplied where a relative one is required). | ||
| 3. Combine the base path and relative path. | ||
| 4. Verify that the combined path still begins with the base path (catches edge cases | ||
| such as platform-specific path normalization that might otherwise bypass the | ||
| earlier checks). | ||
| 5. Return the 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. |
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,47 @@ | ||
| # Program | ||
|
|
||
| ## Purpose | ||
|
|
||
| The `Program` software unit is the main entry point of the ReviewMark tool. It is | ||
| responsible for constructing the execution context, dispatching to the appropriate | ||
| processing logic based on parsed flags, and returning a meaningful exit code to the | ||
| calling process. | ||
|
|
||
| ## Version Property | ||
|
|
||
| `Program.Version` returns the tool version string. The version is embedded at build | ||
| time from the assembly metadata and follows semantic versioning conventions. | ||
|
|
||
| ## Main() Method | ||
|
|
||
| `Program.Main(string[] args)` is the process entry point. It: | ||
|
|
||
| 1. Constructs a `Context` instance via `Context.Create(args)` inside a `using` block | ||
| 2. Calls `Program.Run(Context)` to perform the requested operation | ||
| 3. Returns `Context.ExitCode` as the process exit code | ||
|
|
||
| Any unexpected exception that escapes `Run()` is logged to the standard error stream | ||
| via `Console.Error` and then rethrown. As a result, the process terminates due to the | ||
| unhandled exception and the final exit code is determined by the .NET runtime rather | ||
| than by `Program.Main` explicitly returning a non-zero value. | ||
|
|
||
| ## Run() Dispatch Logic | ||
|
|
||
| `Program.Run(Context)` evaluates the parsed flags in the following priority order, | ||
| executing the first matching action and returning: | ||
|
|
||
| 1. If `--version` — print version and return | ||
| 2. If `--help` — print banner and return | ||
| 3. If `--validate` — run self-validation and return | ||
| 4. If `--lint` — run configuration lint and return | ||
| 5. If `--index` paths provided — scan and write evidence index, then return | ||
| 6. Otherwise — generate Review Plan and/or Review Report and return | ||
|
|
||
| Only one top-level action is performed per invocation. Actions later in the priority | ||
| order are not reached if an earlier flag is set. | ||
|
|
||
| ## PrintBanner() | ||
|
|
||
| `Program.PrintBanner(Context)` writes the help text to the console via | ||
| `Context.WriteLine()`. The banner lists all supported flags and arguments with brief | ||
| descriptions. |
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.