-
Notifications
You must be signed in to change notification settings - Fork 10
draft: Add requirements tracking #92
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
base: main
Are you sure you want to change the base?
Changes from 9 commits
c3f4fec
fe1183d
5006a25
fd8a12b
6cbaadd
bc8ac3a
75f9490
a331112
d04f272
55d7b93
fc4cc8a
6ff9897
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Sync Requirements to GitHub Issues | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, public-main] | ||
| paths: | ||
| - 'requirements/requirements.json' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: requirements-sync | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| sync: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Sync issues and project | ||
| env: | ||
| GH_TOKEN: ${{ secrets.PROJECT_TOKEN || secrets.GITHUB_TOKEN }} | ||
| GITHUB_REPOSITORY: ${{ github.repository }} | ||
| run: ./requirements/sync-issues.sh | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,72 @@ | ||||||
| # Requirements Tracking | ||||||
|
|
||||||
| This directory contains tooling to track project requirements as GitHub Issues, managed via a GitHub Project board. | ||||||
|
|
||||||
| ## How It Works | ||||||
|
|
||||||
| 1. **`requirements.json`** is the source of truth. Each requirement declares its description, test details, labels, and (once synced) the corresponding GitHub issue number. | ||||||
| 2. **`sync-issues.sh`** reads the JSON and creates or updates GitHub Issues and a GitHub Project. | ||||||
| 3. **`update-results.sh`** takes `go test -json` output and posts pass/fail results as comments on the corresponding issues. | ||||||
|
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. Documentation doesn't match script behavior. Line 9 states 📝 Suggested fix-3. **`update-results.sh`** takes `go test -json` output and posts pass/fail results as comments on the corresponding issues.
+3. **`update-results.sh`** runs each requirement's `test_implementation` command and posts pass/fail results as comments on the corresponding issues.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| 4. **GitHub Actions** automate both steps — syncing on push and posting test results on a schedule. | ||||||
|
|
||||||
| ## JSON Schema | ||||||
|
|
||||||
| Each entry in `requirements.json`: | ||||||
|
|
||||||
| | Field | Type | Description | | ||||||
| |--------------------|------------|--------------------------------------------------------------| | ||||||
| | `id` | string | Stable identifier, e.g. `REQ-001`. Never changes. | | ||||||
| | `requirement` | string | Brief description of the requirement. | | ||||||
| | `test_description` | string | What the test verifies / acceptance criteria. | | ||||||
| | `test_implementation` | string | Go test reference: `package/path::TestFunctionName`. | | ||||||
| | `labels` | string[] | GitHub labels to apply (created automatically if missing). | | ||||||
| | `issue_number` | int\|null | Populated by `sync-issues.sh`. Do not edit manually. | | ||||||
|
Comment on lines
+21
to
+23
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. Schema documentation references a field the scripts don't use. The 📝 Suggested fixEither remove the field from the documentation: | `test_implementation` | string | Go test reference: `package/path::TestFunctionName`. |
| `labels` | string[] | GitHub labels to apply (created automatically if missing). |
-| `issue_number` | int\|null | Populated by `sync-issues.sh`. Do not edit manually. |Or clarify it's optional/unused: -| `issue_number` | int\|null | Populated by `sync-issues.sh`. Do not edit manually. |
+| `issue_number` | int\|null | (Optional) Stored issue number. Currently unused; scripts find issues by REQ-XXX label. |🤖 Prompt for AI Agents |
||||||
|
|
||||||
| ## Local Usage | ||||||
|
|
||||||
| ### Prerequisites | ||||||
|
|
||||||
| - [`gh`](https://cli.github.com/) CLI installed and authenticated (`gh auth login`) | ||||||
| - [`jq`](https://jqlang.github.io/jq/) installed | ||||||
| - `GITHUB_REPOSITORY` env var set (or let the script auto-detect from `gh`) | ||||||
|
|
||||||
| ### Sync requirements to issues | ||||||
|
|
||||||
| ```bash | ||||||
| # Dry run (no changes made) | ||||||
| ./requirements/sync-issues.sh --dry-run | ||||||
|
|
||||||
| # Create/update issues and project | ||||||
| ./requirements/sync-issues.sh | ||||||
| ``` | ||||||
|
|
||||||
| After creating new issues, the script updates `requirements.json` with issue numbers. Commit this change. | ||||||
|
|
||||||
| ### Post test results | ||||||
|
|
||||||
| ```bash | ||||||
| # Run tests and pipe to the results script | ||||||
| go test ./... -json 2>&1 | ./requirements/update-results.sh | ||||||
| ``` | ||||||
|
Comment on lines
+47
to
+50
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. Example usage is incorrect. The example shows piping 📝 Suggested fix ### Post test results
```bash
-# Run tests and pipe to the results script
-go test ./... -json 2>&1 | ./requirements/update-results.sh
+# Run requirement tests and post results to issues
+./requirements/update-results.sh
+
+# Or test specific requirements
+./requirements/update-results.sh REQ-001 REQ-002
+
+# Dry run (no GitHub updates)
+./requirements/update-results.sh --dry-runVerify each finding against the current code and only fix it if needed. In |
||||||
|
|
||||||
| ### Adding a new requirement | ||||||
|
|
||||||
| 1. Add an entry to `requirements.json` with a new `id` and `"issue_number": null`. | ||||||
| 2. Run `sync-issues.sh` (or push to main — the GitHub Action will handle it). | ||||||
| 3. The script creates the issue and writes the number back to the JSON. | ||||||
|
|
||||||
|
Comment on lines
+52
to
+57
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. Adding a new requirement section is inconsistent with actual workflow. The documentation says 📝 Suggested fix ### Adding a new requirement
-1. Add an entry to `requirements.json` with a new `id` and `"issue_number": null`.
+1. Add an entry to `requirements.json` with a new `id`, requirement text, labels, and optionally a `test_implementation`.
2. Run `sync-issues.sh` (or push to main — the GitHub Action will handle it).
-3. The script creates the issue and writes the number back to the JSON.
+3. The script creates the issue with a `REQ-XXX` label matching the `id`. No JSON modifications are needed.🤖 Prompt for AI Agents |
||||||
| ## GitHub Actions | ||||||
|
|
||||||
| ### `requirements-sync.yml` | ||||||
|
|
||||||
| Runs automatically when `requirements/requirements.json` is pushed to `main`. Creates/updates issues, then commits the updated JSON back with `[skip ci]` to avoid loops. | ||||||
|
|
||||||
| ### `requirements-results.yml` | ||||||
|
|
||||||
| Runs on weekdays at 06:00 UTC (and via manual dispatch). Runs `go test`, posts results to the matching issues as comments. | ||||||
|
|
||||||
| ### Secrets | ||||||
|
|
||||||
| | Secret | Required | Purpose | | ||||||
| |-----------------|----------|------------------------------------------------------------| | ||||||
| | `PROJECT_TOKEN` | Optional | PAT with `project` scope for GitHub Projects v2 operations. Falls back to `GITHUB_TOKEN` (which works for issues but not projects). | | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
projects: writepermission for GitHub Projects integration.The
sync-issues.shscript usesgh projectcommands (item-add, field-create, item-edit) which require theprojects: writepermission. Without it, project operations will silently fail when falling back toGITHUB_TOKEN.Either add the permission or document that
PROJECT_TOKENsecret must be configured with appropriate scopes:🔧 Option 1: Add permission (if using fine-grained PAT or GitHub App)
permissions: contents: read issues: write + projects: write📝 Option 2: Document PROJECT_TOKEN requirement
Add a comment in the workflow or README explaining that
PROJECT_TOKENsecret must be a PAT withrepoandprojectscopes for full functionality, otherwise project sync will be skipped with warnings.📝 Committable suggestion
🤖 Prompt for AI Agents