Fix --exec interactive prompt bug and create comprehensive test suite

Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization

Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features

Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments

Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities

The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
This commit is contained in:
John McCardle 2025-07-03 19:25:49 -04:00
commit 18cfe93a44
36 changed files with 2386 additions and 13 deletions

View file

@ -3,9 +3,9 @@
## Project Status: Post-7DRL 2025 "Crypt of Sokoban"
**Current State**: Successful 7DRL completion with Python/C++ game engine
**Latest Commit**: 68c1a01 - Implement --exec flag and PyAutoGUI-compatible automation API
**Branch**: interpreter_mode (actively implementing Python interpreter features)
**Open Issues**: 78 catalogued issues from Gitea instance
**Latest Commit**: Working on test suite and critical bug fixes
**Branch**: interpreter_mode (test suite created, critical fixes implemented)
**Open Issues**: 64 catalogued issues from Gitea instance (14 closed)
---
@ -42,15 +42,42 @@
#### Addresses:
- **#32** - Executable behave like `python` command (90% complete - all major Python interpreter flags implemented)
#### Test Suite Results (2025-07-03):
Created comprehensive test suite with 13 tests covering all Python-exposed methods:
**✅ Fixed Issues:**
- Fixed `--exec` Python interactive prompt bug (was entering REPL instead of game loop)
- Resolved screenshot transparency issue (must use timer callbacks for rendered content)
- Updated CLAUDE.md with testing guidelines and patterns
**❌ Critical Bugs Found:**
1. **SEGFAULT**: Grid class crashes on instantiation (blocks all Grid functionality)
2. **#78 CONFIRMED**: Middle mouse click sends 'C' keyboard event
3. **Entity property setters**: "new style getargs format" error
4. **Sprite texture setter**: Returns "error return without exception set"
5. **keypressScene()**: Segfaults on non-callable arguments
**📋 Missing Features Confirmed:**
- #73: Entity.index() method
- #27: EntityCollection.extend() method
- #41: UICollection.find(name) method
- #38: Frame 'children' constructor parameter
- #33: Sprite index validation
- #69: Partial Sequence Protocol (no slicing, 'in' operator)
---
## 🚧 IMMEDIATE PRIORITY: Critical Bugfixes & Iterator Completion
### 🔥 Critical Bugfixes (Complete First)
- [ ] **CRITICAL: Grid Segfault** - Grid class crashes on instantiation (blocks ALL Grid functionality) - *High Priority*
- [ ] **#78** - Middle Mouse Click sends "C" keyboard event to scene event handler - *Confirmed Bug*
- [ ] **#77** - Fix error message copy/paste bug (`x value out of range (0, Grid.grid_y)`) - *Isolated Fix*
- [ ] **#74** - Add missing `Grid.grid_y` property referenced in error messages - *Isolated Fix*
- [ ] **#78** - Middle Mouse Click sends "C" keyboard event to scene event handler - *Unknown Scope*
- [ ] **#37** - Fix Windows build module import from "scripts" directory - *Isolated Fix*
- [ ] **Entity Property Setters** - Fix "new style getargs format" error - *Multiple Fixes*
- [ ] **Sprite Texture Setter** - Fix "error return without exception set" - *Isolated Fix*
- [ ] **keypressScene() Validation** - Add proper error handling for non-callable arguments - *Isolated Fix*
### 🔄 Complete Iterator System
**Status**: Core iterators complete (#72 closed), Grid point iterators still pending
@ -160,12 +187,13 @@
## 🎯 RECOMMENDED TRIAGE SEQUENCE
### Phase 1: Foundation Stabilization (2-3 weeks)
### Phase 1: Foundation Stabilization (1-2 weeks)
```
1. Critical Bugfixes (#77, #74, #37) - Fix immediate pain points
2. Complete Grid Point Iterators - Finish commit 167636c work
3. Alpha Blockers (#3, #2, #47) - Quick cleanup for alpha readiness
4. Entity index() method (#73) - Enables better collection management
1. Fix Grid Segfault - CRITICAL: Unblocks all Grid functionality
2. Fix #78 Middle Mouse Click bug - Confirmed event handling issue
3. Fix Entity/Sprite property setters - Multiple Python binding errors
4. Critical Bugfixes (#77, #74, #37) - Fix remaining pain points
5. Alpha Blockers (#3, #2) - Remove deprecated methods
```
### Phase 2: Alpha Release Preparation (4-6 weeks)