Reduce complexity warnings across scoring logic and UI flows - #25
Merged
Conversation
Agent-Logs-Url: https://github.com/leejsinclair/kipling-v2/sessions/fb0b5a0e-af7e-4856-b531-ae5ded0bcba7 Co-authored-by: leejsinclair <707675+leejsinclair@users.noreply.github.com>
Agent-Logs-Url: https://github.com/leejsinclair/kipling-v2/sessions/fb0b5a0e-af7e-4856-b531-ae5ded0bcba7 Co-authored-by: leejsinclair <707675+leejsinclair@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
leejsinclair
May 16, 2026 06:01
View session
leejsinclair
marked this pull request as ready for review
May 16, 2026 06:01
Contributor
There was a problem hiding this comment.
Pull request overview
Refactor focused on reducing lint complexity warnings in scoring, AI, and UI orchestration code paths by extracting helpers and decomposing large components. Intent is to keep behavior identical while flattening branching.
Changes:
- Extracted helpers in
llmService.js(error normalization, API fetch, validation, fallback builders) and helpers incriteriaScoring.js(feedback/suggestion/completeness/format/testability/specificity/alignment). - Split
App.jsxinto many small phase/result/panel/section subcomponents and shared helpers (scrollToPageBottom,buildStoryText, etc.). - Pulled tooltip data + subcomponents out of
StoryForm.jsx,AcceptanceCriteriaForm.jsx, andStoryHistory.jsx.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/llmService.js | Refactored error matching, payload validation, fetch, and fallbacks into helpers. |
| src/criteriaScoring.js | Broke scoring of criteria and single-criterion paths into focused helpers; introduced rule tables. |
| src/components/StoryHistory.jsx | Extracted StoryDetailsModal subcomponent. |
| src/components/StoryForm.jsx | Lifted SoThatFeedback and tooltip content tables out of the component body. |
| src/components/AcceptanceCriteriaForm.jsx | Extracted criterion editor/tooltip subcomponents and tier mapping. |
| src/App.jsx | Decomposed App into phase/section/panel components and helper functions. |
Comment on lines
+549
to
+554
| const presentKeywords = [hasGiven, hasWhen, hasThen].filter(Boolean).length; | ||
| const hasFullStructure = hasWhen && presentKeywords >= 2; | ||
|
|
||
| if (hasFullStructure) { | ||
| return { score: hasAnd ? 5 : 4, feedback: [] }; | ||
| } |
| setTimeout(() => { | ||
| window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); | ||
| }, 100); | ||
| scrollToPageBottom(); |
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.
Pull Request Template
📝 Summary
This PR removes the complexity warnings called out by
npm run lintwithout changing the story/criteria flow. It breaks up branching-heavy scoring, AI, and UI orchestration paths into smaller helpers and focused subcomponents.🔧 Changes
llmServiceso prompt construction, payload validation, fallback generation, and API handling no longer sit behind large conditional blocks.Appinto smaller phase/result/panel components and extracted shared helpers for scrolling, history hydration, and AI suggestion application.🎯 Motivation
The lint output was dominated by complexity warnings in a few central scoring and UI coordination paths, which made the code harder to change safely. This refactor reduces that branching density while preserving existing behavior and keeping lint/test verification green.
🧪 Testing
npm run lintnpm run verify📸 Screenshots (optional)
N/A
✅ Checklist