@@ -161,4 +161,93 @@ The project utilizes GitHub Actions for continuous integration and deployment:
161161 - Determines new version based on commit messages
162162 - Updates CHANGELOG.md
163163 - Creates Git tag for the release
164- - Publishes release on GitHub
164+ - Publishes release on GitHub
165+
166+ ## Pre-Push Checklist
167+
168+ Before pushing changes to the repository, run these checks locally to ensure the CI pipeline will pass:
169+
170+ ``` bash
171+ # 1. Run linters to ensure code quality and style
172+ poetry run flake8 main.py src/ tests/
173+ poetry run black --check .
174+ poetry run isort --check .
175+
176+ # 2. Run tests to ensure functionality works
177+ poetry run pytest
178+
179+ # 3. Check test coverage to ensure sufficient testing
180+ poetry run pytest --cov=main --cov-report=term-missing
181+
182+ # 4. Fix any linting issues
183+ poetry run black .
184+ poetry run isort .
185+
186+ # 5. Run tests again after fixing linting issues
187+ poetry run pytest
188+
189+ # 6. Verify application starts without errors
190+ poetry run python main.py # (Ctrl+C to exit after confirming it starts)
191+ ```
192+
193+ ### Common CI Failure Points to Check:
194+
195+ 1 . ** Code Style Issues** :
196+ - Inconsistent indentation
197+ - Line length exceeding 88 characters
198+ - Missing docstrings
199+ - Improper import ordering
200+
201+ 2 . ** Test Failures** :
202+ - Broken functionality due to recent changes
203+ - Missing tests for new features
204+ - Incorrectly mocked dependencies in tests
205+ - Race conditions in async tests
206+
207+ 3 . ** Coverage Thresholds** :
208+ - Insufficient test coverage on new code
209+ - Missing edge case tests
210+ - Uncovered exception handling paths
211+
212+ ### Quick Fix Command Sequence
213+
214+ If you encounter CI failures, this sequence often resolves common issues:
215+
216+ ``` bash
217+ # Fix style issues
218+ poetry run black .
219+ poetry run isort .
220+
221+ # Run tests with coverage to identify untested code
222+ poetry run pytest --cov=main --cov-report=term-missing
223+
224+ # Add tests for any uncovered code sections then run again
225+ poetry run pytest
226+ ```
227+
228+ ## Testing Game State Synchronization
229+
230+ Special attention should be paid to testing game state synchronization between the main view and the stream view:
231+
232+ ``` bash
233+ # Run specific tests for state synchronization
234+ poetry run pytest -v tests/test_ui_functions.py::TestUIFunctions::test_header_updates_on_both_paths
235+ poetry run pytest -v tests/test_ui_functions.py::TestUIFunctions::test_stream_header_update_when_game_closed
236+ ```
237+
238+ When making changes to game state management, especially related to:
239+ - Game closing/reopening
240+ - Header text updates
241+ - Board visibility
242+ - Broadcast mechanisms
243+
244+ Verify both these scenarios:
245+ 1 . Changes made on main view are reflected in stream view
246+ 2 . Changes persist across page refreshes
247+ 3 . New connections to stream page see the correct state
248+
249+ Common issues:
250+ - Missing ui.broadcast() calls
251+ - Not handling header updates across different views
252+ - Not checking if game is closed in sync_board_state
253+ - Ignoring exception handling for disconnected clients
0 commit comments