Resolve the formatDate name collision in apps/web - #934
Merged
Conversation
Three modules each exported a `formatDate` with different behavior: activity-chart-utils.ts (formatShortDate), release-utils.ts (formatShortDateTime), and jobs-helpers.tsx (null guard + formatDateTime). Same name, three semantics — the kind of thing that misleads at a glance. The first two were pure one-line delegations to @/lib/format, so they are deleted and the five call sites now call formatShortDate/formatShortDateTime directly. The jobs-helpers one carries real domain behavior (the "Not scheduled" / "Unknown" fallbacks), so it is kept and renamed to formatJobDateTime rather than inlined at three call sites. No behavior change: every call site resolves to the same underlying formatter it did before. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
selfcontained added a commit
that referenced
this pull request
Aug 12, 2026
Three buckets of unreferenced design-system code have been deferred twice (PR #807, PR #934) because they are a judgement call rather than clear-cut dead application code. This settles the policy and applies it. Delete what is dead weight: - apps/web/src/components/ui/sheet.tsx (134 lines, zero importers) - five unused tokens in lib/glass.ts (glassDivider, glassHover, glassActive, glassBadgeBg, primaryGlow) Keep, and say so in a comment, what is a deliberately complete vendored API surface: DialogTrigger/DialogClose in ui/dialog.tsx and SelectGroup/SelectLabel/SelectSeparator in ui/select.tsx. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 freeto 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.
What
apps/webexported three different functions namedformatDate, each with different behavior:components/app/activity-chart-utils.tsformatShortDatecomponents/app/release-utils.tsformatShortDateTimecomponents/app/jobs-helpers.tsxformatDateTimeSame name, three semantics. Reading
formatDate(x)at a call site told you nothing about what you'd get, and the import path was the only disambiguator.formatShortDate/formatShortDateTimefrom@/lib/formatdirectly (activity-pane.tsx,activity-chart-utils.tsinternal use,release-admin.tsx,updates-section.tsx×2).formatJobDateTimeand left its body untouched. Its three call sites (jobs-history-tab.tsx×2,jobs-detail-pane.tsx) and its test block were updated.Why this is tech debt
The two deleted wrappers added an indirection layer with zero behavior of their own, and their only effect was to make a widely-used name mean three different things in one app. Net -9 lines of indirection, and
formatDateno longer resolves ambiguously anywhere in the repo.No behavior change. Every call site resolves to the exact same underlying formatter it did before.
Deliberate exclusions
jobs-helpers's guards were kept, not inlined. All three of its call sites do in fact pass a non-null value today (run.startedAtis typedstring;run.completedAtandjob.nextRunare truthiness-guarded at the call site), so the"Not scheduled"branch is unreachable from current callers. But the"Unknown"invalid-date branch is a real fallback and the fallback strings are job-domain wording — inlining them at three sites would have been strictly worse than one well-named helper. Renaming resolves the collision without touching behavior.formatDateTime/formatShortDateTime/formatShortDatein@/lib/formatare untouched — they are the canonical formatters and are not duplicates of each other.service-resources-format.tsand other same-shaped-but-different display helpers noted in the backlog (shortModelName,statusIcon,TabButtoncollisions) — those are genuinely different functions that happen to share a name, and are tracked as their own backlog item.Validation
pnpm run check✅pnpm run finalize:web✅apps/webvitest: 776 passed / 58 files ✅pnpm run test:e2e: 179 passed / 12 skipped ✅ (covers the jobs pane and the settings/updates section, which render two of the changed call sites)Queued next
Backlog index 0: the dead design-system surface policy call (
ui/sheet.tsx, unused shadcn wrappers, five unusedlib/glass.tstokens) — deliberately its own run because it's a keep-or-delete policy decision, not a mechanical fix.