Repository navigation
Remove flag and experiment scaffolding, dead comment utilities and barrel-only exports - #1169
Merged
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rrel-only exports Fourth chunk of the dead-code plan. - utils/featureFlags.ts had one flag, hard-coded on, plus a localStorage reader nobody called, a console helper installed on window, and DEBUG branches that were always off. The two checks in NoteEditorLayout read as always-true and are inlined; only isProduction() had readers (the two legacy banners), so that is all that remains. - utils/experiment.ts (the homepage A/B helper) was reachable only through an unused import in UserContext. - The comment-utils barrel re-exported seven names nothing imports, and the functions behind them were dead too: createOptimisticComment, updateCommentWithApiResponse, mapOptimisticToRealId, getParentId, clearIdMappings, removeCommentDeep, clearAllCommentDrafts, isContentEmpty, getFormattedCommentContent, feedEntryToPostCard and the unused useComments hook (useCreateComment, in the same file, stays). - Barrels trimmed to what their importers take: components/Funding and Funding/lib, Nonprofit, Referral, ui/icons, FeatureNotifications. The components only reachable through the removed lines go with them: FundingProposalCard, GrantCard, ProposalCount, FundraiseProgressBar, NonprofitInfoPopover, EndaomentInfoPopover, IllustratedGuide, PaperIcon, and, one layer down, ProposalPeekView, GrantPreviewTooltip, GrantBadge and usePostContent, which only FundingProposalCard used. RSC_PAYMENT_METHODS and PAYMENT_METHOD_LABELS in Funding/lib/constants had no readers either. Left for a follow-up: with mapOptimisticToRealId gone nothing writes the optimistic-id map, so getRealId is now an identity function and recordParentChildRelationship fills a map nobody reads; simplifying their callers is a change to live code and belongs in its own review. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
SonarCloud's quality gate on the previous commit pointed out that optimisticToRealIdMap can only ever be empty once mapOptimisticToRealId is gone: getRealId had become an identity function and recordParentChildRelationship filled a map nobody read. Rather than ship a known no-op, remove commentIdUtils and have the callers in commentTreeUtils, commentOptimisticUtils and CommentContext use the ids they were given. Behaviour is unchanged: every removed call either returned its argument or wrote to state nothing consulted. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
yattias
force-pushed
the
cleanup/4-flags-and-barrels
branch
from
October 11, 2026 02:16
f169045 to
15420a3
Compare
|
This branch was successfully deployed
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.



Fourth chunk of the dead-code removal plan (
docs/dead-code-report.md, kept local), following #1166.What goes
utils/featureFlags.tshad one flag, hard-coded totrue, a localStorage reader nobody called, a console helper installed onwindow, andDEBUGbranches that were always off. The twoisFeatureEnabled(...)checks inNoteEditorLayoutwere always true and are inlined. OnlyisProduction()had readers (the two legacy banners), so that is all that remains, without the debug branches.utils/experiment.tswas reachable only through an unused import incontexts/UserContext.tsx.commentUtilsbarrel re-exported seven names nothing imports, and the functions behind them were dead too:createOptimisticComment,updateCommentWithApiResponse,mapOptimisticToRealId,getParentId,clearIdMappings,removeCommentDeep,clearAllCommentDrafts,isContentEmpty,getFormattedCommentContent,feedEntryToPostCard, and theuseCommentshook (useCreateCommentin the same file stays).components/FundingandFunding/lib,Nonprofit,Referral,ui/icons,FeatureNotifications. The components only reachable through the removed lines go with them:FundingProposalCard,GrantCard,ProposalCount,FundraiseProgressBar,NonprofitInfoPopover,EndaomentInfoPopover,IllustratedGuide,PaperIcon, and one layer downProposalPeekView,GrantPreviewTooltip,GrantBadgeandusePostContent, which onlyFundingProposalCardused.RSC_PAYMENT_METHODSandPAYMENT_METHOD_LABELSinFunding/lib/constants.tshad no readers.32 files changed, 1,848 lines removed, 48 added (the slimmed
isProduction, trimmed import lines, and the id renames above). No behaviour change intended.Second commit: the optimistic-id map
SonarCloud's quality gate on the first commit flagged that
optimisticToRealIdMapincommentIdUtils.tscould only ever be empty oncemapOptimisticToRealIdwas gone:getRealIdhad become an identity function andrecordParentChildRelationshipfilled a map nobody read. Rather than ship a known no-op, the second commit removescommentIdUtils.tsand has the callers incommentTreeUtils,commentOptimisticUtilsandCommentContextuse the ids they were given. Every removed call either returned its argument or wrote to state nothing consulted, so behaviour is unchanged. The diff there is worth a read since it touches live comment code.Checks
npm run lint: 0 errors (2 pre-existing warnings in untouched files)npm run type-check: cleanPaymentStep,StripeProvider,FundingImpactPreview,QuickAmountSelector, the two hooks) are exactly what the trimmed barrel still exportsNext
Chunk 5 (
cleanup/5-dead-exports) follows once this is merged.🤖 Generated with Claude Code