Add task 7 to MIL-003: import turtle lazily; re-review RC-013

This commit is contained in:
2026-10-13 16:00:18 +08:00
parent 3ce5d8d9df
commit 172778d22b
4 changed files with 131 additions and 2 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ document of a type. `Primary File` may contain a glob (e.g.
| PP | Project Plan | docs/project-plan.md | 002 |
| MIL | Milestone / Gateway | docs/milestones/*.md | 005 |
| ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0002 |
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 012 |
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 014 |
## Languages
+3 -1
View File
@@ -11,7 +11,8 @@
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Accepted | Claude (AI) for S01 | AI as stand-in for S01 | Initial version; review RC-005: Go | [b113e6e] |
| 2026-10-13 | Deprecated | Claude (AI) for S01 | AI as stand-in for S01 | Initial version; review RC-005: Go | [b113e6e] |
| 2026-10-13 | Accepted | Claude (AI) for S01 | AI as stand-in for S01 | Task 7 added: CI found that importing turtle needs a Tk library the runner lacks; review RC-013: Go | pending |
---
@@ -67,6 +68,7 @@ A runnable `main.py` entry point that plays the full game with Turtle, built on
| 4 | Add the entry point | `main.py` wires screen, loop and the learning-file export so `python main.py` runs the game after setup. | No | |
| 5 | Add UI test with a fake screen | Inject a fake screen and prompt into the loop to verify the flow without a display. | No | |
| 6 | Run the game manually | Run the real game once and note the result in the milestone review. | No | |
| 7 | Import turtle lazily so tests run without a Tk library | CI on the runner failed at test collection because `import turtle` needs `libtk8.6`. Import `turtle` when `TurtleScreen` is created, so importing the program and running its tests need no Tk library. Found after the first merge of this milestone. | No | |
---
@@ -0,0 +1,60 @@
# SQA Review Record
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-012 |
| CrossReference | [QC-PY-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Proposed | Claude (AI) for S01 | AI as stand-in for S01 | Initial review record: Go | pending |
---
## Artifact Under Review
- Instance reviewed: turtle_screen.py and tests/test_main.py changed by the CI fix (branch fix-ci-lazy-turtle)
- Checklist used: [QC-PY-001]
- Scope: full review
- Language and domain: n/a (technical type)
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the author is the same AI)
## Checklist Results
### QC-PY-001
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | Packages, modules, functions, variables, classes and constants follow PEP 8 casing (`snake_case`, `PascalCase`, `UPPER_SNAKE`) (Mandatory) | Pass | PEP 8 casing; ruff N rules pass. `get_mouse_click_coor` keeps the assignment's name. |
| 2 | Names state purpose in the domain's language; no unexplained abbreviations, no single-letter names outside tiny scopes (Mandatory) | Pass | Names state purpose; assignment names guessed_states and missing_states kept. |
| 3 | Code is produced by the project's formatter and passes its linter with no unexplained suppressions (Mandatory) | Pass | ruff format and check clean; the one suppression (`# noqa: PLC0415`) carries its reason: Tk may be missing at import time. |
| 4 | Every function and method signature is type-annotated, including `-> None` (Mandatory) | Pass | All signatures annotated incl. `-> None`; mypy --strict passes. |
| 5 | No bare `except:`, no swallowed exceptions; specific exceptions are raised and the cause is kept (`raise ... from`) (Mandatory) | N-A | No exception handling added; a missing data file raises to the caller. |
| 6 | No mutable default arguments and no shadowed builtins (Mandatory) | Pass | No mutable defaults (Path defaults are immutable); no builtin shadowed. |
| 7 | Files, locks and connections are managed with context managers (Mandatory) | Pass | No unmanaged resources; the window is closed in a `finally` in main(). |
| 8 | Public modules, classes and functions have docstrings that say what, not how (Optional) | Pass | Docstrings with @param/@return on public items. |
| 9 | Logging uses `logging`, not `print`; no secrets or personal data in log output (Mandatory) | Pass | Click coordinates use `logging`; no print in the package. |
| 10 | Classes and operations trace to the Design Class Diagram they implement; deviations are recorded (Mandatory) | N-A | No Design Class Diagram exists; the Protocol and TurtleScreen are recorded in the module docstrings. |
| 11 | Tests exist for new behaviour, are named for the behaviour, and do not depend on order or the network (Mandatory) | Pass | 34 tests; a new subprocess test blocks tkinter and imports the program; the suite also passes with tkinter blocked. |
| 12 | Type checker runs in strict mode without errors; `Any` is justified in a comment (Optional) | Pass | mypy strict reports no issues. |
| 13 | Dependencies are declared and pinned in the project's dependency file, none unused (Optional) | Pass | No runtime dependencies. |
| 14 | Each piece of knowledge (a business rule, constant, format, validation or query) is defined in one place; code is merged only where it expresses the same knowledge, not where it merely looks alike (Mandatory) | Pass | Titles, prompts, font and sizes defined once in constants.py. |
| 15 | Imports point inward: business-rule modules import no framework, database, UI or delivery-mechanism code, and there are no import cycles (Mandatory) | Pass | turtle is imported lazily inside TurtleScreen.__init__, so importing main and game needs no Tk library; game.py still depends on the Protocol. |
| 16 | SOLID holds: a class or module has one reason to change; new behaviour is added by extension, not by editing a type test in several places; subclasses honour the contract of their base; protocols are narrow; high-level code depends on protocols or abstract types and receives its implementations (Mandatory) | Pass | game.py loop, storage, screen and composition root each have one reason to change; the loop depends on the GameScreen Protocol and receives its implementation. |
## Overall Verdict
Go - Fix review: turtle is imported lazily so CI without a Tk library passes. Mandatory criteria pass (ruff, mypy --strict, 34 pytest tests, doxygen clean). CI failure cause: libtk8.6 missing on the runner.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | S01 | |
---
[QC-PY-001]: ../../../framework/qc/code/qc-programming-python.md
@@ -0,0 +1,67 @@
# SQA Review Record
## Metadata
| Key | Value |
| --- | --- |
| ID | RC-013 |
| CrossReference | [QC-MIL-001], [QC-LANG-001] |
## Version History
| Date | Status | Author | Reviewer | Change | Commit |
| --- | --- | --- | --- | --- | --- |
| 2026-10-13 | Proposed | Claude (AI) for S01 | AI as stand-in for S01 | Initial review record: Go | pending |
---
## Artifact Under Review
- Instance reviewed: [MIL-003]
- Checklist used: [QC-MIL-001], [QC-LANG-001]
- Scope: full review (re-review after task 7 was added; earlier record RC-005)
- Language and domain: en / it
- Language reviewer: none
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`; the author is the same AI)
## Checklist Results
### QC-MIL-001
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | A concrete deliverable is defined for every gate (Mandatory) | Pass | Deliverable unchanged: runnable game on the tested core. |
| 2 | Explicit Go/No-Go criteria are stated for each gate (Mandatory) | Pass | Six objectively checkable criteria, unchanged. |
| 3 | Dependencies on other milestones are explicitly mapped (Optional) | Pass | Depends on MIL-002 with a reason. |
| 4 | Each milestone is traceable to a Business Case objective or KPI (Mandatory) | Pass | Traceable to BC-001 objectives 1, 2 and success criterion 1. |
| 5 | Milestone owner and approving reviewer are identified (Mandatory) | Pass | Owner S01, approving reviewer S01 (stand-in). |
| 6 | Milestone has a defined target date consistent with project constraints (Mandatory) | Pass | 2026-10-13, within the duration constraint. |
### QC-LANG-001
| # | Criterion | Status | Evidence/Notes |
| --- | --- | --- | --- |
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder (Mandatory) | Pass | Language en, Domain it. |
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list (Mandatory) | Pass | BCP 47 code en; domain it is in the registry list. |
| 3 | The content (prose and table cells) is written in the stated language (Mandatory) | Pass | Content is English. |
| 4 | The register matches the one the registry gives for the artifact type (Mandatory) | Pass | IT Executive English register for MIL. |
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms (Mandatory) | Pass | No DICT exists; standard software terms; stand-in decision. |
| 6 | Metadata keys, section headings, IDs and statuses are in English (Mandatory) | Pass | Structural vocabulary English. |
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document (Mandatory) | Pass | No translated twin. |
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again (Mandatory) | Pass | No language change; the task row addition is recorded in Version History. |
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly (Mandatory) | Pass | Reviewer, AI as stand-in for S01, reads English and the software domain; open to challenge. |
| 10 | Abbreviations are spelled out on first use, in the stated language (Optional) | Pass | Abbreviations spelled out on first use in the milestone documents. |
## Overall Verdict
Go - MIL-003 with task 7 added meets every Mandatory criterion. Full re-review; the added task is a defect fix inside the accepted scope, with no change to the gate criteria.
## Action Items
| Action | Owner | Due |
| --- | --- | --- |
| None | S01 | |
---
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
[QC-LANG-001]: ../../../framework/qc/artifacts/qc-language-domain.md
[MIL-003]: ../../milestones/mil-003-turtle-game.md