From 98f772c92066d602f47dcc1454e1f418f5e25b46 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 23:52:49 +0000 Subject: [PATCH 1/2] Initial plan From 8254b893629742653cb5693e6a3eaee48433e900 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 23:55:45 +0000 Subject: [PATCH 2/2] Add .github/copilot-instructions.md and .github/prompts/commitboundary_spec_intake.prompt.md Co-authored-by: LalaSkye <228581229+LalaSkye@users.noreply.github.com> --- .github/copilot-instructions.md | 55 +++++++++++ .../commitboundary_spec_intake.prompt.md | 93 +++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/prompts/commitboundary_spec_intake.prompt.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..33debb4 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,55 @@ +# Copilot Instructions — constraint-workshop + +## Repo identity + +This repository holds small, deterministic control primitives. +Every primitive is a single file + a test file. No frameworks. No runtime dependencies. No hidden state. + +## Invariant files — DO NOT MODIFY + +The following files are **frozen**. Never edit, refactor, rename, or delete them: + +- `authority_gate.py` +- `stop_machine.py` +- `invariant_litmus.py` +- `commit_gate/` (entire directory) + +If any suggestion would touch these paths, stop and say so instead of making the change. + +## Bounded intake rule + +**No implementation code may be generated until all of the following are true:** + +1. A schema (data shape + field constraints) for the new primitive exists in a `.py` or `.md` file. +2. Golden tests exist that assert specific, pinned expected values (not just "it doesn't crash"). +3. All golden tests are collected by `pytest` and initially fail with `NotImplementedError` or an import error — proving the tests are real and the implementation does not yet exist. + +Refusing to proceed past this gate is correct behaviour, not a bug. + +## Test-first order + +When asked to build a new primitive, always do work in this order: + +1. **Schema** — define data types, enumerations, and field constraints only. No logic. +2. **Golden tests** — write `pytest` tests that pin exact expected outputs for known inputs. Tests must fail until step 3. +3. **Implementation** — only after the user confirms the tests fail as expected. + +Do not collapse these steps. Do not combine schema + implementation in one pass. + +## Style rules + +- Stdlib only. Do not add third-party imports unless the user explicitly approves. +- No global mutable state. +- No `random`, `uuid`, `time.time()`, `datetime.now()`, or `os.getpid()` in any primitive. +- All public functions must be pure (same input → same output, always). +- Test files are named `test_.py` and live in the repo root (or `/tests/`). + +## CI contract + +CI runs `pytest -q` across Python 3.10, 3.11, 3.12. +A PR is not ready to merge until `pytest -q` passes with zero failures. + +## Out of scope + +Do not generate: orchestration layers, policy engines, selection logic, ML models, HTTP clients, database connections, or logging frameworks. +`/prometheus` is the observability-only sub-package (`prometheus/src/prometheus/`). It aggregates diagnostic events and reports health posture. It must not be imported by any gate, primitive, or pipeline code. diff --git a/.github/prompts/commitboundary_spec_intake.prompt.md b/.github/prompts/commitboundary_spec_intake.prompt.md new file mode 100644 index 0000000..595f428 --- /dev/null +++ b/.github/prompts/commitboundary_spec_intake.prompt.md @@ -0,0 +1,93 @@ +# CommitBoundary Spec Intake + +Use this prompt file to introduce a new primitive or spec change in a bounded, test-first way. +Run it from VS Code: **Command Palette → "Chat: Run Prompt"**, then select this file. + +--- + +## Step 0 — Gate check + +Before generating anything, confirm: + +- [ ] The request does **not** touch `authority_gate.py`, `stop_machine.py`, `invariant_litmus.py`, or `commit_gate/`. + +If it does, **stop here** and tell the user which protected file would be affected. Do not proceed. + +--- + +## Step 1 — Schema only + +Generate a schema file named `_schema.py` containing: + +- Enumerations or `TypedDict`/`NamedTuple` definitions for every data type the primitive will use. +- Field-level constraints as inline docstrings (e.g., "must be non-negative", "immutable after construction"). +- A `SCHEMA_VERSION` string constant (start at `"0.1"` for new primitives; increment the minor version when updating an existing schema). +- **No logic. No methods beyond `__repr__`. No `__init__` that does computation.** + +Do **not** generate an implementation file yet. + +--- + +## Step 2 — Golden tests (fail-first) + +Generate a test file named `test_.py` containing: + +- At least three test functions that assert **exact, pinned expected values** for known inputs. +- One test that asserts a `TypeError` or `ValueError` is raised for invalid inputs. +- One test that asserts the function/class raises `NotImplementedError` when called (proving the stub is not yet implemented). +- Import the module as if it exists: `from import ...` + +**All tests must fail** until the implementation exists. Confirm this by noting at the bottom of the file: + +```python +# FAIL-FIRST: these tests must fail until the implementation is complete. +``` + +Do **not** generate an implementation file yet. + +--- + +## Step 3 — User confirmation gate + +At this point, output a summary checklist: + +``` +Schema file: _schema.py ✓ generated +Golden tests: test_.py ✓ generated (expect failures) + +Next step: run `pytest test_.py -v` and confirm all tests fail. +Reply "tests fail as expected" to unlock Step 4. +``` + +**Do not proceed to Step 4 without the user's confirmation.** + +--- + +## Step 4 — Implementation + +Only after the user confirms the tests fail: + +1. Generate `.py` with the minimal implementation that makes all golden tests pass. +2. Do not add features not covered by the golden tests. +3. Stdlib only — no third-party imports unless the user explicitly approved them in this session. +4. After generating, output the command to verify: + +``` +pytest test_.py -v +``` + +--- + +## Step 5 — Final checklist + +After implementation: + +``` +Schema: _schema.py ✓ +Golden tests: test_.py ✓ (all passing) +Implementation: .py ✓ +CI command: pytest -q (run to confirm nothing regressed) +Protected files: authority_gate.py / stop_machine.py / invariant_litmus.py / commit_gate/ ✓ untouched +``` + +Do not open a PR until this checklist is complete.