Skip to content

Commit

Permalink
Add OpenFastTrace
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Sep 6, 2024
1 parent 6e37035 commit f8e8087
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,22 @@ jobs:
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}

requirements_coverage:
name: "Validate requiremenet coverage"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: 'false'
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21.0.2
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- run: ./gradlew traceRequirements

# This is https://github.com/marketplace/actions/gradle-wrapper-validation
# It ensures that the jar file is from gradle and not by a strange third party.
gradlevalidation:
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -898,3 +898,7 @@ jmh {
iterations = 10
fork = 2
}

requirementTracing {
inputDirectories = files('docs', 'src/main/java', 'src/test/java')
}
6 changes: 4 additions & 2 deletions docs/requirements/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ parent: Requirements
## User Interface

### Chatting with AI

Check failure on line 8 in docs/requirements/ai.md

View workflow job for this annotation

GitHub Actions / Markdown

Headings should be surrounded by blank lines

docs/requirements/ai.md:8 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Chatting with AI"] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md022.md
`req~ai.chat.new-message-based-on-previous~1`

`req~ai.chat.new-message-based-on-old-one~1`
To enable simple editing and resending of previous messages, <kbd>Cursor Up</kbd> should show last message.
This should only happen if the current text field is empty.

To enable easy editing and resending of previous messages, cursor up should show last message. (If current text field is empty)
Needs: impl
38 changes: 38 additions & 0 deletions docs/requirements/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,41 @@ has_children: true

This part of the documentation collects requirements using [OpenFastTrace](https://github.com/itsallcode/openfasttrace).

## Specifying requirements

One writes directly below a Markdown heading a requirement identifier.

Example:

```markdown
### Example
`req~ai.example~1`
```

It is important that there is no empty line directly after the heading.

## Linking implementations

Then, one writes down at the requirement.
Directly at the end, one writes that it requires an implementation:

```markdown
Needs: impl
```

One can also state that there should be detailed design document (`dsn`).
However, typically in JabRef, we go from the requirement directly to the implementation.

Then, at the implementation, a comment is added this implementation is covered:

```java
// [impl->req~ai.example~1]
```

When executing the gradle task `traceRequirements`, `build/tracing.txt` is generated.
In case of a tracing error, one can inspect this file to see which requirements were not covered.

## More Information

- [User manual of OpenFastTrace](https://github.com/itsallcode/openfasttrace/blob/main/doc/user_guide.md)
- We cannot copy and paste real examples here, because of [openfasttrace#280](https://github.com/itsallcode/openfasttrace/issues/280).
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private void initialize() {
// will be true (this is important).
}
} else if (keyEvent.getCode() == KeyCode.UP) {
// [impl->req~ai.chat.new-message-based-on-previous~1]
if ((currentUserMessageScroll.get() < history.get().size() - 1) && (userPromptTextArea.getText().isEmpty() || showingHistoryMessage.get())) {
// 1. We should not go up the maximum number of user messages.
// 2. We can scroll history only on two conditions:
Expand Down

0 comments on commit f8e8087

Please sign in to comment.