Skip to content

feat(v6.3.0): SDD document path unification #162

feat(v6.3.0): SDD document path unification

feat(v6.3.0): SDD document path unification #162

# MUSUBI Traceability Check GitHub Action
#
# This workflow ensures complete traceability from requirements to tests
# Implements Constitutional Article V: Complete Traceability
name: Traceability Check
on:
pull_request:
branches: [main, develop]
push:
branches: [main]
workflow_dispatch:
inputs:
strictness:
description: 'Strictness level (strict/standard/relaxed)'
required: false
default: 'standard'
threshold:
description: 'Minimum coverage threshold (%)'
required: false
default: '80'
permissions:
contents: read
issues: write
pull-requests: write
jobs:
traceability:
name: Traceability Validation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run Traceability Check
id: trace
run: |
# Note: MUSUBI is a development tool, not a product with formal requirements.
# The docs/requirements/ directory contains templates for users, not actual product requirements.
# Using relaxed mode as this is a developer tool with example/template requirements.
STRICTNESS="${{ github.event.inputs.strictness || 'relaxed' }}"
THRESHOLD="${{ github.event.inputs.threshold || '0' }}"
echo "Running traceability check with strictness=$STRICTNESS, threshold=$THRESHOLD%"
npx musubi-trace ci-check \
--strictness "$STRICTNESS" \
--threshold "$THRESHOLD" \
--format json \
--output traceability-report.json
# Also generate HTML report
npx musubi-trace report \
--format html \
--output traceability-report.html
- name: Upload Traceability Report
uses: actions/upload-artifact@v4
if: always()
with:
name: traceability-report
path: |
traceability-report.json
traceability-report.html
retention-days: 30
- name: Comment on PR
if: github.event_name == 'pull_request' && always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let report = {};
try {
report = JSON.parse(fs.readFileSync('traceability-report.json', 'utf8'));
} catch (e) {
report = { passed: false, error: e.message };
}
const passed = report.passed === true;
const coverage = report.coverage || {};
const gaps = report.gaps || {};
const status = passed ? '✅ Passed' : '❌ Failed';
const body = `## 📊 Traceability Check ${status}
### Coverage Summary
| Category | Coverage |
|----------|----------|
| Design | ${coverage.designCoverage || 0}% |
| Tasks | ${coverage.tasksCoverage || 0}% |
| Code | ${coverage.codeCoverage || 0}% |
| Tests | ${coverage.testsCoverage || 0}% |
| **Overall** | **${coverage.overall || 0}%** |
${!passed ? `
### ⚠️ Issues Found
- Orphaned Requirements: ${gaps.orphanedRequirements?.length || 0}
- Untested Code: ${gaps.untestedCode?.length || 0}
- Missing Tests: ${gaps.missingTests?.length || 0}
` : ''}
<details>
<summary>View Full Report</summary>
Download the artifact for the complete HTML report.
</details>
---
*Generated by MUSUBI Traceability Check*
`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body
});
- name: Fail if traceability check failed
if: failure()
run: |
echo "Traceability check failed!"
echo "Please ensure all requirements are properly linked to design, code, and tests."
exit 1