You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Outcome: Produce a follow-up task list referencing each violation if found; merge only with accompanying unit tests.
73
86
74
87
## 3. Data & Integrations
75
88
@@ -119,13 +132,39 @@ manage version tagging; it consumes existing tags.
119
132
## 5. Quality & Testing
120
133
121
134
### Test Types
122
-
- Unit tests (expected for pure utility and formattingfunctions).
135
+
- Unit tests for pure utility, transformation, formatting, and record construction functions.
123
136
- Integration tests (e.g. `integration_test.py`) covering end-to-end generation using mocked or controlled data.
124
-
- No explicit contract tests yet; future addition may define record/chapter contract snapshots.
137
+
- Future: contract/snapshot tests MAY be introduced for chapter output stability (not mandatory yet).
138
+
139
+
### Test Directory Structure (New)
140
+
```
141
+
tests/
142
+
unit/ # All Python unit tests (test_<module>.py) - REQUIRED location
143
+
integration/ # Future integration tests (current single file may migrate here)
144
+
fixtures/ # Shared static test data & factories (optional)
145
+
helpers/ # Helper utilities used only by tests (must be imported by tests/*)
146
+
release_notes/ # Domain-specific sample data (review for possible move under fixtures/)
147
+
utils/ # Test-only utility functions (rename to helpers/ or remove if redundant)
148
+
```
149
+
Rules:
150
+
- All unit tests MUST reside under `tests/unit/` (root-level `test_*.py` files SHALL be relocated).
151
+
- Naming: `test_<target>.py`; multiple related small targets MAY share one file if cohesive.
152
+
- Test style: uses ONLY `pytest` (no unittest classes). Prefer functions + fixtures.
153
+
- Fixtures: define shared objects in `tests/conftest.py` or per-file fixtures; keep scope minimal.
154
+
- Parametrization: use `@pytest.mark.parametrize` for input matrix instead of loops.
155
+
- Coverage: new logic MUST raise overall coverage or keep it steady; dropping coverage requires explicit justification.
156
+
- NEW: Unit test file path MUST mirror source relative package path (Principle 12). For source file `release_notes_generator/utils/constants.py`, the test lives at `tests/unit/release_notes_generator/utils/test_constants.py`.
157
+
- Branch Naming: Feature / fix / docs / chore PRs MUST originate from correctly prefixed branch (Principle 13); CI may validate.
158
+
159
+
### Organization & Integration
160
+
- Integration tests MUST import public interfaces only (`main`, `ReleaseNotesGenerator`) not internal private helpers.
161
+
- Unit tests MUST avoid real network calls; use mocking or local sample data.
162
+
- Cross-test independence: tests MUST NOT rely on execution order; no shared mutation outside fixture scope.
163
+
- Relocation of existing root-level unit tests into `tests/unit/` SHALL be part of first compliance PR post-amendment.
125
164
126
165
### Coverage
127
-
-`pytest-cov` integrated; HTML coverage artifacts seen in `htmlcov/`. Target: maintain or improve existing coverage
128
-
(implicit baseline > minimal demonstration). New core logic MUST include tests before implementation (Test‑First Principle).
166
+
-`pytest-cov` integrated; HTML coverage artifacts under `htmlcov/`. Baseline maintained or improved. New core logic MUST
167
+
include tests before implementation (Test‑First Principle).
129
168
130
169
### Static Analysis & Review
131
170
-`pylint`, `mypy` required to pass (configuration present).
@@ -135,7 +174,9 @@ manage version tagging; it consumes existing tags.
135
174
### Quality Gates (Minimum Acceptance)
136
175
- Tests: ALL must pass.
137
176
- Lint + type: zero blocking errors.
177
+
- No unused functions/methods (see Principle 10) — introduce usage or delete in same PR.
138
178
- Backward compatibility: no silent change to input names or placeholder semantics without version bump & documentation update.
Modules MUST catch internal exceptions and convert them into structured return values plus logged messages. Cross-module
330
+
exception propagation (raising raw exceptions across boundaries) is prohibited except for truly unrecoverable setup
331
+
failures at the entry point (`main`). Return either a valid result or a clearly logged empty/partial result.
332
+
Rationale: Ensures predictable action behavior and prevents silent termination in CI pipelines.
333
+
334
+
### Principle 10: Dead Code Prohibition
335
+
No unused methods/functions SHALL remain in the codebase (properties or inherited abstract/interface methods excepted).
336
+
Utility files MUST contain only actively invoked functions. Removal of unused code MUST occur in the same PR that
337
+
introduces its obsolescence.
338
+
Rationale: Prevents confusion, reduces maintenance overhead, and keeps coverage meaningful.
339
+
340
+
### Principle 11: Focused & Informative Comments
341
+
Comments MUST explain non-obvious logic, constraints, or reasoning succinctly. Prohibited: narrative, outdated, or
342
+
speculative comments. Allowed: brief context before complex loops, rationale for workaround, links to issue references.
343
+
Comments SHOULD be maintained or updated alongside code changes; stale comments MUST be removed.
344
+
Rationale: Enhances clarity without adding noise.
345
+
346
+
### Principle 12: Test Path Mirroring
347
+
Each unit test file MUST reside under `tests/unit/` mirroring the source package path and file name: `tests/unit/<source_root_relative_path>/test_<original_file_name>.py`.
348
+
Mandatory Rules:
349
+
- One test file per source file unless tightly coupled logic demands grouping (justify in PR).
350
+
- Legacy non-mirrored category folders are deprecated; migrate incrementally without reducing coverage.
351
+
- New or refactored modules require mirrored test path in same PR.
352
+
Rationale: Ensures predictable test discovery, simplifies navigation between code and tests, and supports scalable refactors.
353
+
354
+
### Principle 13: Branch Naming Consistency
355
+
All new branches for work MUST start with one of the approved prefixes followed by a concise kebab-case descriptor (optional numeric ID).
0 commit comments