551 lines
33 KiB
HTML
551 lines
33 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en" class="navy" dir="ltr">
|
|
<head>
|
|
<!-- Book generated using mdBook -->
|
|
<meta charset="UTF-8">
|
|
<title>Traceability CI - JellyTau Documentation</title>
|
|
|
|
|
|
<!-- Custom HTML head -->
|
|
|
|
<meta name="description" content="Requirements, traceability, and architecture for the JellyTau Jellyfin client.">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="theme-color" content="#ffffff">
|
|
|
|
<link rel="icon" href="favicon.svg">
|
|
<link rel="shortcut icon" href="favicon.png">
|
|
<link rel="stylesheet" href="css/variables.css">
|
|
<link rel="stylesheet" href="css/general.css">
|
|
<link rel="stylesheet" href="css/chrome.css">
|
|
<link rel="stylesheet" href="css/print.css" media="print">
|
|
|
|
<!-- Fonts -->
|
|
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
|
|
<link rel="stylesheet" href="fonts/fonts.css">
|
|
|
|
<!-- Highlight.js Stylesheets -->
|
|
<link rel="stylesheet" href="highlight.css">
|
|
<link rel="stylesheet" href="tomorrow-night.css">
|
|
<link rel="stylesheet" href="ayu-highlight.css">
|
|
|
|
<!-- Custom theme stylesheets -->
|
|
|
|
</head>
|
|
<body class="sidebar-visible no-js">
|
|
<div id="body-container">
|
|
<!-- Provide site root to javascript -->
|
|
<script>
|
|
var path_to_root = "";
|
|
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "navy";
|
|
</script>
|
|
|
|
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
|
<script>
|
|
try {
|
|
var theme = localStorage.getItem('mdbook-theme');
|
|
var sidebar = localStorage.getItem('mdbook-sidebar');
|
|
|
|
if (theme.startsWith('"') && theme.endsWith('"')) {
|
|
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
|
}
|
|
|
|
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
|
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
|
}
|
|
} catch (e) { }
|
|
</script>
|
|
|
|
<!-- Set the theme before any content is loaded, prevents flash -->
|
|
<script>
|
|
var theme;
|
|
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
|
if (theme === null || theme === undefined) { theme = default_theme; }
|
|
var html = document.querySelector('html');
|
|
html.classList.remove('navy')
|
|
html.classList.add(theme);
|
|
var body = document.querySelector('body');
|
|
body.classList.remove('no-js')
|
|
body.classList.add('js');
|
|
</script>
|
|
|
|
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
|
|
|
|
<!-- Hide / unhide sidebar before it is displayed -->
|
|
<script>
|
|
var body = document.querySelector('body');
|
|
var sidebar = null;
|
|
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
|
|
if (document.body.clientWidth >= 1080) {
|
|
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
|
sidebar = sidebar || 'visible';
|
|
} else {
|
|
sidebar = 'hidden';
|
|
}
|
|
sidebar_toggle.checked = sidebar === 'visible';
|
|
body.classList.remove('sidebar-visible');
|
|
body.classList.add("sidebar-" + sidebar);
|
|
</script>
|
|
|
|
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
|
<div class="sidebar-scrollbox">
|
|
<ol class="chapter"><li class="chapter-item expanded affix "><a href="index.html">Introduction</a></li><li class="chapter-item expanded affix "><li class="part-title">Requirements & Traceability</li><li class="chapter-item expanded "><a href="requirements.html"><strong aria-hidden="true">1.</strong> Requirements Specification</a></li><li class="chapter-item expanded "><a href="traceability.html"><strong aria-hidden="true">2.</strong> Traceability Matrix</a></li><li class="chapter-item expanded "><a href="traceability-ci.html" class="active"><strong aria-hidden="true">3.</strong> Traceability CI</a></li><li class="chapter-item expanded "><a href="traces-quick-ref.html"><strong aria-hidden="true">4.</strong> Traces Quick Reference</a></li><li class="chapter-item expanded affix "><li class="part-title">Architecture</li><li class="chapter-item expanded "><a href="architecture/index.html"><strong aria-hidden="true">5.</strong> Overview</a><a class="toggle"><div>❱</div></a></li><li><ol class="section"><li class="chapter-item "><a href="architecture/01-rust-backend.html"><strong aria-hidden="true">5.1.</strong> Rust Backend</a></li><li class="chapter-item "><a href="architecture/02-svelte-frontend.html"><strong aria-hidden="true">5.2.</strong> Svelte Frontend</a></li><li class="chapter-item "><a href="architecture/03-data-flow.html"><strong aria-hidden="true">5.3.</strong> Data Flow</a></li><li class="chapter-item "><a href="architecture/04-type-sync-and-threading.html"><strong aria-hidden="true">5.4.</strong> Type Sync & Threading</a></li><li class="chapter-item "><a href="architecture/05-platform-backends.html"><strong aria-hidden="true">5.5.</strong> Platform Backends</a></li><li class="chapter-item "><a href="architecture/06-downloads-and-offline.html"><strong aria-hidden="true">5.6.</strong> Downloads & Offline</a></li><li class="chapter-item "><a href="architecture/07-connectivity.html"><strong aria-hidden="true">5.7.</strong> Connectivity</a></li><li class="chapter-item "><a href="architecture/08-database-design.html"><strong aria-hidden="true">5.8.</strong> Database Design</a></li><li class="chapter-item "><a href="architecture/09-security.html"><strong aria-hidden="true">5.9.</strong> Security</a></li></ol></li><li class="chapter-item expanded "><li class="part-title">UX</li><li class="chapter-item expanded "><a href="ux-flows.html"><strong aria-hidden="true">6.</strong> UX Flows</a></li><li class="chapter-item expanded affix "><li class="part-title">Specs — Pending Work</li><li class="chapter-item expanded "><a href="specs/index.html"><strong aria-hidden="true">7.</strong> Specs Index</a></li><li class="chapter-item expanded "><a href="specs/SPEC-TEMPLATE.html"><strong aria-hidden="true">8.</strong> Spec Template</a></li><li class="chapter-item expanded "><a href="specs/SPEC-REVIEW-CHECKLIST.html"><strong aria-hidden="true">9.</strong> Spec Review Checklist</a></li><li class="chapter-item expanded "><a href="specs/playback-backend-unification.html"><strong aria-hidden="true">10.</strong> Playback Backend Unification</a></li><li class="chapter-item expanded "><a href="specs/linux-native-video-spike.html"><strong aria-hidden="true">11.</strong> Linux Native Video Spike</a></li><li class="chapter-item expanded "><a href="specs/backend-owned-stream-selection.html"><strong aria-hidden="true">12.</strong> Backend-Owned Stream Selection</a></li><li class="chapter-item expanded "><a href="specs/player-facade-enforcement.html"><strong aria-hidden="true">13.</strong> Player Facade Enforcement</a></li><li class="chapter-item expanded "><a href="specs/windows-native-audio-backend.html"><strong aria-hidden="true">14.</strong> Windows Native Audio Backend</a></li><li class="chapter-item expanded "><a href="specs/libmpv2-migration.html"><strong aria-hidden="true">15.</strong> libmpv2 Migration</a></li><li class="chapter-item expanded "><a href="specs/read-through-media-cache.html"><strong aria-hidden="true">16.</strong> Read-Through Media Cache</a></li><li class="chapter-item expanded "><a href="specs/scoped-search.html"><strong aria-hidden="true">17.</strong> Scoped Search</a></li><li class="chapter-item expanded "><a href="specs/scoped-search-boundary.html"><strong aria-hidden="true">18.</strong> Scoped Search Boundary</a></li><li class="chapter-item expanded "><a href="specs/scoped-search-boundary-implementation.html"><strong aria-hidden="true">19.</strong> Scoped Search Boundary — Implementation</a></li><li class="chapter-item expanded "><a href="specs/frontend-domain-model.html"><strong aria-hidden="true">20.</strong> Frontend Domain Model</a></li><li class="chapter-item expanded "><a href="specs/build-provenance.html"><strong aria-hidden="true">21.</strong> Build Provenance</a></li><li class="chapter-item expanded affix "><li class="part-title">Build & Release</li><li class="chapter-item expanded "><a href="build/build-release.html"><strong aria-hidden="true">22.</strong> Build & Release</a></li><li class="chapter-item expanded "><a href="release-checklist.html"><strong aria-hidden="true">23.</strong> Release Checklist</a></li><li class="chapter-item expanded "><a href="build/build-desktop-packages.html"><strong aria-hidden="true">24.</strong> Desktop Packaging</a></li><li class="chapter-item expanded "><a href="build/build-windows.html"><strong aria-hidden="true">25.</strong> Windows Build</a></li><li class="chapter-item expanded "><a href="defect-windows.html"><strong aria-hidden="true">26.</strong> Defect Windows</a></li><li class="chapter-item expanded "><a href="build/docker.html"><strong aria-hidden="true">27.</strong> Docker</a></li><li class="chapter-item expanded "><a href="build/build-builder-image.html"><strong aria-hidden="true">28.</strong> Builder Image</a></li><li class="chapter-item expanded affix "><li class="spacer"></li><li class="chapter-item expanded affix "><a href="api-redirect.html">Rust API Reference (rustdoc)</a></li></ol>
|
|
</div>
|
|
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
|
|
<div class="sidebar-resize-indicator"></div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- Track and set sidebar scroll position -->
|
|
<script>
|
|
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
|
|
sidebarScrollbox.addEventListener('click', function(e) {
|
|
if (e.target.tagName === 'A') {
|
|
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
|
|
}
|
|
}, { passive: true });
|
|
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
|
|
sessionStorage.removeItem('sidebar-scroll');
|
|
if (sidebarScrollTop) {
|
|
// preserve sidebar scroll position when navigating via links within sidebar
|
|
sidebarScrollbox.scrollTop = sidebarScrollTop;
|
|
} else {
|
|
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
|
|
var activeSection = document.querySelector('#sidebar .active');
|
|
if (activeSection) {
|
|
activeSection.scrollIntoView({ block: 'center' });
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<div id="page-wrapper" class="page-wrapper">
|
|
|
|
<div class="page">
|
|
<div id="menu-bar-hover-placeholder"></div>
|
|
<div id="menu-bar" class="menu-bar sticky">
|
|
<div class="left-buttons">
|
|
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
|
|
<i class="fa fa-bars"></i>
|
|
</label>
|
|
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
|
|
<i class="fa fa-paint-brush"></i>
|
|
</button>
|
|
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
|
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
|
|
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
|
|
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
|
|
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
|
|
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
|
|
</ul>
|
|
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
|
|
<i class="fa fa-search"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<h1 class="menu-title">JellyTau Documentation</h1>
|
|
|
|
<div class="right-buttons">
|
|
<a href="print.html" title="Print this book" aria-label="Print this book">
|
|
<i id="print-button" class="fa fa-print"></i>
|
|
</a>
|
|
<a href="https://gitea.tourolle.paris/dtourolle/jellytau" title="Git repository" aria-label="Git repository">
|
|
<i id="git-repository-button" class="fa fa-github"></i>
|
|
</a>
|
|
<a href="https://gitea.tourolle.paris/dtourolle/jellytau/_edit/master/docs/../docs/traceability-ci.md" title="Suggest an edit" aria-label="Suggest an edit">
|
|
<i id="git-edit-button" class="fa fa-edit"></i>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="search-wrapper" class="hidden">
|
|
<form id="searchbar-outer" class="searchbar-outer">
|
|
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
|
|
</form>
|
|
<div id="searchresults-outer" class="searchresults-outer hidden">
|
|
<div id="searchresults-header" class="searchresults-header"></div>
|
|
<ul id="searchresults">
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
|
<script>
|
|
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
|
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
|
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
|
|
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
|
});
|
|
</script>
|
|
|
|
<div id="content" class="content">
|
|
<main>
|
|
<h1 id="requirement-traceability-cicd-pipeline"><a class="header" href="#requirement-traceability-cicd-pipeline">Requirement Traceability CI/CD Pipeline</a></h1>
|
|
<p>This document explains the automated requirement traceability validation system for JellyTau.</p>
|
|
<h2 id="overview"><a class="header" href="#overview">Overview</a></h2>
|
|
<p>The CI/CD pipeline automatically validates that code changes are properly traced to requirements. This ensures:</p>
|
|
<ul>
|
|
<li>✅ Requirements are implemented with clear traceability</li>
|
|
<li>✅ No requirement coverage regressions</li>
|
|
<li>✅ Code changes are linked to specific requirements</li>
|
|
<li>✅ Quality metrics are tracked over time</li>
|
|
</ul>
|
|
<h2 id="gitea-actions-workflows"><a class="header" href="#gitea-actions-workflows">Gitea Actions Workflows</a></h2>
|
|
<p>Traceability validation lives in <code>.gitea/workflows/traceability-check.yml</code>:</p>
|
|
<ul>
|
|
<li>✅ Automatic trace extraction</li>
|
|
<li>✅ Coverage validation against minimum threshold (88%, ratcheted)</li>
|
|
<li>✅ Modified file checking</li>
|
|
<li>✅ Artifact preservation</li>
|
|
<li>✅ Summary reports</li>
|
|
</ul>
|
|
<p><strong>Runs on:</strong> Every push and pull request to <code>master</code>/<code>main</code>/<code>develop</code></p>
|
|
<p>A second workflow, <code>traceability.yml</code>, previously duplicated this one as a
|
|
"GitHub-compatible alternative". It was removed: CI here is Gitea Actions, and
|
|
its only unique step (PR comments via <code>actions/github-script</code>) depended on the
|
|
GitHub REST client, which Gitea does not provide. To add PR comments, post to
|
|
Gitea's <code>/api/v1/repos/{owner}/{repo}/issues/{index}/comments</code> from
|
|
<code>traceability-check.yml</code> rather than reviving the old file.</p>
|
|
<h2 id="what-gets-validated"><a class="header" href="#what-gets-validated">What Gets Validated</a></h2>
|
|
<h3 id="1-trace-extraction"><a class="header" href="#1-trace-extraction">1. Trace Extraction</a></h3>
|
|
<pre><code class="language-bash">bun run traces:json > traces-report.json
|
|
</code></pre>
|
|
<p>Extracts all TRACES comments from:</p>
|
|
<ul>
|
|
<li>TypeScript files (<code>src/**/*.ts</code>)</li>
|
|
<li>Svelte components (<code>src/**/*.svelte</code>)</li>
|
|
<li>Rust code (<code>src-tauri/src/**/*.rs</code>)</li>
|
|
<li>Test files</li>
|
|
</ul>
|
|
<h3 id="2-coverage-thresholds"><a class="header" href="#2-coverage-thresholds">2. Coverage Thresholds</a></h3>
|
|
<p>The workflow checks:</p>
|
|
<ul>
|
|
<li><strong>Minimum overall coverage:</strong> 88% (<code>MIN_THRESHOLD</code>)</li>
|
|
</ul>
|
|
<p>Denominators are <strong>derived from <code>docs/requirements.md</code> at run time</strong> — they are
|
|
never hardcoded here or in the workflow. Run <code>bun run traces:coverage</code> for the
|
|
current per-type breakdown; any number written into this document is a snapshot
|
|
that will drift.</p>
|
|
<blockquote>
|
|
<p><strong>Why this matters.</strong> The workflow used to divide by frozen literals
|
|
(UR/39, IR/24, DR/48, JA/3, total 114) while <code>requirements.md</code> had grown past
|
|
200. It reported <strong>158%</strong> coverage, so the 50% threshold was unreachable and
|
|
the job could not fail regardless of how far coverage dropped. See
|
|
The fix derives the denominators from <code>requirements.md</code> at run time.</p>
|
|
</blockquote>
|
|
<p>Coverage is the <em>intersection</em> of traced and defined IDs: an ID that appears in
|
|
a <code>TRACES:</code> comment but is not defined in <code>requirements.md</code> is reported as
|
|
<strong>orphaned</strong> and does not count toward coverage. UT/IT test identifiers are a
|
|
separate taxonomy and are excluded entirely.</p>
|
|
<p>The workflow <strong>fails</strong> and blocks merge if coverage drops below the threshold —
|
|
or if it computes above 100%, which can only mean the gate is miscounting.</p>
|
|
<h4 id="ratchet-policy"><a class="header" href="#ratchet-policy">Ratchet policy</a></h4>
|
|
<p><code>MIN_THRESHOLD</code> <strong>only ever goes up.</strong> It is deliberately set a few points below
|
|
the coverage actually achieved (88 against a real ~90%), so a genuine regression
|
|
trips it. It previously sat at 50 while true coverage was 86%: nearly half the
|
|
matrix could have rotted before CI objected. It was ratcheted 50 → 82 when that
|
|
was found, and 82 → 88 once coverage had held above 88% for several releases.</p>
|
|
<p>When coverage rises durably, raise the threshold to just under the new figure.
|
|
<strong>Never lower it to make a red build pass</strong> — add the missing TRACES comments
|
|
instead. The same number lives in <code>MIN_COVERAGE_PERCENT</code> in
|
|
<code>scripts/extract-traces.ts</code> (so <code>bun run traces:coverage</code> gates locally on the
|
|
same bar); <code>scripts/extract-traces.test.ts</code> fails if the two drift apart.</p>
|
|
<h3 id="2b-dangling-requirement-ids"><a class="header" href="#2b-dangling-requirement-ids">2b. Dangling requirement IDs</a></h3>
|
|
<pre><code class="language-bash">bun run traces:validate
|
|
</code></pre>
|
|
<p>Every ID named by a <code>TRACES:</code> comment must be defined as a table row in
|
|
<code>docs/requirements.md</code>. The extractor used to accept any well-formed ID
|
|
silently, so a typo or a rename that missed a call site passed unnoticed —
|
|
<code>DR-189</code> and <code>UT-188</code> were referenced from three source files, defined nowhere,
|
|
for months.</p>
|
|
<p>This check spans <strong>all six</strong> ID types (UR/IR/DR/JA/UT/IT), unlike the coverage
|
|
<code>orphaned</code> list above, which considers only the four requirement types so that
|
|
UT/IT noise cannot bury a real typo in the ratio's reporting. The workflow step
|
|
<strong>fails the build</strong> on any dangling ID and prints each offender with the files
|
|
that reference it.</p>
|
|
<h3 id="3-modified-file-checking"><a class="header" href="#3-modified-file-checking">3. Modified File Checking</a></h3>
|
|
<p>On pull requests, the workflow:</p>
|
|
<ol>
|
|
<li>Detects all changed TypeScript/Svelte/Rust files</li>
|
|
<li>Warns if new/modified files lack TRACES comments</li>
|
|
<li>Suggests the TRACES format for missing comments</li>
|
|
</ol>
|
|
<h2 id="how-to-add-traces-to-new-code"><a class="header" href="#how-to-add-traces-to-new-code">How to Add Traces to New Code</a></h2>
|
|
<p>When you add new code or modify existing code, include TRACES comments:</p>
|
|
<h3 id="typescriptsvelte-example"><a class="header" href="#typescriptsvelte-example">TypeScript/Svelte Example</a></h3>
|
|
<pre><code class="language-typescript">// TRACES: UR-005, UR-026 | DR-029
|
|
export function handlePlayback() {
|
|
// Implementation...
|
|
}
|
|
</code></pre>
|
|
<h3 id="rust-example"><a class="header" href="#rust-example">Rust Example</a></h3>
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
|
</span><span class="boring">fn main() {
|
|
</span>/// TRACES: UR-005 | DR-001
|
|
pub fn player_state_changed(state: PlayerState) {
|
|
// Implementation...
|
|
}
|
|
<span class="boring">}</span></code></pre></pre>
|
|
<h3 id="test-example"><a class="header" href="#test-example">Test Example</a></h3>
|
|
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
|
</span><span class="boring">fn main() {
|
|
</span>// TRACES: UR-005 | DR-001 | UT-026, UT-027
|
|
#[cfg(test)]
|
|
mod tests {
|
|
// Tests...
|
|
}
|
|
<span class="boring">}</span></code></pre></pre>
|
|
<h2 id="traces-format"><a class="header" href="#traces-format">TRACES Format</a></h2>
|
|
<pre><code>TRACES: [UR-###, ...] | [IR-###, ...] | [DR-###, ...] | [JA-###, ...]
|
|
</code></pre>
|
|
<ul>
|
|
<li><code>UR-###</code> - User Requirements (features users see)</li>
|
|
<li><code>IR-###</code> - Integration Requirements (API/platform integration)</li>
|
|
<li><code>DR-###</code> - Development Requirements (internal architecture)</li>
|
|
<li><code>JA-###</code> - Jellyfin API Requirements (Jellyfin API usage)</li>
|
|
</ul>
|
|
<p><strong>Examples:</strong></p>
|
|
<ul>
|
|
<li><code>// TRACES: UR-005</code> - Single requirement</li>
|
|
<li><code>// TRACES: UR-005, UR-026</code> - Multiple of same type</li>
|
|
<li><code>// TRACES: UR-005 | DR-029</code> - Multiple types</li>
|
|
<li><code>// TRACES: UR-005, UR-026 | DR-001, DR-029 | UT-001</code> - Complex</li>
|
|
</ul>
|
|
<h2 id="workflow-behavior"><a class="header" href="#workflow-behavior">Workflow Behavior</a></h2>
|
|
<h3 id="on-push-to-main-branch"><a class="header" href="#on-push-to-main-branch">On Push to Main Branch</a></h3>
|
|
<ol>
|
|
<li>✅ Extracts all traces from code</li>
|
|
<li>✅ Validates coverage is >= 88%</li>
|
|
<li>✅ Generates full traceability report</li>
|
|
<li>✅ Saves report as artifact</li>
|
|
</ol>
|
|
<h3 id="on-pull-request"><a class="header" href="#on-pull-request">On Pull Request</a></h3>
|
|
<ol>
|
|
<li>✅ Extracts all traces</li>
|
|
<li>✅ Validates coverage >= 88%</li>
|
|
<li>✅ Checks modified files for TRACES</li>
|
|
<li>✅ Warns if new code lacks TRACES</li>
|
|
<li>✅ Suggests proper format</li>
|
|
<li>✅ Generates report artifact</li>
|
|
</ol>
|
|
<h3 id="failure-scenarios"><a class="header" href="#failure-scenarios">Failure Scenarios</a></h3>
|
|
<p>The workflow <strong>fails</strong> (blocks merge) if:</p>
|
|
<ul>
|
|
<li>Coverage drops below 88%</li>
|
|
<li>A <code>TRACES:</code> comment names an ID <code>docs/requirements.md</code> does not define</li>
|
|
<li>JSON extraction fails</li>
|
|
<li>Invalid trace format</li>
|
|
</ul>
|
|
<p>The workflow <strong>warns</strong> (but doesn't block) if:</p>
|
|
<ul>
|
|
<li>New files lack TRACES comments</li>
|
|
<li>Coverage drops (but still above threshold)</li>
|
|
</ul>
|
|
<h2 id="viewing-reports"><a class="header" href="#viewing-reports">Viewing Reports</a></h2>
|
|
<h3 id="in-gitea-actions-ui"><a class="header" href="#in-gitea-actions-ui">In Gitea Actions UI</a></h3>
|
|
<ol>
|
|
<li>Go to <strong>Actions</strong> tab</li>
|
|
<li>Click the <strong>Traceability Validation</strong> workflow run</li>
|
|
<li>Download <strong>traceability-reports</strong> artifact</li>
|
|
<li>View:
|
|
<ul>
|
|
<li><code>traces-report.json</code> - Raw trace data</li>
|
|
<li><code>docs/traceability.md</code> - Formatted report</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
<h3 id="locally"><a class="header" href="#locally">Locally</a></h3>
|
|
<pre><code class="language-bash"># Extract current traces
|
|
bun run traces:json | jq '.byType'
|
|
|
|
# Generate full report
|
|
bun run traces:markdown
|
|
cat docs/traceability.md
|
|
</code></pre>
|
|
<h2 id="coverage-goals"><a class="header" href="#coverage-goals">Coverage Goals</a></h2>
|
|
<h3 id="current-status"><a class="header" href="#current-status">Current Status</a></h3>
|
|
<p>Run <code>bun run traces:coverage</code> — it prints the live figure and exits non-zero
|
|
below threshold. Numbers are deliberately not pinned here; the previous snapshot
|
|
in this section (51%, 56/114) was stale by roughly 100 requirements and was what
|
|
made the broken CI arithmetic look plausible for so long.</p>
|
|
<p>As of August 2026 overall coverage is ~90%.</p>
|
|
<h3 id="targets"><a class="header" href="#targets">Targets</a></h3>
|
|
<ul>
|
|
<li><strong>Short term</strong> (Sprint): Maintain ≥88% overall (the current ratchet)</li>
|
|
<li><strong>Medium term</strong> (Month): Hold above 90% and ratchet the gate to match</li>
|
|
<li><strong>Long term</strong> (Release): Reach 95% coverage with focus on:
|
|
<ul>
|
|
<li>IR requirements (API clients)</li>
|
|
<li>JA requirements (Jellyfin API endpoints)</li>
|
|
<li>Remaining UR/DR requirements</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h2 id="improving-coverage"><a class="header" href="#improving-coverage">Improving Coverage</a></h2>
|
|
<h3 id="for-missing-user-requirements-ur"><a class="header" href="#for-missing-user-requirements-ur">For Missing User Requirements (UR)</a></h3>
|
|
<ol>
|
|
<li>Review <a href="../README.html">README.md</a> for unimplemented features</li>
|
|
<li>Add TRACES to code that implements them</li>
|
|
<li>Focus on high-priority features (High/Medium priority)</li>
|
|
</ol>
|
|
<h3 id="for-missing-integration-requirements-ir"><a class="header" href="#for-missing-integration-requirements-ir">For Missing Integration Requirements (IR)</a></h3>
|
|
<ol>
|
|
<li>Add TRACES to Jellyfin API client methods</li>
|
|
<li>Add TRACES to platform-specific backends (Android/Linux)</li>
|
|
<li>Link to corresponding Jellyfin API endpoints</li>
|
|
</ol>
|
|
<h3 id="for-missing-development-requirements-dr"><a class="header" href="#for-missing-development-requirements-dr">For Missing Development Requirements (DR)</a></h3>
|
|
<ol>
|
|
<li>Add TRACES to UI components in <code>src/lib/components/</code></li>
|
|
<li>Add TRACES to composables in <code>src/lib/composables/</code></li>
|
|
<li>Add TRACES to player backend in <code>src-tauri/src/player/</code></li>
|
|
</ol>
|
|
<h3 id="for-jellyfin-api-requirements-ja"><a class="header" href="#for-jellyfin-api-requirements-ja">For Jellyfin API Requirements (JA)</a></h3>
|
|
<ol>
|
|
<li>Add TRACES to Jellyfin API wrapper methods</li>
|
|
<li>Document which endpoints map to which requirements</li>
|
|
<li>Link to Jellyfin API documentation</li>
|
|
</ol>
|
|
<h2 id="example-pr-checklist"><a class="header" href="#example-pr-checklist">Example PR Checklist</a></h2>
|
|
<p>When submitting a pull request:</p>
|
|
<ul>
|
|
<li><input disabled="" type="checkbox"/>
|
|
All new code has TRACES comments linking to requirements</li>
|
|
<li><input disabled="" type="checkbox"/>
|
|
TRACES format is correct: <code>// TRACES: UR-001 | DR-002</code></li>
|
|
<li><input disabled="" type="checkbox"/>
|
|
Workflow passes (coverage ≥ 88%)</li>
|
|
<li><input disabled="" type="checkbox"/>
|
|
No coverage regressions</li>
|
|
<li><input disabled="" type="checkbox"/>
|
|
Artifact traceability report was generated</li>
|
|
</ul>
|
|
<h2 id="troubleshooting"><a class="header" href="#troubleshooting">Troubleshooting</a></h2>
|
|
<h3 id="coverage-below-minimum-threshold"><a class="header" href="#coverage-below-minimum-threshold">"Coverage below minimum threshold"</a></h3>
|
|
<p><strong>Problem:</strong> Workflow fails with coverage < 88%</p>
|
|
<p><strong>Solution:</strong></p>
|
|
<ol>
|
|
<li>Run <code>bun run traces:json</code> locally</li>
|
|
<li>Check which requirements are traced</li>
|
|
<li>Add TRACES to untraced code sections</li>
|
|
<li>Re-run extraction to verify</li>
|
|
</ol>
|
|
<h3 id="new-files-without-traces"><a class="header" href="#new-files-without-traces">"New files without TRACES"</a></h3>
|
|
<p><strong>Problem:</strong> Workflow warns about new files lacking TRACES</p>
|
|
<p><strong>Solution:</strong></p>
|
|
<ol>
|
|
<li>Add TRACES comments to all new code</li>
|
|
<li>Format: <code>// TRACES: UR-001 | DR-002</code></li>
|
|
<li>Map code to specific requirements from README.md</li>
|
|
<li>Re-push</li>
|
|
</ol>
|
|
<h3 id="invalid-json-format"><a class="header" href="#invalid-json-format">"Invalid JSON format"</a></h3>
|
|
<p><strong>Problem:</strong> Trace extraction produces invalid JSON</p>
|
|
<p><strong>Solution:</strong></p>
|
|
<ol>
|
|
<li>Check for malformed TRACES comments</li>
|
|
<li>Run locally: <code>bun run traces:json</code></li>
|
|
<li>Look for parsing errors</li>
|
|
<li>Fix and retry</li>
|
|
</ol>
|
|
<h2 id="integration-with-development"><a class="header" href="#integration-with-development">Integration with Development</a></h2>
|
|
<h3 id="before-committing"><a class="header" href="#before-committing">Before Committing</a></h3>
|
|
<pre><code class="language-bash"># Check your traces
|
|
bun run traces:json | jq '.byType'
|
|
|
|
# Regenerate report
|
|
bun run traces:markdown
|
|
|
|
# Verify traces syntax
|
|
grep "TRACES:" src/**/*.ts src/**/*.rs
|
|
</code></pre>
|
|
<h3 id="in-your-ide"><a class="header" href="#in-your-ide">In Your IDE</a></h3>
|
|
<p>Add a file watcher to regenerate traces on save:</p>
|
|
<pre><code class="language-json">{
|
|
"fileWatcher.watchPatterns": [
|
|
"src/**/*.ts",
|
|
"src/**/*.svelte",
|
|
"src-tauri/src/**/*.rs"
|
|
],
|
|
"fileWatcher.command": "bun run traces:markdown"
|
|
}
|
|
</code></pre>
|
|
<h3 id="git-hooks"><a class="header" href="#git-hooks">Git Hooks</a></h3>
|
|
<p>Add a pre-push hook to validate traces:</p>
|
|
<pre><code class="language-bash">#!/bin/bash
|
|
# .git/hooks/pre-push
|
|
bun run traces:json > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "❌ Invalid TRACES format"
|
|
exit 1
|
|
fi
|
|
</code></pre>
|
|
<h2 id="references"><a class="header" href="#references">References</a></h2>
|
|
<ul>
|
|
<li><a href="../scripts/README.html#extract-tracests">Extract Traces Script</a></li>
|
|
<li><a href="../README.html#requirements-specification">Requirements Specification</a></li>
|
|
<li><a href="./traceability.html">Traceability Matrix</a></li>
|
|
<li><a href="https://docs.gitea.io/en-us/actions/">Gitea Actions Documentation</a></li>
|
|
</ul>
|
|
<h2 id="support"><a class="header" href="#support">Support</a></h2>
|
|
<p>For issues or questions:</p>
|
|
<ol>
|
|
<li>Check this document</li>
|
|
<li>Review example traces in <code>src/lib/stores/</code></li>
|
|
<li>Check existing TRACES comments for format</li>
|
|
<li>Review workflow logs in Gitea Actions</li>
|
|
</ol>
|
|
<hr />
|
|
<p><strong>Last Updated:</strong> 2026-02-13</p>
|
|
|
|
</main>
|
|
|
|
<nav class="nav-wrapper" aria-label="Page navigation">
|
|
<!-- Mobile navigation buttons -->
|
|
<a rel="prev" href="traceability.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
|
<i class="fa fa-angle-left"></i>
|
|
</a>
|
|
|
|
<a rel="next prefetch" href="traces-quick-ref.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
|
<i class="fa fa-angle-right"></i>
|
|
</a>
|
|
|
|
<div style="clear: both"></div>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
|
|
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
|
<a rel="prev" href="traceability.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
|
<i class="fa fa-angle-left"></i>
|
|
</a>
|
|
|
|
<a rel="next prefetch" href="traces-quick-ref.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
|
<i class="fa fa-angle-right"></i>
|
|
</a>
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
window.playground_copyable = true;
|
|
</script>
|
|
|
|
|
|
<script src="elasticlunr.min.js"></script>
|
|
<script src="mark.min.js"></script>
|
|
<script src="searcher.js"></script>
|
|
|
|
<script src="clipboard.min.js"></script>
|
|
<script src="highlight.js"></script>
|
|
<script src="book.js"></script>
|
|
|
|
<!-- Custom JS scripts -->
|
|
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|