refactor: separate panel configuration from runtime state - #6
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the panel configuration storage by separating structural configuration (panel definitions and groups) from runtime state (tint levels and timestamps), and reduces the default panel count from 20 to 18 facade panels. The new architecture tracks panels_config.json in version control while keeping runtime state in the ignored panels_state.json.
- Splits
panels.jsonintopanels_config.json(tracked) andpanels_state.json(ignored) - Adds migration logic to convert legacy
panels.jsonto the new format - Updates default panel count from 20 to 18 facade panels (20 total including skylights)
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| svc/app/config.py | Adds file path constants for separated config and state files |
| svc/app/state.py | Implements file separation logic with migration, new load/save functions |
| svc/svc/data/panels_config.json | New tracked file containing structural panel and group definitions |
| svc/tests/test_basic.py | Updates test assertion and comment to reflect new panel count (20 total) |
| .gitignore | Adds panels_state.json to ignore list with explanatory comment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CarlosVasquez04
left a comment
There was a problem hiding this comment.
Looks good but in .gitignore shouldn't it be svc/ instead of svc/svc/
Ah yea let me update |
Actually, it looks like we've had it as svc/svc/data, which doesn't make that much sense, so I'll refactor to remove the extra svc directory |
Split panels.json into panels_config.json (tracked) and panels_state.json (ignored). Add automatic migration function to convert legacy panels.json format. Update state management to load/save config and state separately.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
57c5a1d to
57c154d
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Split panels.json into panels_config.json (tracked) and panels_state.json (ignored). Add an automatic migration function to convert legacy panels.json format. Update state management to load/save config and state separately.
Summary
This helps separate run-time data from configuration data to make repo management easier. This also helps in making our application more versatile, as panels can be added in panels_config.json, and data for any added panels will automatically be logged in panels_state.json.
Type
Testing
Ran Web and API and checked for successful migration from legacy panels.json. Everything still behaves as it did before.
Risk and rollout
Risks include changing data logging, so the possibility of lost data will continue to be monitored and will revert to legacy panels.json if issues are found.
Checklist