refactor(task-board): dedupe isDeliveryLane into packages/shared - #6650
Open
pedrofrxncx wants to merge 1 commit into
Open
refactor(task-board): dedupe isDeliveryLane into packages/shared#6650pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Source: C1 code reduction found while auditing the delivery-lanes area (recently touched by #6634/#6635/#6643).
apps/api/src/tools/task-board/lanes.tsandapps/web/src/layouts/task-board/config.tsxeach independently defined an identicalisDeliveryLane(status)— both bodies wereDELIVERY_LANES.includes(status), and both files already importedDELIVERY_LANESfrom@decocms/shared/task-board. The api file's own comment even said "Mirrors the web-sideisDeliveryLane", flagging the duplication itself. Moved the function intopackages/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 checkTASK_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_LANESarray, 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 --noEmitinpackages/shared,apps/api, andapps/web(all clean),bunx oxlinton 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
isDeliveryLanehelper that existed in bothapps/apiandapps/webby moving it topackages/shared. Behavior is unchanged—same logic and sameDELIVERY_LANESconstant—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.