Requirement-tagged tests

Rule

Every task requirement has at least one passing unit test whose name starts with its tag, for example [REQ-101]. One requirement may have several tests. Use only tags that appear in the task file; never invent a requirement ID. Each tagged test asserts the observable behavior the requirement states.

Do

import { describe, expect, it } from 'vitest';
import { idf } from '../../src/bm25.js';
 
describe('idf', () => {
  it('[REQ-101] matches the Lucene BM25 IDF for N=10, df=1', () => {
    expect(idf(10, 1)).toBeCloseTo(Math.log(1 + 9.5 / 1.5), 12);
  });
});

Don’t

import { describe, expect, it } from 'vitest';
import { idf } from '../../src/bm25.js';
 
describe('idf', () => {
  it('works', () => {
    expect(idf(10, 1)).toBeGreaterThan(0);
  });
});

Rationale

CI builds traceability.json by matching tags in test names to the task’s requirements, and stage S1 fails a requirement with no passing tagged test (ESC-TRACE). The tag is exempt from the placeholder check BP-01, so it is safe in test names.