Skip to content

refactor(task-board): dedupe isDeliveryLane into packages/shared - #6650

Open
pedrofrxncx wants to merge 1 commit into
mainfrom
refactor/dedupe-is-delivery-lane
Open

refactor(task-board): dedupe isDeliveryLane into packages/shared#6650
pedrofrxncx wants to merge 1 commit into
mainfrom
refactor/dedupe-is-delivery-lane

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Source: C1 code reduction found while auditing the delivery-lanes area (recently touched by #6634/#6635/#6643).

apps/api/src/tools/task-board/lanes.ts and apps/web/src/layouts/task-board/config.tsx each independently defined an identical isDeliveryLane(status) — both bodies were DELIVERY_LANES.includes(status), and both files already imported DELIVERY_LANES from @decocms/shared/task-board. The api file's own comment even said "Mirrors the web-side isDeliveryLane", flagging the duplication itself. Moved the function into packages/shared/src/task-board.ts (the array's existing home) and made both sides import it instead of redefining it — one source of truth for a check TASK_BOARD_ITEM_UPDATE's gate, the board's move-target filter, and the Jira column mapper all depend on agreeing on.

Net: -15 / +9 lines. Behavior-preserving — same DELIVERY_LANES array, same .includes() check, just one definition instead of two; every call site (lanes.ts, config.tsx, update.ts, jira.tsx) keeps working via re-export/import.

Reviewer check: bun test apps/api/src/tools/task-board/lanes.test.ts packages/shared/src/task-board.test.ts apps/web/src/layouts/task-board/config.test.ts (all pass, 75 assertions across the three files).

Verified locally: bun run fmt, bunx tsc --noEmit in packages/shared, apps/api, and apps/web (all clean), bunx oxlint on the three touched files (0 warnings/errors), and the three targeted test files above. Full CI covers the rest.


Summary by cubic

Deduplicates the identical isDeliveryLane helper that existed in both apps/api and apps/web by moving it to packages/shared. Behavior is unchanged—same logic and same DELIVERY_LANES constant—but now there's a single source of truth for the delivery-lane check used across the API and web.

Written for commit a40c6a5. Summary will update on new commits.

Review in cubic

apps/api's lanes.ts and apps/web's task-board/config.tsx each defined an
identical isDeliveryLane(status) wrapping DELIVERY_LANES.includes(status) —
both already imported DELIVERY_LANES from @decocms/shared/task-board, so
the function belongs there too, as the single source of truth.

Net: -15 lines, +9. Behavior-preserving: same DELIVERY_LANES array, same
includes() check, just one definition instead of two.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant