okstra 0.230.0 → 0.231.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/architecture/storage-model.md +67 -6
- package/docs/architecture.md +2 -0
- package/docs/coding-rules.md +15 -0
- package/docs/project-structure-overview.md +2 -1
- package/package.json +2 -2
- package/runtime/BUILD.json +2 -2
- package/runtime/prompts/coding-preflight/clean-code.md +8 -0
- package/runtime/prompts/coding-preflight/overview.md +1 -0
- package/runtime/prompts/launch.template.md +2 -0
- package/runtime/prompts/lead/okstra-lead-contract.md +5 -5
- package/runtime/prompts/profiles/_coding-conventions-preflight.md +2 -0
- package/runtime/python/okstra_ctl/agent/invocation.py +48 -4
- package/runtime/python/okstra_ctl/blocking_checks.py +10 -0
- package/runtime/python/okstra_ctl/conformance_evidence.py +148 -67
- package/runtime/python/okstra_ctl/execution_mutation_audit.py +13 -1
- package/runtime/python/okstra_ctl/incremental_carry.py +7 -4
- package/runtime/python/okstra_ctl/paths.py +19 -4
- package/runtime/python/okstra_ctl/phases/final_verification/profile.md +1 -0
- package/runtime/python/okstra_ctl/phases/final_verification/report_assets/final-verification.template.html +8 -0
- package/runtime/python/okstra_ctl/phases/final_verification/spec.md +1 -0
- package/runtime/python/okstra_ctl/phases/final_verification/validation.py +53 -0
- package/runtime/python/okstra_ctl/phases/implementation/host-rules.md +5 -1
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-deliverable.md +2 -0
- package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-verifier.md +19 -3
- package/runtime/python/okstra_ctl/phases/implementation/report_assets/implementation.template.html +1 -1
- package/runtime/python/okstra_ctl/phases/implementation/spec.md +2 -0
- package/runtime/python/okstra_ctl/phases/implementation/validation.py +152 -30
- package/runtime/python/okstra_ctl/phases/implementation_planning/authoring.py +16 -22
- package/runtime/python/okstra_ctl/phases/implementation_planning/instructions/plan-body-verification.md +2 -2
- package/runtime/python/okstra_ctl/phases/implementation_planning/wizard.py +11 -4
- package/runtime/python/okstra_ctl/phases/release_handoff/operations.py +4 -5
- package/runtime/python/okstra_ctl/phases/release_handoff/profile.md +1 -1
- package/runtime/python/okstra_ctl/plan_items.py +28 -0
- package/runtime/python/okstra_ctl/render.py +15 -0
- package/runtime/python/okstra_ctl/report_assembly.py +102 -1
- package/runtime/python/okstra_ctl/report_execution_evidence.py +220 -0
- package/runtime/python/okstra_ctl/report_inputs.py +28 -0
- package/runtime/python/okstra_ctl/report_narrative.py +12 -3
- package/runtime/python/okstra_ctl/run.py +16 -0
- package/runtime/python/okstra_ctl/stage_close.py +52 -6
- package/runtime/python/okstra_ctl/stage_fix_carry.py +21 -1
- package/runtime/python/okstra_ctl/stage_integrate.py +90 -25
- package/runtime/python/okstra_ctl/verification_dispatch.py +8 -2
- package/runtime/python/okstra_ctl/verification_evidence.py +26 -7
- package/runtime/python/okstra_ctl/verification_generation.py +12 -4
- package/runtime/python/okstra_ctl/verification_inputs.py +10 -0
- package/runtime/python/okstra_ctl/verification_invocation.py +2 -1
- package/runtime/python/okstra_ctl/wizard/engine.py +23 -0
- package/runtime/python/okstra_ctl/wizard/steps_plan.py +6 -2
- package/runtime/python/okstra_ctl/worktree/git_ops.py +8 -1
- package/runtime/python/okstra_ctl/worktree/rebase.py +5 -2
- package/runtime/schemas/final-report-v3.0.schema.json +184 -1
- package/runtime/skills/okstra-run/SKILL.md +5 -1
- package/runtime/templates/reports/html/i18n/en.json +7 -0
- package/runtime/templates/reports/html/i18n/ko.json +7 -0
- package/runtime/validators/validate-run.py +24 -5
- package/runtime/validators/validate-workflow.sh +1 -1
package/runtime/python/okstra_ctl/phases/implementation/instructions/_implementation-verifier.md
CHANGED
|
@@ -60,13 +60,29 @@ okstra worktree-lock --worktree <target.cwd> --command '<target.command>'
|
|
|
60
60
|
|
|
61
61
|
The verifiers of a stage share one worktree and run at the same time, and each re-runs every Tier 1 command. A Tier 1 command that starts servers on fixed ports (a dev server on 3000 plus a fixture API on 8899 behind one `playwright test` line, fontsninja-v3-site dev-11126 stage 1) collides with the same command from another verifier: each kills or attaches to the other's servers, and the exit codes stop describing the code. The lock is keyed by the worktree, so each verifier still runs the command itself, only one at a time. The wrapper is the launcher, not the command: record the declared `target.command` as the command line, and the wrapper's exit code and stdout/stderr tail as that command's — the wrapper passes both through unchanged and adds only stderr lines prefixed `okstra worktree-lock:`. A `waiting` notice means another verifier held the lock; a `running unlocked` warning means the lock file could not be created, so record that warning beside the result. This is a guideline: nothing checks the command log for the launcher. The lock behaviour (no overlap on one worktree, no blocking across worktrees, output and exit-code pass-through, lock file outside the worktree) is covered by the former Python suite; that regression check is now retired.
|
|
62
62
|
|
|
63
|
+
### Evidence mode (verification evidence contract)
|
|
64
|
+
|
|
65
|
+
A prompt that carries `**Verification generation path:**` and `**Verification generation digest:**` lines belongs to a run marked `verificationEvidenceVersion: "1.0"`. In such a run the Tier 2 and Tier 3 results come only from the execution records `okstra worktree-lock` writes in evidence mode; a result you type into the worker result or a sidecar is not read.
|
|
66
|
+
|
|
67
|
+
- **Tier 2.** Run every frozen `qaCommands` entry by its `id`, one call per entry:
|
|
68
|
+
```bash
|
|
69
|
+
okstra worktree-lock --project-root <PROJECT_ROOT> --invocation-metadata <Invocation metadata path> --check qa:<id>
|
|
70
|
+
```
|
|
71
|
+
The command, worktree and resource locks come from the sealed generation, so pass no `--worktree` or `--command`, and do not wrap the call in `okstra verification-target`: evidence mode re-checks the sealed target under the lock and records `target-changed` itself. The language skip rule above still applies; record a skipped entry as before.
|
|
72
|
+
- **Tier 3 (stage QA owner only).** Run each stage the generation seals with `--check conformance:<stageKey>` instead of the manifest `runCommand`, and write no `qa/result-<stageKey>.json`. A non-owner's call is refused (exit 2), and the conformance gate takes the owner's record.
|
|
73
|
+
- **Outcome.** Read the `okstra worktree-lock: evidence <status>: <record path>` line on stderr, not the exit code alone. `evidence completed: <path>` is a complete record whatever the exit code, so a command that exits 2, 70 or 137 is that command's result (a FAIL when non-zero). Any other status (`output-save-failed`, `drain-incomplete`, `cleanup-unconfirmed`, `target-changed`, `lock-unavailable`, `cancelled`, `interrupted`, `evidence-error`) is no evidence; the exit code is then 70, or 128+N when a signal arrived. `evidence refused: <reason>` means nothing ran and no record exists (exit 2). Record the exit code, the status and the record path. Never re-run the same check through the plain lock mode as a substitute; running the same `--check` again writes the next `run-<k>`, and the latest run of each check is the one that counts.
|
|
74
|
+
- **Worker result.** Keep each call in the Read-only command log with its exit code. Name yourself in the report's `verifierResults[].verifier` with the roster worker id from your `**Model:** <id> worker` line: assembly attaches your records by that id, and a name that is not a roster verifier is refused.
|
|
75
|
+
- **Unchanged.** Tier 1 plan commands, the self-mock detector and the static review run as described elsewhere in this sidecar.
|
|
76
|
+
|
|
77
|
+
**Enforced:** `validate_verifier_execution_evidence` in `scripts/okstra_ctl/phases/implementation/validation.py` (spec I-4) and the evidence branch of `_validate_conformance` in `validators/validate-run.py`.
|
|
78
|
+
|
|
63
79
|
### Stage QA owner
|
|
64
80
|
|
|
65
81
|
Every verifier of this stage runs in the same worktree at the same time. Two checks change that worktree while they run: a Tier 3 conformance script may build into it (`.next/`, `dist/`) or bind fixed ports, and the self-mock detector's mutation probe rewrites production sources in place (cosmic-ray) or replaces a report file inside the worktree (Stryker). Run concurrently, they corrupt each other's result and the other verifiers' test runs (observed 2026-09-26, fontsninja-v3-site dev-11054 stage 1: `next build` + `next start -p 3000` + a proxy on 8889 from three verifiers at once).
|
|
66
82
|
|
|
67
83
|
Your prompt carries a `**Stage QA owner:**` anchor naming one worker id. If that id is yours (the `<id>` in your `**Model:** <id> worker` line), you run Tier 3 and the self-mock detector as the two sections below describe. Otherwise you run neither and write neither sidecar; each section says what to record instead. A prompt with no such anchor predates this rule: run both yourself.
|
|
68
84
|
|
|
69
|
-
**Enforced:** the anchor is generated (`scripts/okstra_ctl/worker_prompt_policy.py` `stage_qa_owner`, the first verifier in roster order). If the owner is never dispatched, no sidecar is written and the existing gates report it: a missing conformance result is BLOCKING for an `io`-only entry and ADVISORY for an external one (`scripts/okstra_ctl/conformance.py` `decide_conformance_gate`), and a missing self-mock sidecar blocks when the diff changed a test file (`validators/validate-run.py` `_validate_selfmock`).
|
|
85
|
+
**Enforced:** the anchor is generated (`scripts/okstra_ctl/worker_prompt_policy.py` `stage_qa_owner`, the first verifier in roster order). If the owner is never dispatched, no sidecar is written and the existing gates report it: a missing conformance result is BLOCKING for an `io`-only entry and ADVISORY for an external one (`scripts/okstra_ctl/conformance.py` `decide_conformance_gate`), and a missing self-mock sidecar blocks when the diff changed a test file (`validators/validate-run.py` `_validate_selfmock`). In an evidence-contract run evidence mode refuses a `conformance:` check from anyone but the owner, and the gate reads only the owner's record; otherwise nothing checks which verifier's log holds the commands.
|
|
70
86
|
|
|
71
87
|
### Tier 3 — stage conformance scripts
|
|
72
88
|
|
|
@@ -95,10 +111,10 @@ also remain contract violations.
|
|
|
95
111
|
|
|
96
112
|
- **Owner only.** This section is the stage QA owner's (§ Stage QA owner above). A verifier that is not the owner runs no `runCommand`, writes no `result-*.json`, logs `conformance: owned by <worker-id> — not run`, and judges Tier 3 only from the diff and the manifest entry (declaration, `requires` coverage).
|
|
97
113
|
- **Source.** The conformance manifest is `<task_root>/qa/conformance-manifest.json` (the directory is the `TASK_QA_PATH` token). This run's stage conformance entry is the manifest `entries[]` item whose `stageKey` equals this run's stageKey — `<task-id>-stage-<N>`, where `<N>` is the injected Stage number. Find that one entry. Also run every other entry whose `script` appears in this stage's `plannedPaths`: this stage rewrote that script, so the result its own stage recorded is stale, and you write that entry's result sidecar exactly as below. Ignore the rest (other stages are run by their own implementation runs or by final-verification).
|
|
98
|
-
- **Exemption / waiver → do NOT run.** If the entry carries an `exemption` (or a user `waiver`), the verifier does NOT execute the script. It records the fact and the reason (`exemption.reason` / `waiver.reason` + `waiver.acknowledgedBy`) in the Read-only command log AND writes the result sidecar reflecting the skip. An `exemption` passes outright. An external-advisory waiver is reported as `ADVISORY` with `conditional=false`; only an `io`-only blocking waiver is conditional. An empty `requires` list cannot be waived; it is declaration/contract trouble and remains BLOCKING. No script runs in either permitted waiver case.
|
|
114
|
+
- **Exemption / waiver → do NOT run.** If the entry carries an `exemption` (or a user `waiver`), the verifier does NOT execute the script. It records the fact and the reason (`exemption.reason` / `waiver.reason` + `waiver.acknowledgedBy`) in the Read-only command log AND, outside an evidence-contract run, writes the result sidecar reflecting the skip (the gate reads the exemption or waiver from the manifest entry, so a marked run needs no sidecar). An `exemption` passes outright. An external-advisory waiver is reported as `ADVISORY` with `conditional=false`; only an `io`-only blocking waiver is conditional. An empty `requires` list cannot be waived; it is declaration/contract trouble and remains BLOCKING. No script runs in either permitted waiver case.
|
|
99
115
|
- **Otherwise run `runCommand` in the worktree cwd.** Execute the entry's `runCommand` verbatim from the worktree cwd. Inject env from `<PROJECT_ROOT>/.okstra/project.json`'s `qaEnv` (replica DB DSN / app base URL / env file — declared in Phase 4e). This is a **replica / test environment only** path — never run it against shared / staging / prod, identical to the DB real-execution gate principle above.
|
|
100
116
|
- **Interpret the standard interface.** Parse the process exit code together with stdout: the `QA-RESULT: PASS|FAIL` marker line (if several appear, the last one wins) and the per-requirement `REQ <id>: PASS|FAIL: <reason>` lines. If no `QA-RESULT` marker is emitted, the overall result is `MISSING`; classify it according to the entry's blocking or external-advisory capability policy above.
|
|
101
|
-
- **Write the result sidecar (BLOCKING deliverable).** Write `<task_root>/qa/result-<stageKey>.json` as:
|
|
117
|
+
- **Write the result sidecar (BLOCKING deliverable; not in an evidence-contract run, see Evidence mode above).** Write `<task_root>/qa/result-<stageKey>.json` as:
|
|
102
118
|
```json
|
|
103
119
|
{
|
|
104
120
|
"stageKey": "<task-id>-stage-<N>",
|
package/runtime/python/okstra_ctl/phases/implementation/report_assets/implementation.template.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<h2>{{ t('tasks.implementation.verification-result') }}</h2>
|
|
24
24
|
{{ render_narrative(narrative.validationExplanation, "implementation.userNarrative.validationExplanation") }}
|
|
25
25
|
<div class="summary-grid">{% for row in validationCards %}<article class="summary-card tone-{{ row.tone }}"><h3>{% if row.checkId %}{{ row.checkId }} · {% endif %}{{ row.phase }} · {{ t('tasks.implementation.exit-code') }} {{ row.exitCode }}{% if row.get("advisory") %} · {{ t('tasks.implementation.advisory') }}{% endif %}</h3><p><code title="{{ row.command }}">{{ row.commandPreview }}</code></p><p>{{ row.outputTail | inline_code }}</p></article>{% endfor %}</div>
|
|
26
|
-
{% for row in implementation.verifierResults %}<article class="summary-card tone-{{ row.verdict | lower }}"><p class="eyebrow">{{ row.verifier | inline_code }} · <span class="status status-{{ row.verdict | lower }}">{{ row.verdict }}</span></p>{% for label, text in ((t('tasks.implementation.independent-rerun'), row.get("independentValidationRerun")), (t('tasks.implementation.command-log'), row.get("readOnlyCommandLog"))) if text %}<details><summary><strong>{{ label }}</strong> {{ t('tasks.implementation.entry-count') | replace('{count}', text.strip().splitlines() | select | list | length | string) }}</summary><pre>{{ text }}</pre></details>{% endfor %}{% if row.get("discrepancy") %}<p class="evidence-refs">{{ t('tasks.implementation.discrepancy') }} {{ row.discrepancy | inline_code }}</p>{% endif %}{% if row.get("declinedFixRecommendations") %}<p>{{ row.declinedFixRecommendations | inline_code }}</p>{% endif %}</article>{% endfor %}
|
|
26
|
+
{% for row in implementation.verifierResults %}<article class="summary-card tone-{{ row.verdict | lower }}"><p class="eyebrow">{{ row.verifier | inline_code }} · <span class="status status-{{ row.verdict | lower }}">{{ row.verdict }}</span></p>{% for label, text in ((t('tasks.implementation.independent-rerun'), row.get("independentValidationRerun")), (t('tasks.implementation.command-log'), row.get("readOnlyCommandLog"))) if text %}<details><summary><strong>{{ label }}</strong> {{ t('tasks.implementation.entry-count') | replace('{count}', text.strip().splitlines() | select | list | length | string) }}</summary><pre>{{ text }}</pre></details>{% endfor %}{% if row.get("executionEvidence") %}<p><strong>{{ t('tasks.implementation.execution-records') }}</strong></p><ul class="evidence-refs" data-report-field="implementation.verifierResults.executionEvidence">{% for ref in row.executionEvidence %}<li><code>{{ ref.checkRef }}</code> run {{ ref.checkRun }} · {% if ref.collection == "complete" %}{{ t('tasks.implementation.exit-code') }} {{ ref.exitCode if ref.exitCode is not none else ref.signal }}{% else %}<span class="status status-incomplete">{{ t('tasks.implementation.incomplete-collection') }}</span> {{ ref.defect | inline_code }}{% endif %} · <code>{{ ref.recordPath }}</code></li>{% endfor %}</ul>{% endif %}{% if row.get("discrepancy") %}<p class="evidence-refs">{{ t('tasks.implementation.discrepancy') }} {{ row.discrepancy | inline_code }}</p>{% endif %}{% if row.get("declinedFixRecommendations") %}<p>{{ row.declinedFixRecommendations | inline_code }}</p>{% endif %}</article>{% endfor %}
|
|
27
27
|
</section>
|
|
28
28
|
|
|
29
29
|
{% if implementation.get("leadFixes") %}<section data-report-section="lead-fixes" data-report-field="implementation.leadFixes">
|
|
@@ -256,3 +256,5 @@ This phase does not declare final acceptance. It says only ready for final-verif
|
|
|
256
256
|
| I-1 | An empty independent rerun record fails validation. | `scripts/okstra_ctl/phases/implementation/validation.py::_validate_verifier_reran_independently` |
|
|
257
257
|
| I-2 | A verifier cannot report a discrepancy with a PASS verdict. | `scripts/okstra_ctl/phases/implementation/validation.py::_validate_verifier_discrepancy_is_not_passed` |
|
|
258
258
|
| I-3 | Frozen legacy instruction pointers resolve within the selected installation without rewriting the frozen profile. | unenforced |
|
|
259
|
+
| I-4 | In a run marked `verificationEvidenceVersion: "1.0"`, each verifier's `executionEvidence` is the latest run of every check under its latest attempt of the invocation bound to the newest generation, with the recorded bytes and observation; a record that is not `completed` is incomplete collection. | `scripts/okstra_ctl/phases/implementation/validation.py::validate_verifier_execution_evidence` |
|
|
260
|
+
| I-5 | In a marked run, a `leadFixes` entry blocks the report, and a stage settled after correction round N shows each verifier's generation N + 1 records. Unmarked runs keep the lead-fix reading. | `scripts/okstra_ctl/phases/implementation/validation.py::_validate_lead_fixes`, `validate_settled_round_was_reverified` |
|
|
@@ -3,9 +3,16 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import re
|
|
5
5
|
from collections.abc import Callable, Mapping
|
|
6
|
+
from pathlib import Path
|
|
6
7
|
from typing import Any
|
|
7
8
|
|
|
8
9
|
from ...correction_round import correction_round
|
|
10
|
+
from ...report_execution_evidence import (
|
|
11
|
+
EXECUTION_EVIDENCE_BLOCKING, collect_report_evidence, omitted_records, reference_errors,
|
|
12
|
+
)
|
|
13
|
+
from ...paths import RunRef
|
|
14
|
+
from ...verification_dispatch import generation_sealed_after_round
|
|
15
|
+
from ...verification_evidence import roster_verifier_role_execution_ref
|
|
9
16
|
|
|
10
17
|
_PASSING_VERDICT_TOKENS = frozenset({"accepted", "conditional-accept"})
|
|
11
18
|
_CHECKLIST_ID_RE = re.compile(r"\bVC-\d{3,}\b")
|
|
@@ -192,13 +199,18 @@ def _lead_fix_rows(implementation: dict) -> list[dict]:
|
|
|
192
199
|
return [row for row in implementation.get("leadFixes") or [] if isinstance(row, dict)]
|
|
193
200
|
|
|
194
201
|
|
|
195
|
-
def lead_fixed_verifiers(
|
|
202
|
+
def lead_fixed_verifiers(
|
|
203
|
+
implementation: dict, *, evidence_contract: bool = False,
|
|
204
|
+
) -> frozenset[str]:
|
|
196
205
|
"""정착된 stage 에서 통과한 리드 수정이 답한 FAIL 검증자 이름.
|
|
197
206
|
|
|
198
207
|
stage 가 `withheld` 이면 리드 수정은 아무것도 해소하지 않는다 — 다음 run 은
|
|
199
208
|
그 FAIL 행을 그대로 fix-run carry 로 받아야 한다.
|
|
209
|
+
|
|
210
|
+
An evidence-contract run settles a FAIL only through a correction round, so
|
|
211
|
+
its lead fixes answer none.
|
|
200
212
|
"""
|
|
201
|
-
if not _stage_settled(implementation):
|
|
213
|
+
if evidence_contract or not _stage_settled(implementation):
|
|
202
214
|
return frozenset()
|
|
203
215
|
return frozenset(
|
|
204
216
|
str(name)
|
|
@@ -208,43 +220,78 @@ def lead_fixed_verifiers(implementation: dict) -> frozenset[str]:
|
|
|
208
220
|
)
|
|
209
221
|
|
|
210
222
|
|
|
211
|
-
def _validate_lead_fixes(
|
|
223
|
+
def _validate_lead_fixes(
|
|
224
|
+
data: dict, failures: list[str], *, evidence_contract: bool = False,
|
|
225
|
+
) -> None:
|
|
212
226
|
"""리드 수정 기록과, FAIL 이 남은 채 정착된 stage 를 검사한다.
|
|
213
227
|
|
|
214
228
|
`_implementation-deliverable.md` "Lead minor fix": 검증자 FAIL 이 있는 stage 를
|
|
215
229
|
`done` 으로 정착시킬 수 있는 길은 재실행 검사가 전부 통과한 리드 수정뿐이다.
|
|
216
230
|
finding 단위 대응은 검사하지 않는다 — `verifierResults[]` 에 구조화된 finding
|
|
217
231
|
id 가 없어 계산할 수 없다. 검증자 행 단위(`verifiers`)까지만 본다.
|
|
232
|
+
|
|
233
|
+
An evidence-contract run has no lead-fix path: its `commands` are written by
|
|
234
|
+
the lead, and the fix commit was never sealed into a generation a verifier
|
|
235
|
+
re-checked.
|
|
218
236
|
"""
|
|
219
237
|
implementation = data.get("implementation")
|
|
220
238
|
if not isinstance(implementation, dict):
|
|
221
239
|
return
|
|
222
240
|
fixes = _lead_fix_rows(implementation)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
241
|
+
if evidence_contract:
|
|
242
|
+
_reject_evidence_contract_lead_fixes(fixes, failures)
|
|
243
|
+
else:
|
|
244
|
+
for index, row in enumerate(fixes):
|
|
245
|
+
_check_lead_fix(index, row, failures)
|
|
246
|
+
if _stage_settled(implementation):
|
|
247
|
+
_check_settled_stage(data, implementation, fixes, evidence_contract, failures)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def _reject_evidence_contract_lead_fixes(fixes: list[dict], failures: list[str]) -> None:
|
|
251
|
+
for index, _row in enumerate(fixes):
|
|
252
|
+
failures.append(
|
|
253
|
+
f"{_LEAD_FIX_BLOCKING} implementation.leadFixes[{index}] records a lead "
|
|
254
|
+
"fix in an evidence-contract run. Its re-run commands are self-written "
|
|
255
|
+
"and its commit was never sealed into a generation a verifier "
|
|
256
|
+
"re-checked; send the fix through a correction round instead."
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def _check_lead_fix(index: int, row: dict, failures: list[str]) -> None:
|
|
261
|
+
ids = ", ".join(str(item) for item in row.get("findingIds") or []) or "no finding id"
|
|
262
|
+
label = f"implementation.leadFixes[{index}] ({ids})"
|
|
263
|
+
commands = [cmd for cmd in row.get("commands") or [] if isinstance(cmd, dict)]
|
|
264
|
+
failed = [cmd for cmd in commands if cmd.get("exitCode") != 0]
|
|
265
|
+
if row.get("result") == "pass" and (failed or not commands):
|
|
266
|
+
evidence = (
|
|
267
|
+
f"`{str(failed[0].get('command'))[:120]}` exited {failed[0].get('exitCode')}"
|
|
268
|
+
if failed else "no re-run command is recorded"
|
|
269
|
+
)
|
|
270
|
+
failures.append(
|
|
271
|
+
f"{_LEAD_FIX_BLOCKING} {label} records `result: pass` but {evidence}. "
|
|
272
|
+
"A lead fix passes only when every re-run check exits 0; otherwise "
|
|
273
|
+
"record `result: fail` and withhold the stage."
|
|
274
|
+
)
|
|
275
|
+
lines = row.get("changedLines")
|
|
276
|
+
if isinstance(lines, int) and lines > LEAD_FIX_LINE_LIMIT:
|
|
277
|
+
failures.append(
|
|
278
|
+
f"{_LEAD_FIX_BLOCKING} {label} changed {lines} lines; a lead minor fix "
|
|
279
|
+
f"is limited to {LEAD_FIX_LINE_LIMIT}. A larger change belongs to a fix "
|
|
280
|
+
"run, where the verifiers review it."
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _check_settled_stage(
|
|
285
|
+
data: dict, implementation: dict, fixes: list[dict], evidence_contract: bool,
|
|
286
|
+
failures: list[str],
|
|
287
|
+
) -> None:
|
|
288
|
+
"""A settled stage holds no failed lead fix, and each FAIL row is answered.
|
|
289
|
+
|
|
290
|
+
An evidence-contract run's lead fixes were already rejected, so none of
|
|
291
|
+
them is read as failed or as answering a FAIL.
|
|
292
|
+
"""
|
|
293
|
+
unsettled = [] if evidence_contract else [
|
|
294
|
+
index for index, row in enumerate(fixes) if row.get("result") != "pass"]
|
|
248
295
|
if unsettled:
|
|
249
296
|
failures.append(
|
|
250
297
|
f"{_LEAD_FIX_BLOCKING} implementation.leadFixes{unsettled} recorded "
|
|
@@ -256,7 +303,8 @@ def _validate_lead_fixes(data: dict, failures: list[str]) -> None:
|
|
|
256
303
|
who for who, row in _verifier_rows(data)
|
|
257
304
|
if str(row.get("verdict") or "").strip() == "FAIL"
|
|
258
305
|
}
|
|
259
|
-
uncovered = sorted(rejected - lead_fixed_verifiers(
|
|
306
|
+
uncovered = sorted(rejected - lead_fixed_verifiers(
|
|
307
|
+
implementation, evidence_contract=evidence_contract))
|
|
260
308
|
if uncovered:
|
|
261
309
|
# 권고로 둔다 — 정착 여부는 종합 판정이 정하고, 수렴에서 반박된 한 검증자의
|
|
262
310
|
# FAIL 위에 PASS 로 정착한 run 은 계약대로다. 막으면 그런 run 이 전부 멈춘다.
|
|
@@ -268,7 +316,6 @@ def _validate_lead_fixes(data: dict, failures: list[str]) -> None:
|
|
|
268
316
|
"been withheld or answered by a passing lead minor fix."
|
|
269
317
|
)
|
|
270
318
|
|
|
271
|
-
|
|
272
319
|
_CORRECTION_BLOCKING = "correction-round BLOCKING:"
|
|
273
320
|
|
|
274
321
|
|
|
@@ -360,3 +407,78 @@ def _validate_verifier_fail_blocks_verdict(data: dict, failures: list[str]) -> N
|
|
|
360
407
|
"the lead's to substitute "
|
|
361
408
|
'(`_implementation-verifier.md` "All-verifier-failure policy").'
|
|
362
409
|
)
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def validate_verifier_execution_evidence(
|
|
414
|
+
data: dict, project_root: Path, manifest_path: Path,
|
|
415
|
+
manifest: Mapping[str, Any], failures: list[str],
|
|
416
|
+
) -> None:
|
|
417
|
+
"""Each verifier's `executionEvidence` in an evidence-contract run is its
|
|
418
|
+
current execution records.
|
|
419
|
+
|
|
420
|
+
A reference must be the latest run of a check under the verifier's latest
|
|
421
|
+
attempt of the invocation bound to the newest generation, with the bytes and
|
|
422
|
+
observation it recorded; a `not-run` row is not read.
|
|
423
|
+
"""
|
|
424
|
+
try:
|
|
425
|
+
evidence = collect_report_evidence(project_root, manifest_path)
|
|
426
|
+
except ValueError as exc:
|
|
427
|
+
failures.append(f"{EXECUTION_EVIDENCE_BLOCKING} verification execution "
|
|
428
|
+
f"evidence could not be collected: {exc}")
|
|
429
|
+
return
|
|
430
|
+
implementation = data.get("implementation")
|
|
431
|
+
rows = implementation.get("verifierResults") if isinstance(implementation, dict) else None
|
|
432
|
+
for index, row in enumerate(rows if isinstance(rows, list) else []):
|
|
433
|
+
if not isinstance(row, dict) or row.get("verdict") == "not-run":
|
|
434
|
+
continue
|
|
435
|
+
where = f"implementation.verifierResults[{index}]"
|
|
436
|
+
role_execution_ref = roster_verifier_role_execution_ref(manifest, row.get("verifier"))
|
|
437
|
+
if role_execution_ref is None:
|
|
438
|
+
failures.append(f"{EXECUTION_EVIDENCE_BLOCKING} {where}.verifier "
|
|
439
|
+
f"`{row.get('verifier')}` names no roster verifier")
|
|
440
|
+
continue
|
|
441
|
+
verifiers = [evidence[role_execution_ref]] if role_execution_ref in evidence else []
|
|
442
|
+
matched: set[str] = set()
|
|
443
|
+
reported = row.get("executionEvidence") or []
|
|
444
|
+
for position, reference in enumerate(reported if isinstance(reported, list) else []):
|
|
445
|
+
errors, paths = reference_errors(
|
|
446
|
+
f"{where}.executionEvidence[{position}]", reference, verifiers,
|
|
447
|
+
)
|
|
448
|
+
failures.extend(f"{EXECUTION_EVIDENCE_BLOCKING} {error}" for error in errors)
|
|
449
|
+
matched |= paths
|
|
450
|
+
omitted = omitted_records(verifiers, matched)
|
|
451
|
+
if omitted:
|
|
452
|
+
failures.append(f"{EXECUTION_EVIDENCE_BLOCKING} {where} omits the "
|
|
453
|
+
f"verifier's execution records {omitted}")
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
def validate_settled_round_was_reverified(
|
|
457
|
+
data: dict, project_root: Path, manifest_path: Path,
|
|
458
|
+
manifest: Mapping[str, Any], failures: list[str],
|
|
459
|
+
) -> None:
|
|
460
|
+
"""A stage settled after correction round N in an evidence-contract run
|
|
461
|
+
shows each verifier's records of generation N + 1, the one sealed after the
|
|
462
|
+
executor's fix."""
|
|
463
|
+
implementation = data.get("implementation")
|
|
464
|
+
if not isinstance(implementation, dict) or not _stage_settled(implementation):
|
|
465
|
+
return
|
|
466
|
+
rounds = [row.get("round") for row in implementation.get("correctionRounds") or []
|
|
467
|
+
if isinstance(row, dict) and isinstance(row.get("round"), int)]
|
|
468
|
+
if not rounds:
|
|
469
|
+
return
|
|
470
|
+
generation = generation_sealed_after_round(max(rounds))
|
|
471
|
+
expected = RunRef.from_manifest(manifest_path, manifest).verification_generation(
|
|
472
|
+
generation).resolve().relative_to(project_root.resolve()).as_posix()
|
|
473
|
+
for who, row in _verifier_rows(data):
|
|
474
|
+
if row.get("verdict") == "not-run":
|
|
475
|
+
continue
|
|
476
|
+
references = [reference for reference in row.get("executionEvidence") or []
|
|
477
|
+
if isinstance(reference, dict)]
|
|
478
|
+
if not references or any((reference.get("generation") or {}).get("path")
|
|
479
|
+
!= expected for reference in references):
|
|
480
|
+
failures.append(
|
|
481
|
+
f"{_CORRECTION_BLOCKING} {who} settled the stage after correction "
|
|
482
|
+
f"round {max(rounds)} without execution records of generation "
|
|
483
|
+
f"{generation} (`{expected}`), the one sealed after the fix."
|
|
484
|
+
)
|
|
@@ -48,10 +48,11 @@ from okstra_ctl.plan_items import (
|
|
|
48
48
|
lead_decision_basis,
|
|
49
49
|
next_dispatch,
|
|
50
50
|
planning_stage_ledger,
|
|
51
|
-
|
|
51
|
+
queue_candidate_ids,
|
|
52
52
|
reverify_prompt_text,
|
|
53
53
|
self_fix_rounds,
|
|
54
54
|
tie_vote_item_ids,
|
|
55
|
+
verified_content_hashes,
|
|
55
56
|
voting_analyser_keys,
|
|
56
57
|
with_rendered_by,
|
|
57
58
|
with_response_format,
|
|
@@ -114,14 +115,9 @@ def _merged_ledger(
|
|
|
114
115
|
def _previous_hashes(state_path: Path | None) -> dict[str, str]:
|
|
115
116
|
if state_path is None or not state_path.is_file():
|
|
116
117
|
return {}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for row in rows
|
|
121
|
-
if isinstance(row, Mapping)
|
|
122
|
-
and isinstance(row.get("id"), str)
|
|
123
|
-
and isinstance(row.get("verifiedContentHash"), str)
|
|
124
|
-
}
|
|
118
|
+
return verified_content_hashes(
|
|
119
|
+
_state_plan_body_items(_load_json_object(state_path), state_path)
|
|
120
|
+
)
|
|
125
121
|
|
|
126
122
|
|
|
127
123
|
def _queue_for(
|
|
@@ -138,9 +134,7 @@ def _queue_for(
|
|
|
138
134
|
return tie_vote_item_ids(items, ledger, tied_ids)
|
|
139
135
|
inputs = review_inputs or _review_inputs(items, planning, run_manifest, previous_rows)
|
|
140
136
|
reusable = reusable_item_ids(previous_rows, inputs)
|
|
141
|
-
candidates =
|
|
142
|
-
if previous_hashes:
|
|
143
|
-
candidates.update(reverify_item_ids(items, previous_hashes, ledger))
|
|
137
|
+
candidates = queue_candidate_ids(items, ledger, previous_hashes or {})
|
|
144
138
|
return [item["id"] for item in items if item["id"] in candidates - reusable]
|
|
145
139
|
|
|
146
140
|
|
|
@@ -1148,13 +1142,20 @@ def _validate_prepared(args: argparse.Namespace) -> dict[str, Any]:
|
|
|
1148
1142
|
**_queue_kwargs(args),
|
|
1149
1143
|
)
|
|
1150
1144
|
if actual.get("dispatchQueue") != expected_queue:
|
|
1151
|
-
raise PlanItemContractError(
|
|
1145
|
+
raise PlanItemContractError(
|
|
1146
|
+
"prepared dispatch queue does not match the queue derived from "
|
|
1147
|
+
"the current plan and state; prepare again, and pass "
|
|
1148
|
+
"validate-prepared the same --state that prepare used"
|
|
1149
|
+
)
|
|
1152
1150
|
current_inputs = _review_inputs(
|
|
1153
1151
|
expected["items"], _planning(source), args.run_manifest,
|
|
1154
1152
|
_queue_kwargs(args).get("previous_rows", []),
|
|
1155
1153
|
)
|
|
1156
1154
|
if actual.get("reviewInputs") != current_inputs:
|
|
1157
|
-
raise PlanItemContractError(
|
|
1155
|
+
raise PlanItemContractError(
|
|
1156
|
+
"prepared review evidence changed; prepare again, and pass "
|
|
1157
|
+
"validate-prepared the same --state that prepare used"
|
|
1158
|
+
)
|
|
1158
1159
|
if not getattr(args, "tie_vote", False):
|
|
1159
1160
|
# 라운드 2+ 의 반대 의견 반입은 여기서만 검사된다. 봉투에서 빠지면
|
|
1160
1161
|
# 프롬프트에도 빠지고, 반대한 워커는 자기 판정을 그대로 다시 적는다.
|
|
@@ -1648,18 +1649,11 @@ def _seed(args: argparse.Namespace) -> dict[str, Any]:
|
|
|
1648
1649
|
ledger = _merged_ledger(_planning(source), getattr(args, "run_manifest", None))
|
|
1649
1650
|
if ledger:
|
|
1650
1651
|
verification["stageLedger"] = ledger
|
|
1651
|
-
previous = {
|
|
1652
|
-
str(row["id"]): str(row["verifiedContentHash"])
|
|
1653
|
-
for row in recorded
|
|
1654
|
-
if isinstance(row, Mapping)
|
|
1655
|
-
and isinstance(row.get("id"), str)
|
|
1656
|
-
and isinstance(row.get("verifiedContentHash"), str)
|
|
1657
|
-
}
|
|
1658
1652
|
verification["dispatchQueue"] = _queue_for(
|
|
1659
1653
|
extracted,
|
|
1660
1654
|
_planning(source),
|
|
1661
1655
|
getattr(args, "run_manifest", None),
|
|
1662
|
-
|
|
1656
|
+
verified_content_hashes(recorded),
|
|
1663
1657
|
previous_rows=recorded,
|
|
1664
1658
|
)
|
|
1665
1659
|
verification["gating"] = (
|
|
@@ -413,11 +413,11 @@ round before any host or provider process starts.
|
|
|
413
413
|
|
|
414
414
|
For contract 3.0, `prepare` checks the selected-direction draft with the same semantic validator as publication before writing the queue. Correct all reported references, coverage rows and planned commands through the writer correction procedure, then retry in this run. **Enforced:** `report_assembly.validate_plan_draft` and `plan_items_cli._prepare`; the retired Python suite previously checked that invalid coverage creates no prepared queue.
|
|
415
415
|
|
|
416
|
-
1. Lead runs `okstra plan-items prepare --narrative <report-writer-narrative.md> --run-manifest <run-manifest>`, places the fixed output of `okstra plan-items prompt --run-manifest <run-manifest>` verbatim in every verifier prompt, then runs `okstra plan-items validate-prepared --narrative <report-writer-narrative.md> --run-manifest <run-manifest>`. A `File-size headroom` line that prepare prints, and that `okstra plan-items prompt` carries under `## File-size headroom`, is a report only: it names an existing file the plan writes, its lines left before the 500-line implementation limit and the stages that write it. It does not block, open a correction or count as a verdict. After a self-fix rewrite, pass `--state <plan-body-verification.json>` on prepare and validate-prepared
|
|
416
|
+
1. Lead runs `okstra plan-items prepare --narrative <report-writer-narrative.md> --run-manifest <run-manifest>`, places the fixed output of `okstra plan-items prompt --run-manifest <run-manifest>` verbatim in every verifier prompt, then runs `okstra plan-items validate-prepared --narrative <report-writer-narrative.md> --run-manifest <run-manifest>`. A `File-size headroom` line that prepare prints, and that `okstra plan-items prompt` carries under `## File-size headroom`, is a report only: it names an existing file the plan writes, its lines left before the 500-line implementation limit and the stages that write it. It does not block, open a correction or count as a verdict. After a self-fix rewrite, and after `okstra incremental-carry` on a re-run, pass `--state <plan-body-verification.json>` on prepare and validate-prepared; validate-prepared needs the same `--state` the last prepare used, or it refuses with `prepared dispatch queue does not match` or `prepared review evidence changed`. The runtime reuses a verdict only when its body, complete declared evidence closure, shared analysis packet, plan metadata, reviewer assignments and review contract have the same fingerprint. A missing or uncertain dependency declaration, unresolved reference, non-result or executable fact probe stays in the re-verification queue. Detailed verdicts and their original rounds remain unchanged for reused items. File dependencies cover whole files; step items also include preceding steps; plan-wide and preparation items include all plan items. Python resolves the one convergence-owned state path from that run identity. Dispatch only after exact-match validation succeeds. `observed` / `deferred` stages remain omitted. An empty queue opens no worker dispatch and creates no verification round. **Enforced:** `implementation_planning.authoring._queue_for`, `plan_item_evidence.review_fingerprint`, `_validate_prepared` and the retired Python suite. An incremental carry without evidence snapshots keeps active items queued until prepare can validate their dependencies.
|
|
417
417
|
|
|
418
418
|
**Then seed the landing table (BLOCKING):** `okstra plan-items seed --narrative <report-writer-narrative.md> --state <plan-body-verification.json> --run-manifest <run-manifest.json>`. `apply-verdicts` in step 8 refuses a verdict whose item has no `planBodyVerification.planItems[]` row. The report writer never owns that state, so the deterministic seed is the only creator of its rows. The seed is idempotent by id and never touches existing verdicts, so it is safe to re-run between rounds and after a self-fix re-extraction. It does refresh `contentHash` from the current extract. Skipping it makes step 8 fail with `plan-body state has no row for [...]`.
|
|
419
419
|
|
|
420
|
-
**On a re-run, add `--prior-state <the previous run's plan-body-verification-<task-type>-<seq>.json>`.** A newly seeded item inherits verdicts only when its body and verified evidence fingerprint match the prepared snapshot for the same task. Reused rows carry `carriedForwardFromSeq`; their full verdicts are preserved. Legacy body-only records re-enter verification. A matching id alone never carries: `P-*` ids are positional. The flag requires `--state` and refuses another task's state. **Enforced:** `implementation_planning.authoring._carry_prior_run_verdicts` and `plan_item_evidence.reusable_item_ids`.
|
|
420
|
+
**On a re-run, add `--prior-state <the previous run's plan-body-verification-<task-type>-<seq>.json>`.** An incremental re-run then runs `okstra incremental-carry` and repeats prepare, prompt and validate-prepared with `--state` before dispatch (launch prompt "Incremental re-verification" step 7). A newly seeded item inherits verdicts only when its body and verified evidence fingerprint match the prepared snapshot for the same task. Reused rows carry `carriedForwardFromSeq`; their full verdicts are preserved. Legacy body-only records re-enter verification. A matching id alone never carries: `P-*` ids are positional. The flag requires `--state` and refuses another task's state. **Enforced:** `implementation_planning.authoring._carry_prior_run_verdicts` and `plan_item_evidence.reusable_item_ids`.
|
|
421
421
|
|
|
422
422
|
**`--run-manifest` is what scopes the gate to the stage you are starting.** Seed uses it to overlay disk `done` / `active` onto `planBodyVerification.stageLedger`. The current plan's depends-on fills `ready` / `blocked` when no prior plan exists, so a first run does not treat every stage as in-scope. **Enforced:** `okstra_ctl.plan_items.planning_stage_ledger`.
|
|
423
423
|
2. For each analyser worker in the roster, use `okstra plan-items prompt` output verbatim as the instruction body in the materialization sequence above. Read §"Re-verification rounds (round 2+)" before preparing a later round; read §"Plan-body reverify prompt" only when diagnosing a prompt-contract failure.
|
|
@@ -216,13 +216,20 @@ def _submit_selected_direction_pick(state: WizardState, value: str) -> Optional[
|
|
|
216
216
|
resolve_selected_direction(report, expected_task_key=_task_key(state))
|
|
217
217
|
except (DirectionSelectionError, UserResponseError) as exc:
|
|
218
218
|
raise WizardError(str(exc)) from exc
|
|
219
|
+
if _settle_selected_direction(state, path):
|
|
220
|
+
return t["echo_variants"]["cleared_clarification"].format(value=path) + recorded
|
|
221
|
+
return f"selected-direction: {path}{recorded}"
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def _settle_selected_direction(state: WizardState, path: str) -> bool:
|
|
225
|
+
"""Returns whether a clarification response was cleared."""
|
|
219
226
|
state.selected_direction_path = path
|
|
220
227
|
# 두 입력은 상호 배타다 — 방향이 정해진 순간 이 런은 새 계획이고,
|
|
221
228
|
# clarification 자리에 남은 값은 render-bundle 이 거절할 이유일 뿐이다.
|
|
222
229
|
# 거절을 여기서 앞당기는 대신 값을 비우고, 무엇이 비워졌는지 echo 로
|
|
223
230
|
# 알린다. 사용자 답변은 손실되지 않는다: 그 사이드카는
|
|
224
231
|
# `--selected-direction` 경로로 계획 런에 첨부된다(`run.py` 참조).
|
|
225
|
-
if state.clarification_response_path:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return
|
|
232
|
+
if not state.clarification_response_path:
|
|
233
|
+
return False
|
|
234
|
+
state.clarification_response_path = ""
|
|
235
|
+
return True
|
|
@@ -25,13 +25,12 @@ from okstra_ctl.worktree import (
|
|
|
25
25
|
class HandoffConflict(Exception):
|
|
26
26
|
"""선행 stage 들 사이의 merge 충돌 — exit 2, 충돌 경로 동봉."""
|
|
27
27
|
|
|
28
|
-
def __init__(self, stage: int, branch: str, paths: List[str]
|
|
28
|
+
def __init__(self, stage: int, branch: str, paths: List[str],
|
|
29
|
+
message: str):
|
|
29
30
|
self.stage = stage
|
|
30
31
|
self.branch = branch
|
|
31
32
|
self.paths = paths
|
|
32
|
-
super().__init__(
|
|
33
|
-
f"merge conflict while merging stage {stage} ({branch}): "
|
|
34
|
-
f"{', '.join(paths)}")
|
|
33
|
+
super().__init__(message)
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
def compute_eligibility(stage_map: List[Dict[str, Any]],
|
|
@@ -118,7 +117,7 @@ def _merge_base_for(*, project_root, project_id, task_group, task_id,
|
|
|
118
117
|
anchor_base=anchor_base)
|
|
119
118
|
except MergeBranchConflict as exc:
|
|
120
119
|
raise HandoffConflict(stage=exc.stage, branch=exc.branch,
|
|
121
|
-
paths=exc.paths) from exc
|
|
120
|
+
paths=exc.paths, message=str(exc)) from exc
|
|
122
121
|
except IntegrateError as exc:
|
|
123
122
|
raise HandoffError(str(exc)) from exc
|
|
124
123
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
This is the release base for the run, not necessarily each PR's base: a stage that sits on another stage of this task targets that stage's branch. The release base MUST contain the task's implementation anchor base. `pr-plan` derives stacking inside this task only; when the task was built on another task's unmerged stage branch, the release base is that predecessor task's stage branch, which prepare names as the recommended base. The chosen base MUST NOT be one of this task's stage branches. If it is, re-ask.
|
|
39
39
|
2p. **PR plan** (only when the user picked `push + PR`) — run
|
|
40
40
|
`okstra handoff pr-plan --plan-run-root <...> --approved-plan <...> --project-root <project root> --project-id <id> --task-group <g> --task-id <t> --work-category <c> --stages <HANDOFF_STAGES> --base <chosen-base>`.
|
|
41
|
-
It returns one row per stage with `head_branch`, `head_commit`, `base_kind` (`release-base` | `stage` | `merge-base`), `base_branch` and `base_commit`. Exit 2 means the predecessors of a multi-dependency stage conflict with each other: show the `conflicts` paths and stop
|
|
41
|
+
It returns one row per stage with `head_branch`, `head_commit`, `base_kind` (`release-base` | `stage` | `merge-base`), `base_branch` and `base_commit`. Exit 2 means the predecessors of a multi-dependency stage conflict with each other: show the `conflicts` paths and the `error` text verbatim and stop. The `error` names the merge-base branch, the anchor it starts from and the predecessor commits to merge in order; route: the user rebuilds that branch by hand as described, then retries, and `pr-plan` reuses it only when it contains the anchor and every listed commit. Exit 1 means an eligibility or dependency violation — most often a stage whose predecessor is neither in this run nor already PR'd nor merged into the release base: show the error verbatim and re-ask the action selection. When the error says the release base does not contain the implementation anchor, the error names the `--base` that does: show it verbatim and re-ask Q2 with that branch first. **Enforced:** `okstra_ctl.phases.release_handoff.operations._resolve_stage_base` refuses the plan. On success these rows are authoritative for every subsequent step; the lead does not recompute a base by hand.
|
|
42
42
|
A `merge-base` row means `pr-plan` created a branch merging that stage's predecessors. That branch is a PR base only — it is never a PR head — and it MUST be pushed before the PR that targets it.
|
|
43
43
|
The output also carries `push_plan` and `warnings`. `push_plan` is every branch the PRs sit on, already in push order (each `merge-base` first, then the stage heads in dependency order), with the `commit` it must reach and an `action` of `create` (origin does not have it), `fast-forward` (origin is behind) or `up-to-date` (origin already has that commit — do not push it). GitHub resolves a PR's head and base by name on origin, so this list, not the local branch set, is what makes the stack real. A `warnings` row means `pr-plan` fast-forwarded a local branch to origin because origin was ahead: the commits origin adds are outside what this run verified. Quote every `warnings` row verbatim in Executed Commands and say so in the branch/PR explanation — the user is deciding whether to release commits this run did not verify. `pr-plan` refuses outright when a branch moved outside okstra or diverged from origin, since only a force push could deliver it.
|
|
44
44
|
2b. **Pre-merge conflict probe** (only when the user picked `push + PR`) — before pushing, for each planned stage in dependency order:
|
|
@@ -626,6 +626,34 @@ def reverify_item_ids(
|
|
|
626
626
|
return queue
|
|
627
627
|
|
|
628
628
|
|
|
629
|
+
def verified_content_hashes(rows: Sequence[Mapping[str, Any]]) -> dict[str, str]:
|
|
630
|
+
"""`{item id: verifiedContentHash}` for the rows a recorded verdict covers."""
|
|
631
|
+
return {
|
|
632
|
+
str(row["id"]): str(row["verifiedContentHash"])
|
|
633
|
+
for row in rows
|
|
634
|
+
if isinstance(row, Mapping)
|
|
635
|
+
and isinstance(row.get("id"), str)
|
|
636
|
+
and isinstance(row.get("verifiedContentHash"), str)
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
def queue_candidate_ids(
|
|
641
|
+
items: Sequence[Mapping[str, Any]],
|
|
642
|
+
ledger: Mapping[str, str] | None,
|
|
643
|
+
previous_hashes: Mapping[str, str],
|
|
644
|
+
) -> set[str]:
|
|
645
|
+
"""Items a round may dispatch before verdict reuse narrows them.
|
|
646
|
+
|
|
647
|
+
`plan-items prepare` and `incremental-carry` both persist a queue, and
|
|
648
|
+
`team await` refuses a round whose prepared items fall outside the state's,
|
|
649
|
+
so both writers take their candidates from this one rule.
|
|
650
|
+
"""
|
|
651
|
+
candidates = set(dispatch_item_ids(items, ledger))
|
|
652
|
+
if previous_hashes:
|
|
653
|
+
candidates.update(reverify_item_ids(items, previous_hashes, ledger))
|
|
654
|
+
return candidates
|
|
655
|
+
|
|
656
|
+
|
|
629
657
|
def requires_plan_repair(verification: Mapping[str, Any]) -> bool:
|
|
630
658
|
"""검사·구현 가능성의 사실 결함은 단계 수에 따른 자문 면제에서 제외한다."""
|
|
631
659
|
return any(
|
|
@@ -1705,6 +1705,18 @@ def _build_convergence_block(ctx: dict) -> dict:
|
|
|
1705
1705
|
}
|
|
1706
1706
|
|
|
1707
1707
|
|
|
1708
|
+
def _evidence_contract_fields(
|
|
1709
|
+
recorded_manifest: dict | None, ctx: dict,
|
|
1710
|
+
) -> dict[str, str]:
|
|
1711
|
+
"""A recorded run keeps the contract it started with, so a run prepared
|
|
1712
|
+
before the contract existed resumes unmarked."""
|
|
1713
|
+
if recorded_manifest is not None:
|
|
1714
|
+
version = recorded_manifest.get("verificationEvidenceVersion")
|
|
1715
|
+
else:
|
|
1716
|
+
version = ctx.get("VERIFICATION_EVIDENCE_VERSION")
|
|
1717
|
+
return {} if version is None else {"verificationEvidenceVersion": version}
|
|
1718
|
+
|
|
1719
|
+
|
|
1708
1720
|
def render_run_manifest(run_manifest_path: str, ctx: dict) -> None:
|
|
1709
1721
|
run_manifest_file = Path(run_manifest_path)
|
|
1710
1722
|
run_manifest_exists = run_manifest_file.is_file()
|
|
@@ -1873,6 +1885,9 @@ def render_run_manifest(run_manifest_path: str, ctx: dict) -> None:
|
|
|
1873
1885
|
"verificationTargetDigest": ctx.get("VERIFICATION_TARGET_DIGEST", ""),
|
|
1874
1886
|
"workerResultsDirectoryPath": ctx.get("WORKER_RESULTS_RELATIVE_PATH", ""),
|
|
1875
1887
|
**artifact_fields(manifest_input_ref),
|
|
1888
|
+
**_evidence_contract_fields(
|
|
1889
|
+
existing_run_manifest if run_manifest_exists else None, ctx,
|
|
1890
|
+
),
|
|
1876
1891
|
"reportTemplatePath": ctx.get("FINAL_REPORT_TEMPLATE_RELATIVE_PATH", ""),
|
|
1877
1892
|
"validatorScriptPath": ctx.get("RUN_VALIDATOR_RELATIVE_PATH", ""),
|
|
1878
1893
|
"leadSessionId": ctx.get("CLAUDE_SESSION_ID", ""),
|