diff --git a/OVERRIDING.md b/OVERRIDING.md index 819e906..c6c7017 100644 --- a/OVERRIDING.md +++ b/OVERRIDING.md @@ -95,8 +95,8 @@ and no RelayView bundle contains it. | `research` | `planner` / `planning` | manual | 1 | — | 0.13.0 | `v0.13.0` | No | | `to-questionnaire` | `planner` / `planning` | manual | 1 | — | 0.13.0 | `v0.13.0` | No | | `implementer-investigation` | `implementer` / `implementation` | automatic | 1 | — | 0.13.0 | `v0.13.0` | Implementer automatic, 1st | -| `implementer-handoff` | `implementer` / `implementation` | automatic | 1 | — | 0.13.0 | `v0.13.0` | Implementer automatic, 2nd | -| `implementer-communication` | `implementer` / `implementation` | automatic | 3 | `communication_context` | 0.13.0 | `v0.13.0` | Implementer automatic, 3rd | +| `implementer-handoff` | `implementer` / `implementation` | automatic | 1 | — | 0.16.0 | `v0.16.0`, not yet tagged | Implementer automatic, 2nd | +| `implementer-communication` | `implementer` / `implementation` | automatic | 3 | `communication_context` | 0.16.0 | `v0.16.0`, not yet tagged | Implementer automatic, 3rd | | `diagnosing-bugs` | `implementer` / `implementation` | automatic | 1 | — | 0.13.0 | `v0.13.0` | No | | `domain-modeling` | `implementer` / `implementation` | automatic | 1 | — | 0.13.0 | `v0.13.0` | No | | `tdd-auto` | `implementer` / `implementation` | automatic | 1 | — | 0.13.0 | `v0.13.0` | No | @@ -190,6 +190,37 @@ or how a guardrail task is queued; RelayView's owner would supply those. Where the owner assigns no escalation interface, the packages put the reason and risk summary in the Plan or review result instead. +### Implementer inner-loop and flag packages + +From `v0.16.0`, the Implementer defaults carry the operating model's tight +inner loop and indirect escalation. Until RelayView pins `v0.16.0`, it uses +the `v0.13.0` releases of these packages. The +[release notes](RELEASE-NOTES.md) summarize each package's change, before and +after. Each package forks independently: + +- **`implementer-handoff`** runs the Plan's Implementer fast checks (types, + lint, static analysis, unit and integration tests: seconds, not minutes) + after each change and resolves Planner feedback before sealing a candidate + for review and the Building Inspector. On genuine specification ambiguity, + an unexpected sensitive boundary, a visible tradeoff the specification does + not settle, or scope creep, it raises a + `needs_operator_decision` or `scope_exceeded` flag to the Planner instead of + paging the Operator or improvising, and it never escalates with a typed + reason itself; `planner-scope` settles or promotes the flag. Its handoff + report adds declared test-resource readiness and known gaps. Fork + `handoff.md` to change the inner loop, when to flag, or the report's + content; fork `SKILL.md` to change the method's outline. +- **`implementer-communication`** leads a candidate handoff with its + readiness, fast-check results, and known gaps, and frames a flag as a + question for the Planner with its options and evidence. Fork it to change + tone or order; keep `schemaVersion: 3` and the `communication_context` + treatment. + +No package defines the owner's flag record, its routing to the Planner, or how +a candidate is sealed; RelayView's owner would supply those. Where the owner +assigns no flag interface, `implementer-handoff` puts the flag at the top of +its message to the Planner and lists open flags in the handoff. + ## What a skill controls and what the owner enforces A package is model-facing text. It changes how an agent works inside its role; @@ -204,7 +235,7 @@ admission. | Specification work | Interview style, question order, method entry, draft shape | Publication, the method-entry gate, and Operator acceptance of a specification | Current | | Planning and investigation | Investigation methods, scope analysis, research method, Plan presentation | Plan authority, finalization schemas, validation-manifest adoption, research budgets and tool contracts | Current | | Issue claim | Nothing in prose | The schema-2 `issueClaim` sidecar value selects the claim; the owner validates and performs the Gitea change after proved implementation handoff | Current | -| Implementation handoff | Change focus, clarification cadence, documentation-writing technique | Report fields, documentation disposition, evidence submission, clean committed candidates, stop rules | Current | +| Implementation handoff | Change focus, fast-check iteration, clarification cadence, documentation-writing technique | Report fields, documentation disposition, evidence submission, clean committed candidates, stop rules | Current | | Review | Finding presentation and inspection techniques | Exact-candidate scope, dispositions, correction routing, review and merge gates | Current | | Communication | Tone, detail, examples, acknowledgements | Publication identity and order, mandatory status, complete durable artifacts; communication packages load only when the frozen `communication_context` treatment is on | Current | | Manual methods | When a method is worth invoking | `/skill:` reaches a session only if that name is in its captured assignment | Current | @@ -212,6 +243,7 @@ admission. | Coordination | Wave aggressiveness, contention heuristics, resource batching, when to escalate, when and how to nudge a stalled task, when to park it, reorientation after a context refresh, what goes in the Working Ledger, Control Tower reporting tone, on-request wave audit and tracker proposals | Ready state and prerequisites, dispatch through owner commands, the Operator's Autopilot toggle, resource leases, review policy, nudge budgets and cooldowns, task state and the Working Ledger's persistence, tracker changes, which the Coordinator only proposes and the Operator applies | Proposed | | Testing | How to exercise a candidate, which defects to look for, when to escalate, and how to present a proof summary | The Tester's tool and resource confinement, the exact-candidate binding of the Verification Proof Bundle and its fields, invalidation of proof from a superseded candidate, and the typed escalation record | Proposed | | Review tiers | How to frame a risk or escalation summary, when the Planner resolves or promotes an Implementer flag, and how the Specification Designer proposes proof artifacts, fast-test completeness, test resources, and a review stamp | Repository trust ceiling (Layer A), the Operator's per-specification stamp (Layer B), and the one-way escalation ratchet with typed reasons (Layer C): no agent may downgrade `operator_review_required` | Proposed | +| Implementer flags | When the Implementer raises a `needs_operator_decision` or `scope_exceeded` flag, how it frames one, and how it reports test-resource readiness | The structured flag record, its routing to the Planner rather than the Operator, and sealing the candidate | Proposed | | Guardrail proposals | When a defect class is repeatable enough to propose a guardrail, and which Trust Pyramid rung to recommend | The Guardrail Proposal card, queueing its follow-up task, and Operator approval before any candidate prose skill becomes active | Proposed | Proposed rows come from RelayView's coordinator and verification operating diff --git a/README.md b/README.md index 7cec3ab..d663490 100644 --- a/README.md +++ b/README.md @@ -98,4 +98,4 @@ seam to fork for each customization. Planner direct-address presentation is supplied by planner-communication. Forks can replace this presentation while retaining communication_context treatment metadata. -The not-yet-tagged v0.16.0 release updates `planner-scope`, `planner-communication`, `code-review-auto`, `code-review`, and `reviewer-communication`: the Planner turns the Specification Designer's requested proof into Implementer fast checks and Building Inspector verification goals, resolves or promotes Implementer escalation flags, and escalates with typed reasons, and the Reviewer proposes guardrails. `planner-scope` keeps schema 2 and its `issueClaim`. Apart from these and the new Tester, Specification Designer, and Coordinator packages, other packages retain their existing versions. The [release notes](RELEASE-NOTES.md) give each changed package's before and after for fork maintainers. +The not-yet-tagged v0.16.0 release updates `planner-scope`, `planner-communication`, `implementer-handoff`, `implementer-communication`, `code-review-auto`, `code-review`, and `reviewer-communication`: the Planner turns the Specification Designer's requested proof into Implementer fast checks and Building Inspector verification goals, resolves or promotes Implementer escalation flags, and escalates with typed reasons; the Implementer converges those fast checks before sealing a candidate and routes uncertainty and scope flags to the Planner instead of the Operator; and the Reviewer proposes guardrails. `planner-scope` keeps schema 2 and its `issueClaim`. Apart from these and the new Tester, Specification Designer, and Coordinator packages, other packages retain their existing versions. The [release notes](RELEASE-NOTES.md) give each changed package's before and after for fork maintainers. diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index cdd2f5e..379d2ff 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -8,14 +8,16 @@ package's current version and release. ## v0.16.0 (not yet tagged) -Planner and Reviewer guidance for RelayView's proposed tiered review: the -Planner turns the Specification Designer's requested proof into checks, -triages Implementer flags, and escalates with typed reasons; the Reviewer -proposes Trust Pyramid guardrails. Owner rules for typed escalation and -Guardrail Proposal cards are proposed in RelayView and not yet shipped, so -the packages fall back to stating an escalation in the Plan or review result -when no escalation interface is assigned. No schema, role, or step changes; -every earlier release keeps its bytes. +Planner, Implementer, and Reviewer guidance for RelayView's proposed tiered +review: the Planner turns the Specification Designer's requested proof into +checks, triages Implementer flags, and escalates with typed reasons; the +Implementer converges fast checks before sealing a candidate and flags +uncertainty to the Planner; the Reviewer proposes Trust Pyramid guardrails. +Owner rules for typed escalation, Implementer flags, and Guardrail Proposal +cards are proposed in RelayView and not yet shipped, so the packages fall back +to stating an escalation in the Plan or review result, and a flag in the +message to the Planner, when no owner interface is assigned. No schema, role, +or step changes; every earlier release keeps its bytes. ### `planner-scope` @@ -52,6 +54,47 @@ every earlier release keeps its bytes. rather than a question. - **Fork:** schema 3 and `communication_context` are unchanged. +### `implementer-handoff` + +- **Before (0.13.0):** documentation reconciliation, clarification with the + Planner, and review content naming the candidate and its focused checks. +- **After:** `SKILL.md` adds three short sections that defer to the guide: + "Converge before sealing" (iterate on the Plan's Implementer fast checks and + Planner feedback before sealing a candidate for the Building Inspector), + "Flag instead of escalating" (send a decision the guide's triggers describe + to the Planner as a flag rather than to the Operator), and "Hand off", which + replaces the inline list of report items with the guide's review content + and completes when the handoff states the fast-check results on the exact + candidate. `handoff.md` carries the rules. Its new + "Inner loop" section defines fast checks (types, lint, static analysis, unit + and integration tests: seconds, not minutes), falls back to the + repository's focused checks when the Plan names none, and never presents a + candidate with a failing fast check as ready. Its new "Flags to the + Planner" section raises `needs_operator_decision` for genuine specification + ambiguity, an unexpected sensitive boundary, or an unsettled visible + tradeoff, and `scope_exceeded` for scope creep. It never pages the Operator + or silently improvises, raises one flag per decision and never just to be + safe, and uses the message to the Planner as the fallback when no flag + interface is assigned. Review content adds declared test-resource readiness, + known gaps, and the documentation disposition and manual-evidence observer + that `SKILL.md` previously listed. The description names the new scope. + The package names no typed escalation reason: the Implementer only flags. +- **Fork:** schema 1 and the two declared files are unchanged. The inner-loop + and flag rules live in `handoff.md`, so a fork that keeps its own + `handoff.md` can adopt them without touching `SKILL.md`; recalculate the + digest of each changed file. + +### `implementer-communication` + +- **Before (0.13.0):** proportional detail, Markdown, acknowledgements, and + report-field explanation. +- **After:** adds one paragraph: Specification Designer naming, a candidate + handoff that leads with readiness, fast-check results, and known gaps, and a + flag addressed to the Planner with its name, question, options, evidence, + and the work continuing meanwhile, never as a request for the Operator to + decide. +- **Fork:** schema 3 and `communication_context` are unchanged. + ### `code-review-auto` - **Before (0.13.0):** one line asking for bounded, path-aware, actionable diff --git a/packages/implementer-communication/SKILL.md b/packages/implementer-communication/SKILL.md index 488fbb3..9232b66 100644 --- a/packages/implementer-communication/SKILL.md +++ b/packages/implementer-communication/SKILL.md @@ -3,7 +3,7 @@ name: implementer-communication description: Communication style for the assigned implementer; proportional answers, examples, Markdown and natural acknowledgements. metadata: relayview-display-name: Implementer communication - relayview-version: 0.13.0 + relayview-version: 0.16.0 --- Lead with the answer, decision, observed finding, or material uncertainty. Use detail proportional to the immediate question, including requested examples and technical mechanics, with no fixed word, line, or token limit. Keep inspection effort independent of conversational length. @@ -13,3 +13,5 @@ For user-facing focused Chat messages, use Markdown when it makes the answer eas Keep the acknowledgement brief, relaxed, clear, and professional. Use natural contractions and vary the wording to fit the request; do not default to “I understand…” or repeat the user's full checklist. Briefly convey the requested outcome in your own words and, when useful, name an accurate first action. A short receipt is enough when the task and authorization are already clear. There is no fixed sentence count; three short sentences are fine. Describe only work within your current authorization. Receipt never means completed work, successful validation, approval, or newly granted implementation authority. Continue the authorized work without waiting for an unnecessary Operator reply. Describe observed work and material uncertainty. Explain delivered behavior, material deviations, verification and remaining limitations in the applicable report fields. After an accepted artifact, explain the result and material remaining action without repeating the whole report. Conversational detail and coding effort are independent; investigate, implement and verify as thoroughly as the task requires. + +Call the role that drafts specifications the Specification Designer. When you hand off a candidate, lead with whether it is ready: the exact candidate, the fast checks that passed or failed on it, and any known gap or open flag; leave the rest to the report's fields. When you raise a flag, name it, `needs_operator_decision` or `scope_exceeded`, and address it to the Planner with the question, the options you see, the evidence, and what you are doing meanwhile. Present a flag as a decision for the Planner to settle or escalate, never as a request for the Operator to decide and never as a warning with no decision in it. diff --git a/packages/implementer-communication/relayview-skill.json b/packages/implementer-communication/relayview-skill.json index 0ac689c..39ce338 100644 --- a/packages/implementer-communication/relayview-skill.json +++ b/packages/implementer-communication/relayview-skill.json @@ -2,7 +2,7 @@ "schemaVersion": 3, "source": { "kind": "first-party", - "reference": "v0.13.0" + "reference": "v0.16.0" }, "role": "implementer", "step": "implementation", @@ -10,7 +10,7 @@ "files": [ { "path": "SKILL.md", - "sha256": "89cc00ed7f84f2b759a02b3c561033b467828067c2bba061d822df4ebca34400" + "sha256": "96f1c444ba07158eecc02237b8c17516916b507c4309e1b02783eac0b18b6bc4" } ] } diff --git a/packages/implementer-handoff/SKILL.md b/packages/implementer-handoff/SKILL.md index 59f536f..a658cb7 100644 --- a/packages/implementer-handoff/SKILL.md +++ b/packages/implementer-handoff/SKILL.md @@ -1,15 +1,25 @@ --- name: implementer-handoff -description: Reconcile verified implementation documentation and prepare review content during implementation. +description: Converge fast checks before sealing a candidate, route uncertainty and scope flags to the Planner, reconcile verified documentation, and prepare review content during implementation. metadata: relayview-display-name: Implementer handoff - relayview-version: 0.13.0 + relayview-version: 0.16.0 --- # Implementer handoff -During the assigned implementation step, keep the repository's current-behavior documentation aligned with the code and checks you actually completed. Read the project's documentation rules and the relevant existing contract before editing it. Use the [handoff guide](handoff.md) for implementation clarification, documentation disposition and review content. +During the assigned implementation step, keep the repository's current-behavior documentation aligned with the code and checks you actually completed. Read the project's documentation rules and the relevant existing contract before editing it. Use the [handoff guide](handoff.md) for the inner loop, flags to the Planner, clarification, documentation and review content. -Prepare a concise, attributable review handoff when the assigned workflow gives you a place to submit one. Identify the exact candidate, focused checks and their observed results, any manual evidence and its observer, unresolved limitations, and the documentation disposition. A command attempted is not a check passed; report failures and stale evidence explicitly. +## Converge before sealing -Use only the Implementer's assigned tools and owner interfaces. The owner verifies validation, review, provider effects, and stage readiness; your prose is a report for that process. This step is complete when documentation describes verified behavior and the handoff lets a reviewer reproduce the relevant checks. +Work in a tight inner loop with the Planner, as the handoff guide describes: after each change, run the Plan's Implementer fast checks, and iterate until they pass and the Planner feedback is resolved before sealing a candidate. When a check cannot pass, report it instead. The Building Inspector's runtime verification is slow and scarce; it should find what fast checks cannot, not what they would have caught. + +## Flag instead of escalating + +When you meet a decision that one of the handoff guide's flag triggers describes, raise a `needs_operator_decision` or `scope_exceeded` flag to the Planner rather than escalating to the Operator yourself. The Planner settles the flag inside the approved specification or escalates it. + +## Hand off + +Prepare a concise, attributable review handoff with the content the handoff guide lists when the assigned workflow gives you a place to submit one. A command attempted is not a check passed; report failures and stale evidence explicitly. + +Use only the Implementer's assigned tools and owner interfaces. The owner verifies validation, review, provider effects, and stage readiness; your prose is a report for that process. This step is complete when documentation describes verified behavior and the handoff states the fast-check results on the exact candidate you seal and lets a reviewer reproduce the relevant checks. diff --git a/packages/implementer-handoff/handoff.md b/packages/implementer-handoff/handoff.md index 2b4c983..c32f038 100644 --- a/packages/implementer-handoff/handoff.md +++ b/packages/implementer-handoff/handoff.md @@ -1,10 +1,30 @@ # Handoff guide +## Inner loop + +- Take the fast checks from the Plan: deterministic checks that finish in seconds, not minutes, such as types, lint, static analysis, and unit and integration tests. When the Plan names none, use the repository's recorded focused checks for the changed areas and their direct consumers. +- Run them after each change and fix what they report before moving on. Keep the loop fast: a check that takes minutes belongs to verification, not to the inner loop. +- Resolve each piece of Planner feedback in the code or answer it with evidence, then rerun the affected checks. +- Aim to seal a candidate once every fast check passes on that exact candidate and no Planner feedback is open; the owner's workflow decides when it is sealed. Any later change makes earlier results stale; rerun the checks it affects. +- Do not run the Building Inspector's verification goals in place of fast checks, and do not use them to find defects a fast check would catch. +- If a fast check cannot pass, for example because of a failure outside the Plan or a missing tool, do not present the candidate as ready. Report the check, its output, and the cause you found to the Planner, and raise `scope_exceeded` only when fixing it needs work the Plan does not allow. + +## Flags to the Planner + +Before flagging, reread the specification, the Plan, and the project's documented contracts. If one of them settles the question, follow it and cite it in the handoff instead of flagging. + +- `needs_operator_decision`: genuine specification ambiguity, where two materially different behaviors both fit; an unexpected sensitive boundary the Plan does not mention, such as a public contract or API, a schema migration, authentication or security, CI or release configuration, a user-facing screen, or a new dependency, network egress, secret, or privilege; or a visible tradeoff the specification does not settle. +- `scope_exceeded`: scope creep, where the work appears to need files, behavior, or changes beyond what the Plan allows. + +Each flag states the question, the options you see, the evidence (files, lines, check output), and what you will do meanwhile. Raise it through the flag interface the owner assigns. Where none is assigned, put the flag at the top of your message to the Planner, and list any flag still open in the handoff. + +While a flag is open, continue the work it does not affect, and do not build the flagged part as though it were decided. Do not page the Operator directly, and do not silently improvise the behavior. Do not flag just to be safe: a flag without a decision in it costs the Planner time and tells nobody what to decide. Raise one flag per decision, and add new evidence to an open flag rather than raising it again. The Planner answers inside the approved specification or escalates to the Operator; follow its answer. + ## Implementation and clarification -Read the relevant files and make focused changes. Use the assigned investigation method for repository discovery; this handoff method owns clarification and report preparation. +Read the relevant files and make focused changes. Use the assigned investigation method for repository discovery; this handoff method owns clarification, flags, and report preparation. -Ask the planner for more information when blocked after reasonable investigation. If the final contract appears wrong, explain the mismatch clearly, make the safest local correction if obvious within the authoritative scope, and validate it. Clarification methods guide communication; scope changes require owner authority. +Ask the Planner for more information when blocked after reasonable investigation. If the final contract appears wrong, explain the mismatch clearly, make the safest local correction if obvious within the authoritative scope, and validate it; when the correction is not obvious, raise a flag instead. Clarification methods guide communication; scope changes require owner authority. ## Documentation @@ -15,6 +35,9 @@ Ask the planner for more information when blocked after reasonable investigation ## Review content - Summarize the user-visible change and its bounded impact. -- Name the candidate revision and the focused checks run against it, with observed pass or failure results. +- Name the candidate revision and the fast checks run against it, with observed pass or failure results. +- Report declared test-resource readiness: for each resource the Plan's verification goals need, say whether you confirmed it is available with your assigned tools, could not check it, or found it missing. Do not report a mock as the declared resource. +- List known gaps honestly: acceptance observations no fast check covers, verification goals and remaining manual Operator checks still open, skipped or flaky checks, and open flags. +- Record the documentation disposition, and name any manual evidence with its observer. - Give a reviewer executable steps and expected observations for any behavior that automated checks cannot establish. - State remaining uncertainty and recovery steps. Attribute provider or Operator observations to their actual source. diff --git a/packages/implementer-handoff/relayview-skill.json b/packages/implementer-handoff/relayview-skill.json index c40007c..2f89cd0 100644 --- a/packages/implementer-handoff/relayview-skill.json +++ b/packages/implementer-handoff/relayview-skill.json @@ -2,18 +2,18 @@ "schemaVersion": 1, "source": { "kind": "first-party", - "reference": "v0.13.0" + "reference": "v0.16.0" }, "role": "implementer", "step": "implementation", "files": [ { "path": "SKILL.md", - "sha256": "1cd3190db3991f9c310e2d3c3be854a32171cdf4d774d7868de466d5a403afe6" + "sha256": "c4c814afc5cadcf3b65e741e02ac620035a8283ec7409e6ae64042ff33a1f089" }, { "path": "handoff.md", - "sha256": "5171fe6c5aab6934f828efd6b06dcc3811e94f567035a56515fbc6798d4c9751" + "sha256": "2e8cef2f3eac1bb9cfcf6c3bac4ff0f58a4516e8f679c54739789801f28a9040" } ] } diff --git a/tests/test_implementer.py b/tests/test_implementer.py new file mode 100644 index 0000000..6add375 --- /dev/null +++ b/tests/test_implementer.py @@ -0,0 +1,160 @@ +"""Pin the v0.16.0 Implementer guidance: tight inner-loop convergence on fast +checks before sealing, and indirect escalation through the Planner.""" + +import re +import unittest + +from tests.test_planner_reviewer import DIRECT_REASONS, IMPLEMENTER_FLAGS, ROOT, VERSION, read +from tools.packages import check_package + +# name: (schema, sidecar extra, declared files) +PACKAGES = { + "implementer-handoff": (1, {}, ["SKILL.md", "handoff.md"]), + "implementer-communication": (3, {"treatment": "communication_context"}, ["SKILL.md"]), +} + + +class ImplementerReleaseTests(unittest.TestCase): + def test_packages_move_to_v0_16_0_with_unchanged_schemas(self): + for name, (schema, extra, files) in PACKAGES.items(): + with self.subTest(package=name): + check_package(ROOT / "packages" / name) + manifest, frontmatter, _ = read(name) + self.assertEqual(manifest["source"], {"kind": "first-party", "reference": f"v{VERSION}"}) + self.assertEqual((manifest["role"], manifest["step"], manifest["schemaVersion"]), + ("implementer", "implementation", schema)) + for key, value in extra.items(): + self.assertEqual(manifest[key], value) + self.assertEqual([item["path"] for item in manifest["files"]], files) + self.assertIn(f"relayview-version: {VERSION}", frontmatter) + self.assertNotIn("disable-model-invocation", frontmatter) + + def test_prose_stays_out_of_owner_report_and_flag_schemas(self): + # No JSON objects or code fences, and no snake_case, camelCase, or + # PascalCase identifiers beyond the two flag names and the existing + # documentation disposition value. + for name in PACKAGES: + with self.subTest(package=name): + text = read(name)[2] + self.assertNotIn("```", text) + self.assertNotIn("{", text) + identifiers = set(re.findall(r"\b\w+_\w+\b|\b[a-z]+[A-Z]\w*\b|\b[A-Z][a-z]+[A-Z]\w*\b", text)) + self.assertLessEqual(identifiers, set(IMPLEMENTER_FLAGS) | {"not_required"}) + + def test_packages_use_specification_designer_terminology(self): + for name in PACKAGES: + with self.subTest(package=name): + self.assertNotRegex(read(name)[2], r"(?i)issue designer") + + +class InnerLoopTests(unittest.TestCase): + def setUp(self): + self.text = read("implementer-handoff")[2] + + def test_converges_fast_checks_before_sealing(self): + for phrase in ("fast check", "seconds, not minutes", "types, lint, static analysis", + "unit and integration tests", "Plan", "Planner feedback", + "before sealing", "Building Inspector", "until they pass", + "the exact candidate you seal"): + with self.subTest(phrase=phrase): + self.assertIn(phrase.lower(), self.text.lower()) + + def test_does_not_seal_a_failing_candidate_as_ready(self): + # A fast check that cannot pass is reported, never presented as ready. + self.assertIn("do not present the candidate as ready", self.text) + # Sealing is the owner's gate: the prose guides the Implementer toward + # it rather than restating it, so a check that can never pass still + # ends in a report instead of a step that cannot finish. + for gate in ("Seal a candidate only when", "complete when the fast checks pass"): + with self.subTest(gate=gate): + self.assertNotIn(gate, self.text) + # A failing check is a scope flag only when the fix leaves the Plan. + self.assertIn("raise `scope_exceeded` only when", self.text) + + def test_handoff_guide_owns_the_forkable_rules(self): + # Like planner-scope's escalation guide, the resource carries the + # rules, so forking handoff.md alone changes the inner loop and flags. + handoff = (ROOT / "packages/implementer-handoff/handoff.md").read_text() + skill = (ROOT / "packages/implementer-handoff/SKILL.md").read_text() + for rule in ("seconds, not minutes", "types, lint, static analysis", "genuine specification ambiguity", + "Do not page the Operator", "silently improvise", "test-resource readiness", "known gaps", + "documentation disposition"): + with self.subTest(rule=rule): + self.assertIn(rule, handoff) + self.assertNotIn(rule, skill) + + def test_reports_test_resource_readiness_and_known_gaps(self): + for phrase in ("declared test-resource", "readiness", "known gap", "verification goal", + "remaining manual Operator check"): + with self.subTest(phrase=phrase): + self.assertIn(phrase.lower(), self.text.lower()) + + def test_keeps_existing_clarification_method(self): + handoff = (ROOT / "packages/implementer-handoff/handoff.md").read_text() + self.assertIn("blocked after reasonable investigation", handoff) + self.assertIn("scope changes require owner authority", handoff) + + +class IndirectEscalationTests(unittest.TestCase): + def setUp(self): + self.text = read("implementer-handoff")[2] + + def test_flags_go_to_the_planner_not_the_operator(self): + for flag in IMPLEMENTER_FLAGS: + with self.subTest(flag=flag): + self.assertIn(f"`{flag}`", self.text) + for phrase in ("to the Planner", "Do not page the Operator", "silently improvise", + "genuine specification ambiguity", "unexpected sensitive boundary", "scope creep", + "just to be safe", "flag interface the owner assigns", + "Where none is assigned"): + with self.subTest(phrase=phrase): + self.assertIn(phrase, self.text) + + def test_implementer_never_escalates_directly(self): + # Typed Layer C reasons belong to the Planner, Reviewer, and Tester; the + # Implementer only flags, so no direct reason appears in its packages. + for name in PACKAGES: + text = read(name)[2] + for reason in DIRECT_REASONS: + with self.subTest(package=name, reason=reason): + self.assertNotIn(reason, text) + + +class CommunicationTests(unittest.TestCase): + def test_communication_frames_handoffs_and_flags(self): + text = read("implementer-communication")[2] + for phrase in ("Specification Designer", "fast check", "candidate", "known gap", + "`needs_operator_decision`", "`scope_exceeded`", "Planner", + "options", "evidence", "meanwhile", + "proportional", "acknowledgement", "Markdown"): + with self.subTest(phrase=phrase): + self.assertIn(phrase, text) + + +class ReleaseNotesTests(unittest.TestCase): + def test_release_notes_give_before_and_after_for_each_package(self): + notes = (ROOT / "RELEASE-NOTES.md").read_text() + match = re.search(rf"^## v{re.escape(VERSION)}\b.*?(?=^## |\Z)", notes, re.M | re.S) + self.assertIsNotNone(match, "no v0.16.0 section") + for name in PACKAGES: + with self.subTest(package=name): + entry = re.search(rf"^### `{name}`\n.*?(?=^### |\Z)", match.group(0), re.M | re.S) + self.assertIsNotNone(entry, f"no entry for {name}") + self.assertIn("**Before (0.13.0):**", entry.group(0)) + self.assertIn("**After:**", entry.group(0)) + self.assertIn("**Fork:**", entry.group(0)) + + def test_overriding_names_the_implementer_seams(self): + text = (ROOT / "OVERRIDING.md").read_text() + match = re.search(r"^### Implementer inner-loop and flag packages\n.*?(?=^##)", text, re.M | re.S) + self.assertIsNotNone(match, "no Implementer section in OVERRIDING.md") + for phrase in ("`implementer-handoff`", "`handoff.md`", "`implementer-communication`", + "`needs_operator_decision`", "`scope_exceeded`", "(RELEASE-NOTES.md)", + "genuine specification ambiguity", "unexpected sensitive boundary", + "visible tradeoff", "scope creep"): + with self.subTest(phrase=phrase): + self.assertIn(phrase, match.group(0)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_packages.py b/tests/test_packages.py index aecb53f..6e9135e 100644 --- a/tests/test_packages.py +++ b/tests/test_packages.py @@ -321,7 +321,7 @@ class PackageTests(unittest.TestCase): def test_maintained_guidance_covers_distinct_role_steps(self): expected = { "planner-scope": ("planner", "planning", "scope.md", "Plan", "v0.16.0"), - "implementer-handoff": ("implementer", "implementation", "handoff.md", "documentation", "v0.13.0"), + "implementer-handoff": ("implementer", "implementation", "handoff.md", "documentation", "v0.16.0"), } for name, (role, step, resource, marker, release) in expected.items(): with self.subTest(name=name):