From 3c0da952461a3c0749e7897c75c47c2044e3e907 Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Wed, 28 Oct 2026 18:32:37 +0000 Subject: [PATCH 1/2] docs(contributing): a matching table lives beside its one owner The documents told contributors to declare every list, tuple or frozen set that matches, classifies or filters values in config/constants.py or config/defaults.py, so a table that one module reads lived in a file of another package. Per the owner decision of 2026-10-22 on #1016, a table now lives beside its one owner and moves to config/ only when a second package imports it. CONTRIBUTING.md and docs/ROUTINE_TASKS.md state the rule, and the naming table gives the name of each place. No constant moves and no check is added. --- CONTRIBUTING.md | 4 +- docs/ROUTINE_TASKS.md | 9 ++--- .../1016-table-owner-rule/.openspec.yaml | 3 ++ .../changes/1016-table-owner-rule/design.md | 17 +++++++++ .../changes/1016-table-owner-rule/proposal.md | 37 +++++++++++++++++++ .../changes/1016-table-owner-rule/tasks.md | 19 ++++++++++ 6 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 openspec/changes/1016-table-owner-rule/.openspec.yaml create mode 100644 openspec/changes/1016-table-owner-rule/design.md create mode 100644 openspec/changes/1016-table-owner-rule/proposal.md create mode 100644 openspec/changes/1016-table-owner-rule/tasks.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e970882bd..bb8e62cec6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ These rules apply to every contributor. [`AGENTS.md`](AGENTS.md) sends agents he - **Closed Lists and Standard Parsers**: - Match a value against a list of strings only when the list covers a closed domain, such as one that an RFC or a language grammar defines. - For an open domain, use a parser (`ast`, `tokenize`, `urllib.parse`, `ipaddress`, `packaging`) or an official registry, such as the Public Suffix List through `tldextract`. - - Declare each list, tuple or frozen set that matches, classifies or filters values in `src/devops_cli/config/constants.py` or `src/devops_cli/config/defaults.py`. + - Declare each list, tuple or frozen set that matches, classifies or filters values as a named module-level table beside its one owner: the module that reads it, or the `constants.py` of its package when several modules of one package read it. Move the table to `src/devops_cli/config/constants.py` or `src/devops_cli/config/defaults.py` only when a module of a second package imports it. When you change the owner of a table in `config/` that only one package reads, move the table to its owner in the same pull request. - **Names**: Name each file, module, class and function for its responsibility. Do not use a placeholder name, such as `temp_util.py`. Ruff `N` checks the form. - **Line Breaks Belong to Source Files**: Hard-wrap text only in source files and Markdown documents. Write emitted text (terminal messages, Rich renderables, log records, `lang/en/` strings) as continuous paragraphs. Split a long string in the source with implicit string concatenation. - **Strongly Typed Domain Exceptions**: @@ -121,7 +121,7 @@ This table holds the naming rules of the project. Each rule names the check that | Pull request title and commit subject | `(): ` | The `Semantic PR title` check for the title. None for a commit on a branch. | | Change folder | `-`, archived as `--` | `devops openspec check` and `tests/test_change_folders.py`. | | Python module, class, function and variable | PEP 8 | Ruff `N`. | -| Constant | `CONST_` in `config/constants.py`; `DEFAULT_` for a tunable value in `config/defaults.py` | None. | +| Constant | `_` in the one module that reads it. `` in the `constants.py` of a package when several of its modules read it. `CONST_` in `config/constants.py`, or `DEFAULT_` for a tunable value in `config/defaults.py`, when modules of two or more packages import it ("Closed Lists and Standard Parsers" above) | None. | | Test file and test function | The behavior it checks, in the terms of [CONTEXT.md](CONTEXT.md) ([docs/TESTING.md](docs/TESTING.md#names-and-assertions)) | None. | | `devops` command and option | Lowercase words joined by hyphens | None. | | Environment variable | `DEVOPS_CLI_` and the setting's dotted key in upper case, with `_` for `.`. A settings field declares its variable with a `Variable` marker (`src/devops_cli/config/env.py`) and its description with `Field(description=...)`; a credential is one entry of `CREDENTIALS` in the same module | `tests/test_config_declarations.py` holds the set of variables and keyring entries. `devops config show`, `devops config env` and `docs/ENV_VARS.md` are generated from the declarations. | diff --git a/docs/ROUTINE_TASKS.md b/docs/ROUTINE_TASKS.md index 7fc8108071..af9a7dc943 100644 --- a/docs/ROUTINE_TASKS.md +++ b/docs/ROUTINE_TASKS.md @@ -25,7 +25,7 @@ The following matrix categorizes all project routine tasks by operational layer, | :--- | :--- | :--- | :--- | :--- | :--- | | **Inner Loop (Daily / Per Edit)** | Task Grounding | Step 1 | `devops gh project audit` && `devops roadmap intake` | Query project tracking, and verify the issue's labels or file the work through intake | Task grounded in an open issue with a `priority/*` label | | **Inner Loop (Daily / Per Edit)** | Dependency Synchronization | Step 2 | `uv sync` | Synchronizes virtual environment with `uv.lock` | Clean exit; all dependencies resolved | -| **Inner Loop (Daily / Per Edit)** | Constant & Config Centralization | Step 3 | Manual / Refactor | Centralize literals in `constants.py`, `defaults.py`, `lang/en/` | No hardcoded string literals in command code | +| **Inner Loop (Daily / Per Edit)** | Constant & Config Placement | Step 3 | Manual / Refactor | Put each table beside its one owner, and in `config/` once a second package imports it; put messages in `lang/en/` | No hardcoded string literals in command code | | **Inner Loop (Daily / Per Edit)** | Targeted Linting & Formatting | Step 4 | `uv run ruff check --fix ` | Fast focused linting on modified files | `ruff check` reports 0 errors | | **Inner Loop (Daily / Per Edit)** | Targeted Type Checking | Step 5 | `uv run mypy --strict ` | Strict type validation on modified modules | 0 type errors across modified files | | **Inner Loop (Daily / Per Edit)** | Targeted Unit Testing | Step 6 | `uv run devops ci test ` | Fast isolated testing of active features/fixes, with xdist workers sized to the selection | Targeted tests pass | @@ -68,7 +68,7 @@ The Inner Development Loop follows a strict **Test-First Development (TDD)** met flowchart TD A[Requirement / Feature Goal] --> B[1. Project Planning & Task State Setup] B --> C[2. uv sync Dependencies] - C --> D[3. Centralize Literals & Defaults] + C --> D[3. Place Constants & Defaults] D --> E[4. Write Tests First in tests/test_*.py] E --> F[5. Implement Feature Code in src/] F --> G[6. ruff check & format modified files] @@ -84,10 +84,9 @@ flowchart TD - Without a matching issue: **FILE THE TASK AS A CANDIDATE** (`devops roadmap intake --title "" --body-file --confirm` or FastMCP `roadmap_intake` with `mode="confirm"`). Intake files it (a possible duplicate too, which its reason comment names for a person to close), labels its type, Status, Priority, Value and Effort, and puts it in the backlog; set no milestone or priority on it yourself. - Plan the item as an OpenSpec change, `openspec/changes/-/` ([`openspec/config.yaml`](../openspec/config.yaml)). The labels of the issue hold the Status of the item, and the change folder holds none. 2. **Sync Dependencies (`uv sync`)**: Always ensure `.venv` is aligned with `uv.lock` before starting work. -3. **Centralize Constants, Config & Defaults**: +3. **Place Constants, Config & Defaults**: - Put configuration options and environment variable schemas in [`src/devops_cli/config/settings.py`](../src/devops_cli/config/settings.py). - - Put constants, regexes, and protocol strings in [`src/devops_cli/config/constants.py`](../src/devops_cli/config/constants.py). - - Put timeouts and numeric defaults in [`src/devops_cli/config/defaults.py`](../src/devops_cli/config/defaults.py). + - Put a constant, regex, protocol string, timeout or numeric default beside its one owner. Move it to [`src/devops_cli/config/constants.py`](../src/devops_cli/config/constants.py) or [`src/devops_cli/config/defaults.py`](../src/devops_cli/config/defaults.py) only when a second package imports it ([CONTRIBUTING.md](../CONTRIBUTING.md), "Closed Lists and Standard Parsers"). - Put user-facing messages, summaries, and error logs in [`src/devops_cli/lang/en/`](../src/devops_cli/lang/en/). 4. **Leverage Shared Domain Helpers & Declarative Frameworks**: - Before writing ad-hoc subprocess calls, path containment checks, binary verification, or secret sanitization, always leverage the shared helper ecosystem: diff --git a/openspec/changes/1016-table-owner-rule/.openspec.yaml b/openspec/changes/1016-table-owner-rule/.openspec.yaml new file mode 100644 index 0000000000..0d31f8b570 --- /dev/null +++ b/openspec/changes/1016-table-owner-rule/.openspec.yaml @@ -0,0 +1,3 @@ +schema: spec-driven +created: 2026-10-28 +skip_specs: true diff --git a/openspec/changes/1016-table-owner-rule/design.md b/openspec/changes/1016-table-owner-rule/design.md new file mode 100644 index 0000000000..08869e4b5c --- /dev/null +++ b/openspec/changes/1016-table-owner-rule/design.md @@ -0,0 +1,17 @@ +# Design + +## Where the rule lives + +`AGENTS.md` sends code conventions to `ARCHITECTURE.md` and `CONTRIBUTING.md`, and each rule lives in one document only. `CONTRIBUTING.md` already holds the parser rule ("Closed Lists and Standard Parsers") and the naming table, so the placement rule replaces the old bullet there. `docs/ROUTINE_TASKS.md` states the routine step and points to `CONTRIBUTING.md`. + +## Decisions + +- **Owner of a table that several modules of one package read**: the `constants.py` of that package, made when it is first necessary. This keeps the table in the package that owns it and keeps `config/` for names that two or more packages share. +- **Names**: PEP 8 constants. `_` in the one module that reads it, `` in a package's `constants.py`, so its sibling modules import a public name. `CONST_` and `DEFAULT_` stay the names of shared values in `config/`. +- **When a table moves**: when a change edits its owner, as the decision says. The items #1025 to #1032 move the tables of their packages before that. + +## Rejected alternatives + +- **A checker with a baseline** (`core/config_placement.py`, `tests/fixtures/config_placement_baseline.json` and two invariants in `tests/test_architectural_invariants.py`), from the 2026-10-17 plan of this item. The owner decision of 2026-10-22 rejected it: no gate checks the placement, and the project adds no ratchet. +- **The change to `DEFAULT_SANDBOX_POLICY`** that the second invariant needed. Without the invariant, nothing needs it. +- **Edits to `AGENTS.md`**. It holds no copy of the rule since its rewrite, and a second copy would break "each rule lives in one document only". diff --git a/openspec/changes/1016-table-owner-rule/proposal.md b/openspec/changes/1016-table-owner-rule/proposal.md new file mode 100644 index 0000000000..b61c03d70b --- /dev/null +++ b/openspec/changes/1016-table-owner-rule/proposal.md @@ -0,0 +1,37 @@ +# Proposal + +## Why + +Issue #1016: the documents told contributors to declare every list, tuple or frozen set that matches, classifies or filters values in `src/devops_cli/config/constants.py` or `src/devops_cli/config/defaults.py`. A table that one module reads then lives in a file of another package, far from its owner. The owner decided on 2026-10-22: + +- A string table lives beside its one owner. It moves to `src/devops_cli/config/` only when a second package imports it. +- A maintained library or a language parser does the classification. A hand-written list is acceptable only for a closed domain that a standard defines. +- No constant moves in this change. A constant moves when its module is next changed. +- No gate checks the placement, and the project adds no ratchet. + +## What Changes + +- `CONTRIBUTING.md`, "Closed Lists and Standard Parsers": a matching table is a named module-level table beside its one owner, the module that reads it or the `constants.py` of its package. It moves to `config/` only when a module of a second package imports it. A change to the owner of a single-package table in `config/` moves the table to its owner. +- `CONTRIBUTING.md`, the Constant row of the naming table: `_` in its one module, `` in a package's `constants.py`, and `CONST_` or `DEFAULT_` in `config/` for a name that two or more packages import. +- `docs/ROUTINE_TASKS.md`: the routine-task matrix row, the flowchart step and step 3 of the inner loop state the same rule, and point to `CONTRIBUTING.md`. +- The change alters no behavior that a consumer observes: it changes two documents. So it has no spec delta and sets `skip_specs: true`. +- This change fits one pull request. + +## Impact + +- `CONTRIBUTING.md`, `docs/ROUTINE_TASKS.md`. +- The items that move single-owner tables out of `config/` (#1025 to #1032) follow this rule. + +## Feasibility + +Checked at `origin/main` daaffc62 on 2026-10-28: + +- `AGENTS.md` (43 lines) holds no placement rule and no parser rule. It sends code conventions to `ARCHITECTURE.md` and `CONTRIBUTING.md`, and each rule lives in one document only. So the decision's edits to `AGENTS.md` (one parser bullet, the duplicate bullet deleted, a shorter file) are already in place, and this change does not edit `AGENTS.md`. +- The parser rule of the decision is in `CONTRIBUTING.md`, "Closed Lists and Standard Parsers", lines 17 to 19. +- `src/devops_cli/ai/instruction_generator.py` writes no placement rule into the files it generates, and `RELEASE_CYCLE.md` no longer states the rule (`git grep` for `constants.py`, `defaults.py` and "centralize"). +- The old rule stayed in `CONTRIBUTING.md:20` and `:124`, and in `docs/ROUTINE_TASKS.md:28`, `:71` and `:87-90`. After this change, `git grep` finds no document that tells readers to declare every table in `config/constants.py` or `config/defaults.py`. +- No test and no ast-grep rule checks where a table is declared (`git grep` in `tests/`, `sgconfig.yml` and `src/`). So no check contradicts the new rule, and the decision adds none. + +## Existing Tool Considered + +The decision adds no check, so the change builds and uses no tool. An audit of the matching tables is a search for module-level upper-case collections over `src/devops_cli` with `rg`, which finds the tables in every package, not only in `config/`. The change deletes no code. diff --git a/openspec/changes/1016-table-owner-rule/tasks.md b/openspec/changes/1016-table-owner-rule/tasks.md new file mode 100644 index 0000000000..d8f068235a --- /dev/null +++ b/openspec/changes/1016-table-owner-rule/tasks.md @@ -0,0 +1,19 @@ +# Tasks + +## 1. The documents state the placement rule + +- [x] Replace the placement bullet of "Closed Lists and Standard Parsers" and the Constant row of the naming table in `CONTRIBUTING.md` + - Verification: `git grep -n "constants.py" CONTRIBUTING.md` shows no sentence that puts every table in `config/` +- [x] State the same rule in the matrix row, the flowchart step and step 3 of `docs/ROUTINE_TASKS.md` + - Verification: `uv run devops docs check` +- [x] Regenerate the documentation + - Verification: `uv run devops docs generate --sync-readme` + +## 2. Archive + +- [ ] Archive the change + - Verification: `uv run devops openspec archive 1016-table-owner-rule` + +## Workflow follow-up + +- #1025 to #1032 move the single-owner tables of their packages out of `config/`. From 2a4b24a51d5bf8af7e8b1d9f955a01bc33589a37 Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Wed, 28 Oct 2026 18:33:08 +0000 Subject: [PATCH 2/2] docs(openspec): archive 1016-table-owner-rule --- .../2026-10-28-1016-table-owner-rule}/.openspec.yaml | 0 .../2026-10-28-1016-table-owner-rule}/design.md | 0 .../2026-10-28-1016-table-owner-rule}/proposal.md | 0 .../2026-10-28-1016-table-owner-rule}/tasks.md | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename openspec/changes/{1016-table-owner-rule => archive/2026-10-28-1016-table-owner-rule}/.openspec.yaml (100%) rename openspec/changes/{1016-table-owner-rule => archive/2026-10-28-1016-table-owner-rule}/design.md (100%) rename openspec/changes/{1016-table-owner-rule => archive/2026-10-28-1016-table-owner-rule}/proposal.md (100%) rename openspec/changes/{1016-table-owner-rule => archive/2026-10-28-1016-table-owner-rule}/tasks.md (96%) diff --git a/openspec/changes/1016-table-owner-rule/.openspec.yaml b/openspec/changes/archive/2026-10-28-1016-table-owner-rule/.openspec.yaml similarity index 100% rename from openspec/changes/1016-table-owner-rule/.openspec.yaml rename to openspec/changes/archive/2026-10-28-1016-table-owner-rule/.openspec.yaml diff --git a/openspec/changes/1016-table-owner-rule/design.md b/openspec/changes/archive/2026-10-28-1016-table-owner-rule/design.md similarity index 100% rename from openspec/changes/1016-table-owner-rule/design.md rename to openspec/changes/archive/2026-10-28-1016-table-owner-rule/design.md diff --git a/openspec/changes/1016-table-owner-rule/proposal.md b/openspec/changes/archive/2026-10-28-1016-table-owner-rule/proposal.md similarity index 100% rename from openspec/changes/1016-table-owner-rule/proposal.md rename to openspec/changes/archive/2026-10-28-1016-table-owner-rule/proposal.md diff --git a/openspec/changes/1016-table-owner-rule/tasks.md b/openspec/changes/archive/2026-10-28-1016-table-owner-rule/tasks.md similarity index 96% rename from openspec/changes/1016-table-owner-rule/tasks.md rename to openspec/changes/archive/2026-10-28-1016-table-owner-rule/tasks.md index d8f068235a..fb2e721c3a 100644 --- a/openspec/changes/1016-table-owner-rule/tasks.md +++ b/openspec/changes/archive/2026-10-28-1016-table-owner-rule/tasks.md @@ -11,7 +11,7 @@ ## 2. Archive -- [ ] Archive the change +- [x] Archive the change - Verification: `uv run devops openspec archive 1016-table-owner-rule` ## Workflow follow-up