From 00d47e244c82007bbc55e18312649189b175ec10 Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Tue, 6 Oct 2026 20:50:41 +0800 Subject: [PATCH 1/2] Review source code and add CI for MIL-004 Add RC-006 (source code against QC-PY-001) and RC-007 (MIL-004), and update the traceability matrix. Set lower bounds for the dev dependencies, the one optional Fail in RC-006. Add a Gitea Actions workflow running pytest, ruff and mypy, and describe it in the README. Accept MIL-004 and link its Milestone in the Project Plan. Closes #24 Closes #25 Closes #26 Closes #27 Closes #28 Task: MIL-004#1 Task: MIL-004#2 Task: MIL-004#3 Task: MIL-004#4 Task: MIL-004#5 --- .gitea/workflows/ci.yml | 26 +++++++++ README.md | 11 ++++ docs/artifact-registry.md | 2 +- docs/milestones/mil-004-code-review-and-ci.md | 2 +- docs/project-plan.md | 3 +- docs/sqa/reviews/rc-006-source-code.md | 53 +++++++++++++++++++ docs/sqa/reviews/rc-007-mil-004.md | 46 ++++++++++++++++ docs/sqa/traceability-matrix.md | 9 ++-- pyproject.toml | 2 +- 9 files changed, 147 insertions(+), 7 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 docs/sqa/reviews/rc-006-source-code.md create mode 100644 docs/sqa/reviews/rc-007-mil-004.md diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..85640b2 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + pull_request: + +jobs: + checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install + run: | + python -m pip install --upgrade pip + python -m pip install -e ".[dev]" + - name: Tests + run: python -m pytest + - name: Lint + run: python -m ruff check src tests + - name: Format check + run: python -m ruff format --check src tests + - name: Types + run: python -m mypy src tests diff --git a/README.md b/README.md index 46608b5..d22ee01 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,16 @@ python -m ruff format --check src tests python -m mypy src tests ``` +## Continuous integration + +On every push and pull request, `.gitea/workflows/ci.yml` installs the project on +Python 3.13 and runs the same checks as above: `pytest`, `ruff check`, +`ruff format --check` and `mypy`. To run all of them locally: + +```bash +python -m pytest && python -m ruff check src tests && python -m ruff format --check src tests && python -m mypy src tests +``` + ## Build the source documentation The source uses Doxygen comments. The HTML output goes to `docs/doxygen/html`. @@ -96,6 +106,7 @@ doxygen Doxyfile | `docs/` | Planning and review documents (business case, plan, milestones) | | `pyproject.toml` | Project configuration | | `Doxyfile` | Doxygen configuration | +| `.gitea/workflows/` | CI workflow | ## License diff --git a/docs/artifact-registry.md b/docs/artifact-registry.md index 8f38899..a5e3564 100644 --- a/docs/artifact-registry.md +++ b/docs/artifact-registry.md @@ -15,7 +15,7 @@ document of a type. `Primary File` may contain a glob (e.g. | SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 | | PP | Project Plan | docs/project-plan.md | 002 | | MIL | Milestone / Gateway | docs/milestones/*.md | 005 | -| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 006 | +| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 008 | | TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 | ## Languages diff --git a/docs/milestones/mil-004-code-review-and-ci.md b/docs/milestones/mil-004-code-review-and-ci.md index 3a424b1..6749591 100644 --- a/docs/milestones/mil-004-code-review-and-ci.md +++ b/docs/milestones/mil-004-code-review-and-ci.md @@ -9,7 +9,7 @@ ## Version History | Date | Status | Author | Reviewer | Change | Commit | | --- | --- | --- | --- | --- | --- | -| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | [8ef00aa] | +| 2026-10-06 | Accepted | Jens Tirsvad Nielsen | S01 | Initial version | [8ef00aa] | --- diff --git a/docs/project-plan.md b/docs/project-plan.md index 687ebdc..3b67b19 100644 --- a/docs/project-plan.md +++ b/docs/project-plan.md @@ -32,7 +32,7 @@ published project, within the short assignment timeline in [BC-001]. | Project Setup | [MIL-001] | 2026-10-05 to 2026-10-07 | 2026-10-07 | S01 | none | Skeleton, tooling, README | [Milestone 40] | | Coffee Machine Core | [MIL-002] | 2026-10-08 to 2026-10-10 | 2026-10-10 | S01 | none | Working program | [Milestone 41] | | Quality and Publication | [MIL-003] | 2026-10-11 to 2026-10-12 | 2026-10-12 | S01 | none | Tests, Doxygen, published repo | [Milestone 42] | -| Code Review and CI | [MIL-004] | 2026-10-07 to 2026-10-12 | 2026-10-12 | S01 | none | Source review record, CI workflow | | +| Code Review and CI | [MIL-004] | 2026-10-07 to 2026-10-12 | 2026-10-12 | S01 | none | Source review record, CI workflow | [Milestone 48] | ```plantuml @startgantt @@ -94,3 +94,4 @@ A No-Go moves all later dates by the same amount. [Milestone 42]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/milestone/42 [c0c3940]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/c0c3940551db0d7d96492cc734976d0436051ff9 [8ef00aa]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/8ef00aafaaa193ea565f1a45238d31e963a5e05d +[Milestone 48]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/milestone/48 diff --git a/docs/sqa/reviews/rc-006-source-code.md b/docs/sqa/reviews/rc-006-source-code.md new file mode 100644 index 0000000..8149188 --- /dev/null +++ b/docs/sqa/reviews/rc-006-source-code.md @@ -0,0 +1,53 @@ +# RC-006 Source Code Review + +## Metadata +| Key | Value | +| --- | --- | +| ID | RC-006 | +| CrossReference | [MIL-004], [QC-PY-001] | + +## Version History +| Date | Status | Author | Reviewer | Change | Commit | +| --- | --- | --- | --- | --- | --- | +| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | pending | + +--- + +## Artifact Under Review + +- Instance reviewed: `src/coffee_machine/` and `tests/` at the state of MIL-003 (`main` after PR 22) +- Checklist used: [QC-PY-001] (`QC-PY-001`) +- Independence: S01 is the only stakeholder and is also the recorded author, so the reviewer-is-not-author rule cannot be met. The code and documents were written by Claude on S01's behalf; S01 reviews and signs. This is a known limit of a one-person project, not a clean independent review. + +## Checklist Results + +| # | Criterion | Status | Evidence/Notes | +| --- | --- | --- | --- | +| 1 | Packages, modules, functions, variables, classes and constants follow PEP 8 casing (`snake_case`, `PascalCase`, `UPPER_SNAKE`) | Pass | Modules, functions and variables are `snake_case`, constants `UPPER_SNAKE`, `Drink` is `PascalCase`. | +| 2 | Names state purpose in the domain's language; no unexplained abbreviations, no single-letter names outside tiny scopes | Pass | Names state purpose (`is_resource_sufficient`, `process_coins`); the only short names are loop variables. | +| 3 | Code is produced by the project's formatter and passes its linter with no unexplained suppressions | Pass | `ruff check` and `ruff format --check` pass; no suppression comments. | +| 4 | Every function and method signature is type-annotated, including `-> None` | Pass | Every function, including tests and the nested `feed`, is annotated. | +| 5 | No bare `except:`, no swallowed exceptions; specific exceptions are raised and the cause is kept (`raise ... from`) | Pass | No bare `except`. `_ask_coin_count` catches only `ValueError` and answers it by asking again, so nothing is swallowed. | +| 6 | No mutable default arguments and no shadowed builtins | Pass | No mutable defaults; no builtin is shadowed. | +| 7 | Files, locks and connections are managed with context managers | N-A | The program opens no files, locks or connections. | +| 8 | Public modules, classes and functions have docstrings that say what, not how | Pass | All modules, public functions and tests have Doxygen docstrings that say what the code does. | +| 9 | Logging uses `logging`, not `print`; no secrets or personal data in log output | N-A | No logging exists. `print` is the program's own console output, not diagnostics. | +| 10 | Classes and operations trace to the Design Class Diagram they implement; deviations are recorded | N-A | No Design Class Diagram exists; the plan treats the work as plain technical tasks. | +| 11 | Tests exist for new behaviour, are named for the behaviour, and do not depend on order or the network | Pass | 19 tests named for behaviour, independent of order, no network. | +| 12 | Type checker runs in strict mode without errors; `Any` is justified in a comment | Pass | `mypy --strict` runs clean and `Any` is not used. | +| 13 | Dependencies are declared and pinned in the project's dependency file, none unused | Fail | Runtime dependencies: none. The dev tools had no lower bounds for ruff and mypy; fixed by action item 1, which sets `pytest>=9`, `ruff>=0.16`, `mypy>=2.4` (the tested versions). | + +## Overall Verdict + +Go — every mandatory criterion passes or is N-A. The one Fail (13) is optional and is fixed in the same change by issue #25. + +## Action Items + +| Action | Owner | Due | +| --- | --- | --- | +| Set lower bounds for the dev dependencies in pyproject.toml (done) | S01 | 2026-10-06 | + +--- + +[MIL-004]: ../../milestones/mil-004-code-review-and-ci.md +[QC-PY-001]: ../../../framework/qc/qc-programming-python.md diff --git a/docs/sqa/reviews/rc-007-mil-004.md b/docs/sqa/reviews/rc-007-mil-004.md new file mode 100644 index 0000000..b963f52 --- /dev/null +++ b/docs/sqa/reviews/rc-007-mil-004.md @@ -0,0 +1,46 @@ +# RC-007 MIL-004 Review + +## Metadata +| Key | Value | +| --- | --- | +| ID | RC-007 | +| CrossReference | [MIL-004], [QC-MIL-001] | + +## Version History +| Date | Status | Author | Reviewer | Change | Commit | +| --- | --- | --- | --- | --- | --- | +| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | pending | + +--- + +## Artifact Under Review + +- Instance reviewed: [MIL-004] (docs/milestones/mil-004-code-review-and-ci.md) +- Checklist used: [QC-MIL-001] (`QC-MIL-001`) +- Independence: S01 is the only stakeholder and is also the recorded author, so the reviewer-is-not-author rule cannot be met. The code and documents were written by Claude on S01's behalf; S01 reviews and signs. This is a known limit of a one-person project, not a clean independent review. + +## Checklist Results + +| # | Criterion | Status | Evidence/Notes | +| --- | --- | --- | --- | +| 1 | A concrete deliverable is defined for every gate | Pass | Deliverable names the RC record, the fixes, the CI workflow and the README section. | +| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Five Go/No-Go rows, each checkable (a record exists, a workflow runs four commands, a run is green). | +| 3 | Dependencies on other milestones are explicitly mapped | Pass | Depends on MIL-003 with a reason. | +| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | Traceability cites Business Case objective 6 and 4. | +| 5 | Milestone owner and approving reviewer are identified | Pass | Owner and approving reviewer are S01 (same person; see independence note). | +| 6 | Milestone has a defined target date consistent with project constraints | Pass | Target date 2026-10-12 lies inside the duration constraint in the Business Case. | + +## Overall Verdict + +Go — all criteria pass. + +## Action Items + +| Action | Owner | Due | +| --- | --- | --- | +| None | S01 | - | + +--- + +[MIL-004]: ../../milestones/mil-004-code-review-and-ci.md +[QC-MIL-001]: ../../../framework/qc/qc-milestones-gateways.md diff --git a/docs/sqa/traceability-matrix.md b/docs/sqa/traceability-matrix.md index 13c0153..a640c55 100644 --- a/docs/sqa/traceability-matrix.md +++ b/docs/sqa/traceability-matrix.md @@ -9,8 +9,8 @@ ## Version History | Date | Status | Author | Reviewer | Change | Commit | | --- | --- | --- | --- | --- | --- | -| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | [8ef00aa] | | 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Added MIL-004 | [8ef00aa] | +| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-006, RC-007 and the source code row | pending | --- @@ -30,13 +30,14 @@ artifact instance is created or reviewed. | [MIL-001] | Milestone | [BC-001], [PP-001] | - | [RC-003] | | [MIL-002] | Milestone | [BC-001], [PP-001] | - | [RC-004] | | [MIL-003] | Milestone | [BC-001], [PP-001] | - | [RC-005] | -| [MIL-004] | Milestone | [BC-001], [PP-001] | - | - | +| [MIL-004] | Milestone | [BC-001], [PP-001] | - | [RC-007] | +| Source code (`src/`, `tests/`) | Source code | [MIL-002], [MIL-003], [MIL-004] | - | [RC-006] | ## Coverage Notes - `-` in Upstream means foundational; in Downstream, nothing is built on it yet; in Last Reviewed, no `RC-*` exists yet. - [PP-001] has no QC checklist in the framework, so it has no `RC-*`. -- No use case, domain model, design or data artifacts exist; the plan treats all tasks as plain technical tasks. The source code is covered by the tests, not by an `RC-*`. +- No use case, domain model, design or data artifacts exist; the plan treats all tasks as plain technical tasks. The source code is reviewed in [RC-006]. --- @@ -52,4 +53,6 @@ artifact instance is created or reviewed. [RC-003]: ./reviews/rc-003-mil-001.md [RC-004]: ./reviews/rc-004-mil-002.md [RC-005]: ./reviews/rc-005-mil-003.md +[RC-006]: ./reviews/rc-006-source-code.md +[RC-007]: ./reviews/rc-007-mil-004.md [8ef00aa]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/8ef00aafaaa193ea565f1a45238d31e963a5e05d diff --git a/pyproject.toml b/pyproject.toml index 81809d4..1035fb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ license = { file = "LICENSE" } dependencies = [] [project.optional-dependencies] -dev = ["pytest>=8", "ruff", "mypy"] +dev = ["pytest>=9", "ruff>=0.16", "mypy>=2.4"] [project.scripts] coffee-machine = "coffee_machine.main:main" From f192f227e27c6be3205d42e8ee74e0361b0a699b Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Tue, 6 Oct 2026 20:56:18 +0800 Subject: [PATCH 2/2] Resolve pending commit links in MIL-004 review records Co-Authored-By: Claude Sonnet 5.5 --- docs/sqa/reviews/rc-006-source-code.md | 3 ++- docs/sqa/reviews/rc-007-mil-004.md | 3 ++- docs/sqa/traceability-matrix.md | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/sqa/reviews/rc-006-source-code.md b/docs/sqa/reviews/rc-006-source-code.md index 8149188..fa28f1a 100644 --- a/docs/sqa/reviews/rc-006-source-code.md +++ b/docs/sqa/reviews/rc-006-source-code.md @@ -9,7 +9,7 @@ ## Version History | Date | Status | Author | Reviewer | Change | Commit | | --- | --- | --- | --- | --- | --- | -| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | pending | +| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | [00d47e2] | --- @@ -51,3 +51,4 @@ Go — every mandatory criterion passes or is N-A. The one Fail (13) is optional [MIL-004]: ../../milestones/mil-004-code-review-and-ci.md [QC-PY-001]: ../../../framework/qc/qc-programming-python.md +[00d47e2]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/00d47e244c82007bbc55e18312649189b175ec10 diff --git a/docs/sqa/reviews/rc-007-mil-004.md b/docs/sqa/reviews/rc-007-mil-004.md index b963f52..f73f70f 100644 --- a/docs/sqa/reviews/rc-007-mil-004.md +++ b/docs/sqa/reviews/rc-007-mil-004.md @@ -9,7 +9,7 @@ ## Version History | Date | Status | Author | Reviewer | Change | Commit | | --- | --- | --- | --- | --- | --- | -| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | pending | +| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Initial version | [00d47e2] | --- @@ -44,3 +44,4 @@ Go — all criteria pass. [MIL-004]: ../../milestones/mil-004-code-review-and-ci.md [QC-MIL-001]: ../../../framework/qc/qc-milestones-gateways.md +[00d47e2]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/00d47e244c82007bbc55e18312649189b175ec10 diff --git a/docs/sqa/traceability-matrix.md b/docs/sqa/traceability-matrix.md index a640c55..3f1c651 100644 --- a/docs/sqa/traceability-matrix.md +++ b/docs/sqa/traceability-matrix.md @@ -10,7 +10,7 @@ | Date | Status | Author | Reviewer | Change | Commit | | --- | --- | --- | --- | --- | --- | | 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Added MIL-004 | [8ef00aa] | -| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-006, RC-007 and the source code row | pending | +| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S01 | Added RC-006, RC-007 and the source code row | [00d47e2] | --- @@ -56,3 +56,4 @@ artifact instance is created or reviewed. [RC-006]: ./reviews/rc-006-source-code.md [RC-007]: ./reviews/rc-007-mil-004.md [8ef00aa]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/8ef00aafaaa193ea565f1a45238d31e963a5e05d +[00d47e2]: https://git.tirsystem.com/Tirsvad-Udemy-100_days_of_code/015-coffee_machine/commit/00d47e244c82007bbc55e18312649189b175ec10