Split numeric field renderers out of config-entry primitives#849
Conversation
bdraco
left a comment
There was a problem hiding this comment.
You must use the pr template, do not mangle it
|
@esphbot rr |
PR Review — Split numeric field renderers out of config-entry primitivesClean, verifiable refactor — the code is merge-ready, but the PR body still needs to use the repo template per @bdraco's CHANGES_REQUESTED. What's solid (verified locally on the PR branch):
On the failing-tests line in the quality report: I ran
Checklist
Automated review by Kōan (Claude) |
primitives.ts had grown to 624 lines, over the repo's 600-line cap. Move the numeric/magnitude renderers (renderNumberField + its private hex/int helpers, renderTimePeriodField, renderFloatWithUnitField) into a sibling primitives-numeric.ts and re-export them from primitives.ts so every consumer and test keeps importing from the same path. The numeric cluster shares no private helpers with the remaining selection/boolean/text renderers, so the cut is clean with no circular imports. primitives.ts drops to 298 lines, primitives-numeric.ts is 342. No behaviour change; public surface unchanged.
Simple rebaseBranch StatsActions performed
CI statusCI will be checked asynchronously. Automated by Kōan |
ca34ea1 to
a8ccac9
Compare
There was a problem hiding this comment.
Pull request overview
Refactors the device config-entry primitive renderers by extracting the numeric/magnitude-related field renderers into a dedicated sibling module, keeping primitives.ts under the repo’s 500–600 line file-size policy while preserving the existing public import surface.
Changes:
- Moved numeric renderers (
renderNumberField,renderTimePeriodField,renderFloatWithUnitField) and their private helpers intoprimitives-numeric.ts. - Updated
primitives.tsto re-export the numeric renderers from the new module (no consumer import churn).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/components/device/config-entry-renderers/primitives.ts | Removes inlined numeric renderer implementations and re-exports them from the new numeric module. |
| src/components/device/config-entry-renderers/primitives-numeric.ts | New module containing the extracted numeric/time-period/float-with-unit renderers and helper functions. |
What does this implement/fix?
Split the numeric/magnitude field renderers out of
config-entry-renderers/primitives.tsinto a siblingprimitives-numeric.ts, bringing both files under the 600-line cap.primitives.tshad regrown to 624 lines, over the repo's file-size cap.The file is a collection of independent field-renderer functions, so it
splits cleanly by field shape — the same pattern already used by the
sibling
lists.ts/nested.ts/registry-list.tsmodules in thisfolder.
renderNumberField(and its privaterenderIntField/renderHexIntField/hexDisplayOrFallbackhelpers),
renderTimePeriodField, andrenderFloatWithUnitField—into
primitives-numeric.ts.primitives.tsre-exports the three public renderers from the newmodule, so every consumer (the
config-entry-renderersbarrel,config-entry-pin-renderer, and the test suite) keeps importing fromthe same path — zero consumer churn.
selection/boolean/text renderers, so there's no circular import.
primitives.ts298 lines,primitives-numeric.ts342 lines.No behaviour change; public surface unchanged.
Related issue or feature (if applicable):
Types of changes
bugfixnew-featureenhancementbreaking-changerefactordocsmaintenancecidependenciesChecklist
npm run lintpasses.npm run testpasses.