This repository was archived by the owner on May 11, 2026. It is now read-only.
chore: simplify codebase without changing behavior#635
Open
bonustrack wants to merge 1 commit into
Open
Conversation
- Remove dead code (commented-out isLimitReached and start-date check)
- Centralize BROVIDER_URL, SCORE_API_URL, NETWORK, DEFAULT_NETWORK in helpers/utils.ts
- Simplify requestDeduplicator promise chain using .finally()
- Modernize scores.ts pagination with Array.from({length}) and .entries()
- Inline trivial query/params triplets in flag-proposal and update-proposal
- Extract shared isAuthorized helper into helpers/actions.ts
- Extract resolvePrivacy helper for privacy resolution
- Replace recursive moderation run() with while(true) loop
- Rename broviderUrl/scoreAPIUrl to BROVIDER_URL/SCORE_API_URL to match existing convention
Net: 18 files changed, -43 LOC (91 insertions, 134 deletions)
Co-Authored-By: Claude Opus 4.7 (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 free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
What changed
Dead code
isLimitReachedfunction and call in src/writer/vote.ts|| { name: 'any', params: {} }fallback in src/helpers/actions.ts (already covered byjsonParse)Env var consolidation
BROVIDER_URLandSCORE_API_URLexports to src/helpers/utils.tsprocess.env.*reads across 9 files —process.envnow lives only inhelpers/utils.tsUPPER_CASEcasing as existingNETWORK/DEFAULT_NETWORKMicro-simplifications
.then/.catchin favor of.finally()Array.from(Array(pages)).forEach(...)→Array.from({length}, ...);let i = 0; if (i)→.entries()withidx > 0let vp: any = {}initializer; removedPromise.resolve(x)in async returnsShared helpers
isAuthorized({ space, address })to src/helpers/actions.ts and reused inflag-proposal.tsanddelete-proposal.ts(keptsettings.tsuntouched — it checks admins only, switching would allow moderators through)resolvePrivacy(spacePrivacy, payloadPrivacy)inutils.ts, used byproposal.tsandupdate-proposal.tsscores.tsinto a field arrayControl flow
run()→while (true)loopTest plan
yarn lintpassesyarn typecheckpassesyarn test:unit— pass/fail counts identical to master (43 pass, 51 pre-existing failures, 22 todo)yarn test:integration(requires DB — verify before merge)yarn test:e2e(requires DB — verify before merge)POST /vote/proposal request in dev🤖 Generated with Claude Code