test(repo): guard timeline drag helper boundaries

This commit is contained in:
2026-04-01 09:52:23 +02:00
parent 848797b4d2
commit ea4074af8f
2 changed files with 82 additions and 0 deletions
@@ -71,12 +71,21 @@ describe("architecture guardrails", () => {
it("guards the extracted timeline live preview ownership boundary", () => {
const dragRule = rules.find((rule) => rule.file === "apps/web/src/hooks/useTimelineDrag.ts");
const livePreviewRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineLivePreview.ts");
const touchRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineTouch.ts");
const multiSelectRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineMultiSelect.ts");
const rangeRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineRangeSelection.ts");
assert.ok(dragRule);
assert.ok(livePreviewRule);
assert.ok(touchRule);
assert.ok(multiSelectRule);
assert.ok(rangeRule);
assert.deepEqual(evaluateRule(dragRule, "function clearLivePreview() {}\n"), [
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep live preview behavior delegated to the extracted helper module",
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep touch fallback and drag disambiguation delegated to the extracted helper module",
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep multi-select rectangle lifecycle delegated to the extracted helper module",
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep range preview and finalization delegated to the extracted helper module",
"apps/web/src/hooks/useTimelineDrag.ts: forbidden pattern matched: timeline drag must not re-inline live preview helper implementations",
]);
@@ -84,5 +93,17 @@ describe("architecture guardrails", () => {
"apps/web/src/hooks/timelineLivePreview.ts: missing guardrail anchor: timeline live preview helpers must keep preview reset logic centralized",
"apps/web/src/hooks/timelineLivePreview.ts: missing guardrail anchor: timeline live preview helpers must keep snapshot preservation centralized",
]);
assert.deepEqual(evaluateRule(touchRule, "export function getTouchPoint() {}\n"), [
"apps/web/src/hooks/timelineTouch.ts: missing guardrail anchor: timeline touch helpers must keep scroll-vs-drag disambiguation centralized",
]);
assert.deepEqual(evaluateRule(multiSelectRule, "export function createMultiSelectState() {}\n"), [
"apps/web/src/hooks/timelineMultiSelect.ts: missing guardrail anchor: timeline multi-select helpers must keep minimal-drag reset logic centralized",
]);
assert.deepEqual(evaluateRule(rangeRule, "export function updateRangeSelectionDraft() {}\n"), [
"apps/web/src/hooks/timelineRangeSelection.ts: missing guardrail anchor: timeline range helpers must keep ordered range finalization centralized",
]);
});
});