test(workspace): accept only #249 decision markers and state the lint scope

The overlay lint accepted any D-number, so another issue's ruling such
as "D5 (#245)" could mark a concept override. A marker now has to be a
D-number with no other issue cited; the vocabulary rule that cited #245
reads "#245 decision 5". TESTING.md now states that the lint covers
workspace.css only, lists the unmarked overrides still in images.css,
and says PRs C and D run the lint over each page sheet they keep.
This commit is contained in:
Vito Sansevero
2026-10-19 22:48:39 -07:00
parent f09ceb996e
commit 12aa1e51d6
4 changed files with 36 additions and 8 deletions
+9 -2
View File
@@ -6,6 +6,13 @@ import { repositoryRoot } from './vendor-viewerjs.mjs';
const CONCEPT = 'docs/concepts/workspace/style.css';
const COPY = 'web/js/workspace/concept.css';
const MARKER = /\/\*[^*]*\bD\d+\b[^*]*\*\//;
const SPEC_ISSUE = '#249';
// A decision marker names one of this spec's (#249) D-numbers. A comment that cites any other issue is that issue's
// ruling (for example #245's own D5), so it never marks a concept override here.
function isDecisionMarker(comment) {
return MARKER.test(comment) && (comment.match(/#\d+\b/g) ?? []).every(issue => issue === SPEC_ISSUE);
}
// Minimal tokenizer: walks top-level rules and the bodies of @media/@supports,
// returning each rule's normalized selectors and the comments attached to it
@@ -84,8 +91,8 @@ export function lintOverlay(conceptCss, overlayCss) {
const violations = [];
for (const rule of parseRules(overlayCss)) {
const shared = rule.selectors.filter(selector => owned.has(selector));
if (shared.length && !rule.comments.some(comment => MARKER.test(comment))) {
violations.push(`${shared.join(', ')}: overlay rule on a concept selector needs a /* D<n> */ decision marker`);
if (shared.length && !rule.comments.some(isDecisionMarker)) {
violations.push(`${shared.join(', ')}: overlay rule on a concept selector needs a /* D<n> */ (#249) decision marker`);
}
}
return { violations };