-
Notifications
You must be signed in to change notification settings - Fork 34
feature/524_add-version-to-help-text #525
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
Open
redcatbear
wants to merge
21
commits into
main
Choose a base branch
from
feature/524_add-version-to-help-text
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2c0d450
#524: Add version to help text
redcatbear f40e5f7
#524: Added help requirements in system requirements and design.
redcatbear 642fa0f
#524: Split help requirement and version requirement.
redcatbear 411fc75
#524: Fixed tracing and tests for help commands.
redcatbear a2ee114
#524: Removed duplicate test.
redcatbear 5c42b72
#524: Removed unnecessary newlines.
redcatbear fb5aa6d
#524: Fixed broken skill link.
redcatbear feb5369
#524: Improved general skill.
redcatbear 009e950
#524: Added coverage for bad-weather scenarios in VersionProvider.
redcatbear e7d120d
#524: Fixed Sonar findings.
redcatbear 648c847
#524: Removed the bad weather test cases, since SONAR did not see them.
redcatbear fda1fd9
#524: Logged exception message when version resource file can't be read.
redcatbear b19a715
Merge branch 'main' into feature/524_add-version-to-help-text
redcatbear 44947b6
#504: Fixed findings in SKILL and renamed the file.
redcatbear 1359bc8
#504: One section per tracing method.
redcatbear 26ec873
#504: Added `.junie` to `.gitignore`.
redcatbear 1390f30
#504: Fixed review findings in VersionProvider and corresponding tests.
redcatbear 243d1ef
#504: Explained how the version gets into the resource file.
redcatbear 0e7ff07
#524: Added ticket mention.
redcatbear 2b74148
Merge branch 'main' into feature/524_add-version-to-help-text
kaklakariada 7164b7a
Update doc/spec/design.md
redcatbear 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,134 @@ | ||
| # OpenFastTrace (OFT) Skill | ||
|
|
||
| OpenFastTrace is a tool for requirement tracing across various artifacts (specifications, code, tests). | ||
|
|
||
| ## Core Concepts | ||
|
|
||
| - **Specification Items**: Normative pieces of specification or coverage markers. | ||
| - **Artifact Types**: Dynamic and not hard-coded. New types exist automatically when used in a document. | ||
| - Common: `feat`, `req`, `arch`, `dsn`, `impl`, `utest`, `itest`, `stest`, `uman`, `oman`. | ||
| - **ID Syntax**: `type~name~revision` (e.g., `req~login-feature~1`). | ||
| - `name`: Hierarchical with dots (e.g., `ui.button.save`). | ||
| - `revision`: Integer used for versioning. | ||
| - Incrementing the revision breaks all incoming links (coverage and dependencies). | ||
| - This forces covering items to be updated and re-verified. | ||
| - **Keywords**: | ||
| - `Covers: <ID>`: Current item implements/details the target ID. | ||
| - `Needs: <types>`: Artifact types required to cover this item. | ||
| - `Status: <status>`: `draft`, `proposed`, `approved`. | ||
| - `Depends: <IDs>`: Defines dependencies (no effect on coverage). | ||
| - `Description: <text>`: Optional keyword to start description. | ||
| - `Rationale: <text>`, `Comment: <text>`. | ||
|
|
||
| ## Syntax (Markdown) | ||
|
|
||
| ```markdown | ||
| ### Title | ||
| `req~id~1` | ||
| Description of the requirement. | ||
|
|
||
| Rationale: Why this is needed. | ||
|
|
||
| Covers: feat~parent~1 | ||
|
|
||
| Needs: dsn, impl, utest | ||
| ``` | ||
|
|
||
| - **Forwarding**: `arch --> dsn : req~id~1` (delegates coverage without repeating). | ||
| - **Exclusion**: Use `<!-- oft:off -->` and `<!-- oft:on -->` to skip parsing. | ||
|
|
||
| ## Tracing | ||
|
|
||
| Tracing can be performed via CLI, Maven, or Gradle. | ||
|
|
||
| ### CLI Usage | ||
|
|
||
| General form: `oft <command> [options] <files/dirs>` | ||
|
|
||
| - **Commands**: `trace` (generate report), `convert` (export format), `help` (usage and version). | ||
| - **Options for `convert` and `trace`**: | ||
| - `-o, --output-format`: `plain`, `html`, `aspec` (XML). | ||
| - `-f, --output-file`: File path (default STDOUT). | ||
| - `-a, --wanted-artifact-types`: Filter by type (Partial Tracing). | ||
| - `-t, --wanted-tags`: Filter by tags (Partial Tracing). Use `_` for items without tags (e.g., `-t _,MyTag`). | ||
| - `-v, --report-verbosity`: `quiet`, `minimal`, `summary`, `failures`, `failure_summaries`, `failure_details` (default), `all`. | ||
| - `-i, --ignore-artifact-types`: Exclude types from import. | ||
|
|
||
| ### Maven Integration | ||
|
|
||
| - **User Guide**: [openfasttrace-maven-plugin](https://github.com/itsallcode/openfasttrace-maven-plugin) | ||
|
|
||
| Add the `openfasttrace-maven-plugin` to your `pom.xml`: | ||
|
|
||
| ```xml | ||
| <plugin> | ||
| <groupId>org.itsallcode.openfasttrace</groupId> | ||
| <artifactId>openfasttrace-maven-plugin</artifactId> | ||
| <version>VERSION</version> | ||
| <executions> | ||
| <execution> | ||
| <goals><goal>trace</goal></goals> | ||
| </execution> | ||
| </executions> | ||
| <configuration> | ||
| <reportFormat>html</reportFormat> | ||
| <reportFile>target/site/tracing.html</reportFile> | ||
| </configuration> | ||
| </plugin> | ||
| ``` | ||
|
|
||
| - **Run**: `mvn openfasttrace:trace` | ||
|
|
||
| ### Gradle Integration | ||
|
|
||
| - **User Guide**: [openfasttrace-gradle](https://github.com/itsallcode/openfasttrace-gradle) | ||
|
|
||
| Apply the plugin in `build.gradle`: | ||
|
|
||
| ```gradle | ||
| plugins { | ||
| id "org.itsallcode.openfasttrace" version "VERSION" | ||
| } | ||
|
|
||
| openfasttrace { | ||
| reportFormat = "html" | ||
| } | ||
| ``` | ||
|
|
||
| - **Run**: `gradle trace` | ||
|
|
||
| ### Partial Tracing & Filtering | ||
|
|
||
| Partial tracing allows teams to focus on specific layers of the traceability chain, reducing noise and build time. | ||
|
|
||
| **Example Scenario:** | ||
| - **Product Owner (PO)**: Writes system requirements (`req`). Traces `feat` → `req` to ensure all features are specified. | ||
| - **Architect**: Writes design specifications (`dsn`). Traces `feat` + `req` → `dsn` to ensure requirements are architecturally covered. | ||
| - **Developer**: Writes implementation (`impl`) and tests (`utest`). Traces `feat`+ … + `dsn` → `impl`, `utest` to verify complete implementation and testing of the design. | ||
|
|
||
| ```text | ||
| [PO] --(feat)--> [req] | ||
| | | ||
| [Architect] -------+--(feat, req)--> [dsn] | ||
| | | ||
| [Developer] ---------------------------+--(feat, ..., dsn)--> [impl], [utest] | ||
| ``` | ||
|
|
||
| **Usage:** | ||
| - Filter by artifact types: `oft trace -a req,dsn <dir>` | ||
| - Filter by tags: `oft trace -t MyTag <dir>` | ||
| - Combine filters to focus on specific components or requirement levels. | ||
|
|
||
| ## LLM Interaction Guidelines | ||
|
|
||
| - When identifying coverage, look for `impl~<ID>`, `utest~<ID>`, `itest~<ID>` and `stest~<ID>` in comments. | ||
| - Place markers at the narrowest possible scope (method/class). | ||
| - Ensure ID consistency across specifications and code. | ||
| - **Semantic Changes**: Increment the revision when the meaning of a requirement changes. This enforces a check of all covering items as their links become invalid. | ||
| - Verify changes by running tracing. | ||
|
|
||
| ## Exit Codes | ||
|
|
||
| - `0`: Success. | ||
| - `1`: OFT error. | ||
| - `2`: Command line error. |
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 |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ doc/**/*.html | |
| /**/*.iml | ||
| /**/.project | ||
| .idea/ | ||
| .junie/ | ||
| *.iml | ||
| pom.xml.versionsBackup | ||
| .DS_Store | ||
|
|
||
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
52 changes: 52 additions & 0 deletions
52
core/src/main/java/org/itsallcode/openfasttrace/core/VersionProvider.java
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,52 @@ | ||
| package org.itsallcode.openfasttrace.core; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.net.URL; | ||
| import java.util.Properties; | ||
| import java.util.logging.Logger; | ||
|
|
||
| /** | ||
| * Provides the version of OpenFastTrace from a resource file generated during | ||
| * build. | ||
| */ | ||
| public class VersionProvider | ||
| { | ||
| private static final Logger LOGGER = Logger.getLogger(VersionProvider.class.getName()); | ||
| private static final String VERSION_PROPERTIES = "/version.properties"; | ||
| private static final String UNKNOWN_VERSION = "(unknown version)"; | ||
|
|
||
| /** | ||
| * Create a new instance of the {@link VersionProvider}. | ||
| */ | ||
| public VersionProvider() | ||
| { | ||
| // Default constructor | ||
| } | ||
|
|
||
| /** | ||
| * Loads the version number from the version.properties resource. | ||
| * | ||
| * @return the version string or "unknown" if it cannot be loaded. | ||
| */ | ||
| // [impl->dsn~cli.version~1] | ||
| public String getVersion() | ||
| { | ||
| final URL resource = getClass().getResource(VERSION_PROPERTIES); | ||
| if (resource == null) | ||
| { | ||
| return UNKNOWN_VERSION; | ||
| } | ||
| try (InputStream stream = resource.openStream()) | ||
| { | ||
| final Properties properties = new Properties(); | ||
| properties.load(stream); | ||
| return properties.getProperty("version", UNKNOWN_VERSION); | ||
| } | ||
| catch (final IOException exception) | ||
| { | ||
| LOGGER.warning("Error loading version from resource file: " + exception.getMessage()); | ||
|
redcatbear marked this conversation as resolved.
|
||
| return UNKNOWN_VERSION; | ||
| } | ||
| } | ||
| } | ||
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
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 @@ | ||
| version=${revision} |
34 changes: 34 additions & 0 deletions
34
core/src/test/java/org/itsallcode/openfasttrace/core/VersionProviderIT.java
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,34 @@ | ||
| package org.itsallcode.openfasttrace.core; | ||
|
|
||
| import static org.hamcrest.MatcherAssert.assertThat; | ||
| import static org.hamcrest.Matchers.*; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| /** | ||
| * Integration test for {@link VersionProvider}. | ||
| * <p> | ||
| * Testing the bad weather cases requires using a custom classloader. But that | ||
| * makes the test coverage invisible. So we only test the happy path. The tests | ||
| * for the bad weather cases are too involved for testing a problem that is | ||
| * unlikely to occur with a static resource. | ||
|
redcatbear marked this conversation as resolved.
|
||
| * </p> | ||
| */ | ||
| class VersionProviderIT | ||
| { | ||
| // [itest->dsn~cli.version~1] | ||
| @Test | ||
| void testLoadVersionFromProperties() | ||
| { | ||
| final String version = new VersionProvider().getVersion(); | ||
| assertThat(version, | ||
| anyOf( | ||
| allOf( | ||
| not(containsStringIgnoringCase("unknown")), | ||
| not("${version}") | ||
| ), | ||
| matchesPattern("\\d+\\.\\d+\\.\\d+") | ||
| ) | ||
| ); | ||
| } | ||
| } | ||
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
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 |
|---|---|---|
|
|
@@ -932,6 +932,32 @@ Needs: impl, itest | |
|
|
||
| ### Common | ||
|
|
||
| #### CLI Help | ||
| `dsn~cli.help~1` | ||
|
|
||
| The CLI provides a help command and flags (`help`, `-h`, `--help`) that display a short help text. | ||
|
|
||
| Covers: | ||
|
|
||
| * [`req~cli.help~1`](system_requirements.md#cli-help) | ||
|
|
||
| Needs: impl, itest | ||
|
|
||
| #### CLI Version | ||
| `dsn~cli.version~1` | ||
|
|
||
| The CLI provides the current version of OpenFastTrace read from the resource file `version.properties` that is created during the build from the property `revision` in the core POM. | ||
|
|
||
| Rationale: | ||
|
|
||
| This makes the `revision` the single source of truth for the version of OpenFastTrace and avoids having to keep manually maintained copies of the version information. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want, you can also explain why we don't use something like final VersionCollector versionCollector = new VersionCollector(
"META-INF/maven/com.exasol/mysql-virtual-schema/pom.properties");
return versionCollector.getVersionNumber();Possible rationale: doesn't work at build time during unit tests. |
||
|
|
||
| Covers: | ||
|
|
||
| * [`req~cli.version~1`](system_requirements.md#cli-version) | ||
|
|
||
| Needs: impl, itest | ||
|
|
||
| #### Input File Selection | ||
| `dsn~cli.input-file-selection~1` | ||
|
|
||
|
|
||
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.