refactor(web): extract multi-select session

This commit is contained in:
2026-04-01 11:14:28 +02:00
parent b14be80e32
commit 0181f2b304
5 changed files with 238 additions and 33 deletions
+15
View File
@@ -168,6 +168,17 @@ export const rules = [
],
forbidden: [],
},
{
file: "apps/web/src/hooks/timelineMultiSelectSession.ts",
maxLines: 90,
required: [
{
pattern: /\bexport function beginCanvasMultiSelectSession\b/,
message: "timeline multi-select session helpers must keep right-click session lifecycle centralized",
},
],
forbidden: [],
},
{
file: "apps/web/src/hooks/timelineRangeSelection.ts",
maxLines: 90,
@@ -337,6 +348,10 @@ export const rules = [
pattern: /from "\.\/timelineMultiSelect\.js"/,
message: "timeline drag must keep multi-select rectangle lifecycle delegated to the extracted helper module",
},
{
pattern: /from "\.\/timelineMultiSelectSession\.js"/,
message: "timeline drag must keep multi-select document session wiring delegated to the extracted helper module",
},
{
pattern: /from "\.\/timelineRangeSelection\.js"/,
message: "timeline drag must keep range preview and finalization delegated to the extracted helper module",
@@ -74,6 +74,7 @@ describe("architecture guardrails", () => {
const touchRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineTouch.ts");
const touchAdaptersRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineTouchAdapters.ts");
const multiSelectRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineMultiSelect.ts");
const multiSelectSessionRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineMultiSelectSession.ts");
const rangeRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineRangeSelection.ts");
const optimisticRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineOptimisticAllocations.ts");
const allocationFinalizeRule = rules.find((rule) => rule.file === "apps/web/src/hooks/timelineAllocationFinalize.ts");
@@ -90,6 +91,7 @@ describe("architecture guardrails", () => {
assert.ok(touchRule);
assert.ok(touchAdaptersRule);
assert.ok(multiSelectRule);
assert.ok(multiSelectSessionRule);
assert.ok(rangeRule);
assert.ok(optimisticRule);
assert.ok(allocationFinalizeRule);
@@ -106,6 +108,7 @@ describe("architecture guardrails", () => {
"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 touch pointer adapter wiring 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 multi-select document session wiring 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: missing guardrail anchor: timeline drag must keep optimistic allocation reconciliation delegated to the extracted helper module",
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation drag completion rules delegated to the extracted helper module",
@@ -137,6 +140,10 @@ describe("architecture guardrails", () => {
"apps/web/src/hooks/timelineMultiSelect.ts: missing guardrail anchor: timeline multi-select helpers must keep right-click release completion centralized",
]);
assert.deepEqual(evaluateRule(multiSelectSessionRule, ""), [
"apps/web/src/hooks/timelineMultiSelectSession.ts: missing guardrail anchor: timeline multi-select session helpers must keep right-click session lifecycle centralized",
]);
assert.deepEqual(evaluateRule(rangeRule, "export function updateRangeSelectionDraft() {}\n"), [
"apps/web/src/hooks/timelineRangeSelection.ts: missing guardrail anchor: timeline range helpers must keep selection bootstrap centralized",
"apps/web/src/hooks/timelineRangeSelection.ts: missing guardrail anchor: timeline range helpers must keep ordered range finalization centralized",
@@ -191,6 +198,7 @@ describe("architecture guardrails", () => {
"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 pointer adapter wiring 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 multi-select document session wiring 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: missing guardrail anchor: timeline drag must keep optimistic allocation reconciliation delegated to the extracted helper module",
"apps/web/src/hooks/useTimelineDrag.ts: missing guardrail anchor: timeline drag must keep allocation drag completion rules delegated to the extracted helper module",