Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:
Expand Down Expand Up @@ -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 | `<type>(<scope>): <summary>` | The `Semantic PR title` check for the title. None for a commit on a branch. |
| Change folder | `<issue>-<slug>`, archived as `<YYYY-MM-DD>-<issue>-<slug>` | `devops openspec check` and `tests/test_change_folders.py`. |
| Python module, class, function and variable | PEP 8 | Ruff `N`. |
| Constant | `CONST_<NAME>` in `config/constants.py`; `DEFAULT_<NAME>` for a tunable value in `config/defaults.py` | None. |
| Constant | `_<NAME>` in the one module that reads it. `<NAME>` in the `constants.py` of a package when several of its modules read it. `CONST_<NAME>` in `config/constants.py`, or `DEFAULT_<NAME>` 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. |
Expand Down
9 changes: 4 additions & 5 deletions docs/ROUTINE_TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <file>` | 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 <file>` | 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 <test-file>` | Fast isolated testing of active features/fixes, with xdist workers sized to the selection | Targeted tests pass |
Expand Down Expand Up @@ -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]
Expand All @@ -84,10 +84,9 @@ flowchart TD
- Without a matching issue: **FILE THE TASK AS A CANDIDATE** (`devops roadmap intake --title "<conventional title>" --body-file <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/<issue>-<slug>/` ([`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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
schema: spec-driven
created: 2026-10-28
skip_specs: true
Original file line number Diff line number Diff line change
@@ -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. `_<NAME>` in the one module that reads it, `<NAME>` in a package's `constants.py`, so its sibling modules import a public name. `CONST_<NAME>` and `DEFAULT_<NAME>` 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".
Original file line number Diff line number Diff line change
@@ -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: `_<NAME>` in its one module, `<NAME>` in a package's `constants.py`, and `CONST_<NAME>` or `DEFAULT_<NAME>` 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.
Original file line number Diff line number Diff line change
@@ -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

- [x] 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/`.
Loading