Skip to content

Commit 1d12c4e

Browse files
Added connection to project md files. (#201)
Added new rules expected in current code.
1 parent ece8f9b commit 1d12c4e

File tree

4 files changed

+152
-78
lines changed

4 files changed

+152
-78
lines changed

.specify/memory/constitution.md

Lines changed: 93 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<!--
22
Sync Impact Report
3-
Version change: 1.3.0 -> 1.4.0
4-
Modified principles: Principle 13 (Branch Naming Consistency expanded to multi-prefix standard)
5-
Added sections: Prefix category definitions table; CI enforcement workflow `.github/workflows/branch-prefix-check.yml`
3+
Version change: 1.5.1 -> 1.6.0
4+
Modified principles: None
5+
Added sections: Principle 17 (Documentation-Derived Rule Synchronization)
66
Removed sections: None
7-
Templates requiring updates: plan-template.md (✅), spec-template.md (✅), tasks-template.md (✅), DEVELOPER.md (✅), CONTRIBUTING.md (✅), branch-prefix-check.yml (✅)
8-
Deferred TODOs: None
7+
Templates requiring updates: plan-template.md (✅), spec-template.md (✅), tasks-template.md (✅)
8+
Follow-up TODOs: Implement doc rule scan script (regex normative terms) & add CI job; baseline first scan by 2025-11-01.
99
-->
1010

1111
# Generate Release Notes Action Constitution
@@ -42,10 +42,16 @@ New placeholders, chapters, or hierarchy features MUST default to non-breaking b
4242
uncertain. Document additions in README + release notes.
4343
Rationale: Incremental evolution without destabilizing existing users.
4444

45-
### Principle 7: Resource-Conscious GitHub API Usage
46-
All mining MUST route through rate limiter abstractions. Disable hierarchy expansion when feature off. Avoid redundant
47-
fetches (cache IDs once retrieved). Performance concerns addressed before merging API-heavy features.
48-
Rationale: Preserves rate limits & improves speed.
45+
### Principle 7: Resource-Conscious GitHub API Usage & Performance Budgeting
46+
All mining MUST route through rate limiter abstractions and remain within a documented soft performance budget.
47+
Rules:
48+
- Disable hierarchy expansion when feature off to avoid unnecessary calls.
49+
- Avoid redundant fetches (cache IDs once retrieved).
50+
- Verbose runs SHOULD (and CI MAY) log: total API requests, elapsed wall-clock seconds, issues processed, PRs processed, remaining rate limit.
51+
- Soft API call target: ≤ 3 * (issues + PRs) for typical release windows; overages require justification & follow-up optimization task.
52+
- If remaining core rate limit <10% before optional hierarchy expansion, skip hierarchy mining with a warning (do not fail build).
53+
- Performance baselines MUST be periodically (at least once per quarter) captured for representative repositories.
54+
Rationale: Preserves rate limits, ensures predictably fast runtime, and prevents hidden performance regressions.
4955

5056
### Principle 8: Lean Python Design
5157
Prefer pure functions; introduce classes ONLY when stateful behavior or polymorphism required. Avoid deep inheritance;
@@ -64,7 +70,7 @@ Rationale: Prevents confusion & keeps coverage meaningful.
6470

6571
### Principle 11: Focused & Informative Comments
6672
Comments MUST succinctly explain non-obvious logic, constraints, or workaround rationale. Prohibited: stale, narrative,
67-
Speculative, or redundant comments. Maintain or delete on change; never leave outdated intent.
73+
speculative, or redundant comments. Maintain or delete on change; never leave outdated intent.
6874
Rationale: Enhances clarity without noise.
6975

7076
### Principle 12: Test Path Mirroring
@@ -93,59 +99,107 @@ Rules:
9399
- Descriptor: lowercase kebab-case; hyphens only; no spaces/underscores/trailing slash.
94100
- Optional numeric ID may precede description: `fix/987-label-trim`.
95101
- Avoid vague terms (`update`, `changes`); state intent (`improve-logging`, `relabel-duplicate-detection`).
96-
- Forbidden: mixing categories (e.g., `feature-fix/`), uppercase, camelCase.
97-
- Scope alignment: PR description MUST align with chosen prefix category; reviewers reject mismatches (e.g., docs-only PR on feature/ branch).
98-
Rationale: Enables automated classification, precise audit tooling, clearer commit/PR history semantics, and supports future CI policy enforcement.
102+
- Forbidden: mixing categories, uppercase, camelCase.
103+
- Scope alignment: PR description MUST align with chosen prefix category.
104+
Rationale: Enables automated classification, clearer history semantics, and supports CI policy enforcement.
105+
106+
### Principle 14: Static Typing Discipline
107+
All production modules MUST be fully type-checked with `mypy` (no silent exclusion beyond legacy transitional areas explicitly documented).
108+
Rules:
109+
- New code MAY NOT introduce `# type: ignore` without inline justification.
110+
- Broad `Any` disallowed unless interacting with third-party library lacking stubs (justify in PR).
111+
- Progressive enforcement: expand mypy coverage to tests by 2025-11-01 (create issue if deadline adjustment needed).
112+
Rationale: Early defect detection, self-documenting APIs, safer refactors.
113+
114+
### Principle 15: TODO Debt Governance
115+
Inline `TODO` (or `FIXME`) MUST include an issue reference (`#<id>`). Format: `# TODO(<issue-id>|<tracking-tag>): <action>`.
116+
Rules:
117+
- Missing issue link blocks merge (unless converted immediately to issue during review).
118+
- TODO lifetime max: 2 MINOR releases; aged TODOs trigger escalation issue.
119+
- Deprecated TODO replaced by comment removal OR fixed code in same PR.
120+
Rationale: Prevents silent entropy & ensures planned remediation of technical debt.
121+
122+
### Principle 16: Security & Token Handling
123+
No secrets or token fragments MAY be logged (even at DEBUG). Environment access limited to documented inputs.
124+
Rules:
125+
- Mask potentially sensitive substrings when logging dynamic user inputs.
126+
- Dependencies updated under `chore/` branches; review for supply chain risk (pin versions in requirements files).
127+
- Introduce new external services ONLY with explicit README threat notes (data sent, retention, opt-in flag).
128+
Rationale: Protects consumers using default GITHUB_TOKEN and mitigates leakage risk.
129+
130+
### Principle 17: Documentation‑Derived Rule Synchronization
131+
Normative statements (MUST/SHOULD/SHALL/REQUIRED) introduced or changed in project Markdown docs (e.g., `README.md`,
132+
`CONTRIBUTING.md`, `DEVELOPER.md`, any `docs/**/*.md`) MUST be reconciled with this constitution & templates.
133+
Rules:
134+
- Every PR modifying *.md files that adds/changes normative language MUST include one of:
135+
1. “Aligns with existing Principle X” (explicit reference), OR
136+
2. A Constitution amendment (new/updated principle), OR
137+
3. Justification that wording is purely explanatory (no new rule) using phrase: `NON-NORMATIVE` in PR description.
138+
- If conflict between doc text and a principle arises, the constitution prevails until amended; PR MUST either patch docs or amends principles in same PR.
139+
- Introduced process steps (e.g., ��run script X before commit”) MUST appear in: (a) constitution governance or quality gates section, OR (b) tasks template if feature-scoped.
140+
- A Doc Rule Scan Script (planned) parses changed Markdown lines for regex: `\b(MUST|SHOULD|SHALL|REQUIRED)\b` and fails CI unless reconciliation note present.
141+
- Template Propagation: When new normative doc rule is adopted, update: plan-template Constitution Check, spec-template alignment bullets, tasks-template path/quality gates.
142+
- Quarterly Audit: Run scan across repo; produce report listing normative statements without principle references; open issues for each orphan.
143+
Rationale: Prevents silent drift between contributor docs and enforceable governance; ensures single source of truth & predictable automation.
99144

100145
## Quality & Testing
101146

102147
- Test Directory Structure:
103148
- tests/unit/: All unit tests (test_<module>.py) — required location.
104149
- tests/integration/: End-to-end tests (integration_test.py to be migrated here when reorganized).
105150
- tests/fixtures/: Optional static data samples.
106-
- tests/helpers/ & tests/utils/: Test-only helpers (utils may merge into helpers).
107-
- Framework: pytest ONLY (no unittest classes).
108-
- Coverage: Enforce threshold ≥80% (existing command uses --cov-fail-under=80). New logic must keep or raise coverage.
109-
- Independence: Tests MUST not depend on run order or mutate shared global state beyond fixture scope.
151+
- tests/helpers/ & tests/utils/: Test-only helpers.
152+
- Framework: pytest ONLY.
153+
- Coverage: Enforce threshold ≥80% (uses --cov-fail-under=80). New logic must keep or raise coverage.
154+
- Independence: Tests MUST not depend on execution order or mutate global state beyond fixture scope.
110155
- Parametrization: Use @pytest.mark.parametrize instead of manual loops.
111-
- Integration tests import public interfaces only (e.g., main entry, generator class).
156+
- Integration tests import public interfaces only.
112157
- Failing tests are written first (Principle 1) for new core logic.
113-
- NEW: Path mirroring (Principle 12) enforced for all new/changed modules.
114-
- Transitional Migration Plan: Add tasks in upcoming PRs to relocate remaining categorized tests.
115-
- Branch Naming Check: Implementation PRs MUST originate from an allowed prefixed branch (`feature/`, `fix/`, `docs/`, `chore/`). (Principle 13)
158+
- Path mirroring (Principle 12) enforced for all new/changed modules.
159+
- Branch naming check enforced (Principle 13).
160+
- Typing coverage gate (Principle 14).
161+
- TODO audit gate (Principle 15).
162+
- Performance summary logged in verbose mode (Principle 7) when enabled.
163+
- Documentation rule sync: PR review checklist confirms Principle 17 compliance for any *.md normative additions.
116164

117165
## Workflow & Quality Gates
118166

119-
Pre-merge local mandatory checkers (from DEVELOPER.md):
120-
1. Formatting: black --check (line length 120 per pyproject.toml).
121-
2. Linting: pylint global score target ≥9.5 (no fatal errors).
122-
3. Typing: mypy (0 blocking errors) — treat Any proliferation as smell (justify if unavoidable).
167+
Pre-merge mandatory local (and CI) gates:
168+
1. Formatting: black --check (line length 120).
169+
2. Linting: pylint global score ≥9.5 (no fatal errors).
170+
3. Typing: mypy (0 blocking errors); justify new ignores.
123171
4. Tests: pytest all green.
124-
5. Coverage: ≥80% overall; justify any temporary dip (must be recovered within next PR).
125-
6. Dead Code: grep for unused utilities; remove or reference usage in same PR.
126-
7. Determinism: (Manual) Validate repeated runs produce identical output for sample dataset.
127-
8. Branch Naming: CI/Review MUST verify allowed prefix (feature|fix|docs|chore). Non-compliant branches BLOCK merge until renamed.
172+
5. Coverage: ≥80% overall; justify any temporary dip.
173+
6. Dead Code: remove or justify.
174+
7. Determinism: repeat test run yields identical sample output.
175+
8. Branch Naming: enforced allowed prefix.
176+
9. TODO Governance: all TODOs issue-linked & within lifetime window.
177+
10. Performance Budget (when verbose/perf job active): API call soft target evaluation (Principle 7).
178+
11. Documentation Rule Sync: normative doc changes reconciled per Principle 17.
128179

129180
Quality Gate Failure Handling:
130-
- Minor failures (formatting, lint) → fix immediately; do not merge with waivers unless urgent hotfix.
131-
- Coverage dip → requires explicit justification + recovery plan (link issue ID).
132-
- Non-deterministic output → BLOCKING until resolved.
133-
- Branch naming violation → BLOCKING until branch renamed; no exception (prefix set: feature|fix|docs|chore).
181+
- Minor failures (formatting, lint) → immediate fix; no waivers unless urgent hotfix.
182+
- Coverage dip → explicit justification + recovery issue.
183+
- Non-deterministic output → BLOCKING.
184+
- Branch naming violation → BLOCKING until renamed.
185+
- TODO governance failure → BLOCKING (fix or link issue).
186+
- Performance overrun → CONDITIONAL (document + follow-up optimization task) unless causing timeouts → BLOCKING.
187+
- Documentation rule sync failure → BLOCKING until reconciliation (add amendment or clarify NON-NORMATIVE).
134188

135189
## Governance
136190

137191
- Constitution supersedes ad-hoc practices; PRs MUST state compliance or list justified exceptions.
138192
- Versioning (this constitution): Semantic (MAJOR.MINOR.PATCH).
139193
- MAJOR: Remove/redefine a principle or backward incompatible process change.
140-
- MINOR: Add new principle/section (current change qualifies here: Branch Naming Consistency).
141-
- PATCH: Clarifications/typos with no semantic effect.
194+
- MINOR: Add new principle/section or materially expand guidance.
195+
- PATCH: Clarifications, numbering/order corrections, non-semantic wording.
142196
- Amendment Flow:
143197
1. Propose change with rationale & impact assessment.
144198
2. Update Sync Impact Report header (include affected templates & TODOs).
145199
3. Bump version according to rule above.
146-
4. Obtain maintainer approval (≥1) — emergency fixes allow retroactive review.
147-
- Compliance Review: PR template SHOULD reference Principles 1, 2, 10, 12, 13 (multi-prefix) + coverage threshold. Reviewers reject if principles violated without justification.
200+
4. Obtain ≥1 maintainer approval (emergency fixes allow post-hoc review).
201+
- Compliance Review: PR template SHOULD reference Principles 1, 2, 7, 10, 12, 13, 14, 15, 17 + coverage threshold.
148202
- Backward Compatibility: Input names & placeholder semantics require MAJOR bump if changed.
149-
- Enforcement: CI pipeline SHOULD automate black, pylint, mypy, pytest, coverage threshold; manual deterministic checks remain. Branch naming can be auto-validated by simple prefix check script.
203+
- Enforcement: CI automates formatting, lint, typing, tests, coverage, branch prefix, TODO lint, and optional performance logging.
150204

151-
**Version**: 1.4.0 | **Ratified**: 2025-10-12 | **Last Amended**: 2025-10-14
205+
**Version**: 1.6.0 | **Ratified**: 2025-10-12 | **Last Amended**: 2025-10-15

.specify/templates/plan-template.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,20 @@
3030
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
3131

3232
Mandatory alignment items:
33-
- Test‑First Reliability: Provide failing unit test list BEFORE implementation.
34-
- Explicit Configuration Boundaries: All new behavior exposed via action inputs (list any new inputs needed).
35-
- Deterministic Output Formatting: Confirm ordering & placeholders remain stable.
36-
- Lean Python Design: Justify each new class; prefer functions for stateless logic.
37-
- Localized Error Handling: Define how errors are logged instead of cross-module exceptions.
38-
- Dead Code Prohibition: Identify any code to delete made obsolete by this feature.
39-
- Test Path Mirroring: Confirm new unit tests placed in `tests/unit/<source-relative-path>/test_<file>.py`.
40-
- Branch Naming Consistency: Confirm current branch uses allowed prefix (feature|fix|docs|chore):
33+
- Test‑First Reliability (P1): Provide failing unit test list BEFORE implementation.
34+
- Explicit Configuration Boundaries (P2): All new behavior exposed via action inputs (list any new inputs needed).
35+
- Deterministic Output Formatting (P3): Confirm ordering & placeholders remain stable.
36+
- Performance Budget & API Usage (P7): Estimate added API calls (target ≤3*(issues+PRs)), define logging/measurement plan, and fallback behavior if rate limit low.
37+
- Lean Python Design (P8): Justify each new class; prefer functions for stateless logic.
38+
- Localized Error Handling (P9): Define how errors are logged instead of cross-module exceptions.
39+
- Dead Code Prohibition (P10): Identify any code to delete made obsolete by this feature.
40+
- Test Path Mirroring (P12): Confirm new unit tests placed in `tests/unit/<source-relative-path>/test_<file>.py`.
41+
- Branch Naming Consistency (P13): Confirm current branch uses allowed prefix (feature|fix|docs|chore):
4142
`git rev-parse --abbrev-ref HEAD | grep -E '^(feature|fix|docs|chore)/'`.
43+
- Static Typing Discipline (P14): Public APIs fully typed; list any unavoidable `Any` / `type: ignore` with justification.
44+
- TODO Debt Governance (P15): Any introduced TODO lines MUST carry issue reference; list initial issues here.
45+
- Security & Token Handling (P16): No logging of secrets; describe any new external API interactions & masking strategy.
46+
- Documentation‑Derived Rule Sync (P17): Any new/changed normative doc statements reconciled (reference principle / amendment / NON-NORMATIVE justification).
4247

4348
## Project Structure
4449

.specify/templates/spec-template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ List how this feature will comply with core principles:
1010
- Test‑First (P1): Failing unit tests in `tests/unit/test_<feature>.py` BEFORE implementation.
1111
- Explicit Configuration Boundaries (P2): New behavior exposed only via documented action inputs (list if any needed).
1212
- Deterministic Output (P3): Define ordering / formatting impacts; MUST remain stable across runs.
13+
- Performance Budget & API Usage (P7): Provide expected API call impact, measurement method (verbose logs / baseline script), and mitigation if nearing rate limit.
1314
- Lean Python Design (P8): Prefer functions; justify any new class (state or polymorphism requirement).
1415
- Localized Error Handling (P9): Describe logging + return strategy; no cross-module exception raises.
1516
- Dead Code Prohibition (P10): Identify any functions to remove or refactor; commit with tests.
1617
- Focused Comments (P11): Plan for concise logic/rationale comments; avoid narrative.
1718
- Test Path Mirroring (P12): Place unit tests at `tests/unit/<source-relative>/test_<file>.py`.
1819
- Branch Naming Consistency (P13): Branch MUST start with one of: `feature/`, `fix/`, `docs/`, `chore/`. Use kebab-case descriptor (optional numeric ID). Rename before merge if violated.
20+
- Static Typing Discipline (P14): All new public functions fully typed; list any `Any` / `type: ignore` with justification.
21+
- TODO Debt Governance (P15): Any new TODO includes issue link (format `TODO(<issue-id>):`); enumerate added TODO items.
22+
- Security & Token Handling (P16): Confirm no sensitive values logged; describe any new external service interactions + masking.
23+
- Documentation‑Derived Rule Sync (P17): Normative *.md changes reference principle, create amendment, or are marked NON-NORMATIVE.
1924

2025
## User Scenarios & Testing *(mandatory)*
2126

0 commit comments

Comments
 (0)