refactor: extract magic numbers to named constants for better readability#46
Open
refactor: extract magic numbers to named constants for better readability#46
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: lak7#42
|
@konard is attempting to deploy a commit to the lak7's projects Team on Vercel. A member of the Team first needs to authorize it. |
…lity - Create src/constants/index.ts with centralized named constants for polling intervals, debounce delays, SWR config, UI layout values, chat truncation limits, LLM context window params, and DB timeouts - Update src/app/project/[projectId]/page.tsx to use polling, debounce, UI layout, and chat constants instead of inline magic numbers - Update src/app/project/page.tsx to use SWR and feedback constants - Update actions/chat.ts to use CHAT_TITLE_FROM_MESSAGE_LENGTH - Update actions/project.ts to use LATEST_ARCHITECTURES_FETCH_LIMIT and CHAT_TITLE_PREVIEW_LENGTH - Update actions/projectDocs.ts to use LLM context window constants - Update src/lib/db.ts to use DB transaction timeout constants - Add JSDoc documentation to all constants in Limits.ts and use numeric separators for large numbers Fixes lak7#42 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit f22138c.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
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.
Summary
src/constants/index.tswith centralized, well-documented named constants replacing hardcoded magic numbers across the codebaseLimits.tsfor improved documentationChanges
New file:
src/constants/index.tsCentralized constants organized into categories:
POLLING_MAX_ATTEMPTS,POLLING_INITIAL_PHASE_DURATION_MS,POLLING_INITIAL_INTERVAL_MS,POLLING_FINAL_INTERVAL_MSPOSITION_SAVE_DEBOUNCE_MS,FEEDBACK_SUCCESS_CLOSE_DELAY_MS,COPY_FEEDBACK_RESET_DELAY_MS,SCROLL_DEBOUNCE_DELAY_MSSWR_DEDUPING_INTERVAL_MS,SWR_REFRESH_INTERVAL_MS,SWR_ERROR_RETRY_COUNT,SWR_ERROR_RETRY_INTERVAL_MSTEXTAREA_MAX_HEIGHT_PX,PANEL_MIN/MAX_WIDTH_PERCENT,MOBILE_BREAKPOINT_PX, tree indentation constantsCHAT_TITLE_PREVIEW_LENGTH,CHAT_TITLE_FROM_MESSAGE_LENGTH,MAX_PROMPTS_PER_CHATLATEST_ARCHITECTURES_FETCH_LIMIT,DB_TRANSACTION_MAX_WAIT_MS,DB_TRANSACTION_TIMEOUT_MSDEFAULT_MAX_INPUT/OUTPUT_TOKENS,WEB_SEARCH_MAX_INPUT/OUTPUT_TOKENS,MIN_REMAINING_TOKENS_THRESHOLD,FALLBACK_TRUNCATION_LENGTH,TOKEN_TRUNCATION_SAFETY_MARGINUpdated files
src/app/project/[projectId]/page.tsxsrc/app/project/page.tsxactions/project.tsactions/chat.tsactions/projectDocs.tssrc/lib/db.tsLimits.tsTest plan
Fixes #42
🤖 Generated with Claude Code