@jesdi/skills 0.0.87 → 0.0.88
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/package.json +1 -1
- package/skills/implement-spec/ARCHITECTURE.md +20 -8
- package/skills/implement-spec/README.md +7 -4
- package/skills/implement-spec/driver_decisions.py +3 -2
- package/skills/implement-spec/driver_dispute.py +82 -57
- package/skills/implement-spec/driver_fixloop.py +18 -21
- package/skills/implement-spec/driver_legacy.py +31 -2
- package/skills/implement-spec/driver_report.py +13 -3
- package/skills/implement-spec/driver_state.py +8 -7
- package/skills/implement-spec/prompts/correction.md +1 -0
- package/skills/implement-spec/prompts/reviewer.md +3 -3
- package/skills/implement-spec/prompts/ruled.md +1 -1
- package/skills/implement-spec/tests/test_arbitration.py +101 -10
- package/skills/implement-spec/tests/test_decisions.py +7 -5
- package/skills/implement-spec/tests/test_fixloop.py +3 -3
- package/skills/implement-spec/tests/test_legacy.py +27 -0
- package/skills/implement-spec/tests/test_state.py +1 -1
- package/skills/test-weigh-in/dashboard.html +70 -17
- package/skills/test-weigh-in/tests/browser_driver.py +46 -5
- package/skills/test-weigh-in/tests/layout_page.py +7 -3
- package/skills/test-weigh-in/tests/overlap_page.py +3 -0
- package/skills/test-weigh-in/tests/rules_fixture.py +1 -1
- package/skills/test-weigh-in/tests/test_coverage_run.py +5 -1
- package/skills/test-weigh-in/tests/test_dashboard_layout.py +50 -9
- package/skills/test-weigh-in/tests/test_score.py +53 -2
- package/skills/test-weigh-in/weigh.py +2 -2
- package/skills/test-weigh-in/weigh_coverage.py +22 -2
- package/skills/test-weigh-in/weigh_dashboard.py +51 -10
- package/skills/test-weigh-in/weigh_score.py +6 -3
- package/skills/test-weigh-in/weigh_smells.py +3 -2
- package/skills-manifest.json +3 -3
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ A comment in the code is for a line that looks wrong or removable without it.
|
|
|
13
13
|
| `driver.py` | The command line, the checks before the first agent, the walk of the ticket graph, one ticket from its phase to merged or blocked, the landing on the PR branch, the exit code |
|
|
14
14
|
| `driver_run.py` | `Run` (what all ticket threads share), one agent with its one rerun, the gate call, the ledger, `Blocked` |
|
|
15
15
|
| `driver_fixloop.py` | A gated ticket tip in, a reviewed tip out: review, test-writer correction, fix rounds |
|
|
16
|
-
| `driver_dispute.py` | A disputed locked test: the arbitration, its correction, the once-per-
|
|
16
|
+
| `driver_dispute.py` | A disputed locked test: the arbitration, its correction, the once-per-test record, `spec-ambiguous` |
|
|
17
17
|
| `driver_final.py` | The end of run: tidy, rebase, gate, final review, one fix batch, push |
|
|
18
18
|
| `driver_tickets.py`, `driver_graph.py` | Ticket files in, tickets or errors out; which tickets can start now |
|
|
19
19
|
| `driver_agents.py` | Model entries, the CLI command of each provider, prompt templates, the blocking launch |
|
|
@@ -187,18 +187,30 @@ and do not know about the run, except `driver_run.py`, which the deciding module
|
|
|
187
187
|
second correction could not close it.
|
|
188
188
|
- Every test-writer correction, after a `test-wrong` ruling, a review finding or a `correct-test` answer, is one
|
|
189
189
|
`driver_dispute.correct`: it runs the test-writer on the findings it is given, makes its commit the baseline,
|
|
190
|
-
keeps the reading of each
|
|
190
|
+
keeps the reading of each locked test it corrected in `corrected` (none after an answer) and logs one line per
|
|
191
|
+
finding.
|
|
191
192
|
The callers differ only by the findings and the readings they pass.
|
|
192
193
|
- No test-writer correction runs after round 2 (`driver_fixloop._act_on`): a red gate or an unmet criterion blocks
|
|
193
194
|
the ticket. Other open findings go to the final must-fix list when the gate is green. A correction at the cap
|
|
194
195
|
would add locked tests that no fix round could make green.
|
|
195
|
-
- A locked
|
|
196
|
-
`corrected`,
|
|
197
|
-
`driver_report.
|
|
198
|
-
|
|
196
|
+
- A locked test is arbitrated once and corrected once per ticket. The ticket record keeps them in `disputes` and
|
|
197
|
+
`corrected`, by the `key` of each `driver_report.Dispute`, worked out once where it comes in. A dispute's key is
|
|
198
|
+
`driver_report.test_key`: `<locked file>::<test>`, the file resolved against the ticket's `locked` by
|
|
199
|
+
`driver_report._locked_file`, a parametrized case as its test. A review finding's key is
|
|
200
|
+
`driver_dispute.requested`: the test it names in `test`; the file for a `fixture` finding that names none; else
|
|
201
|
+
`<file>::+<title>`, a test to add. A per-file key made the operator rule on every second test of a file, and on
|
|
202
|
+
every missing test a review asked for, and answer `correct-test` each time. Only `driver_dispute._settle` and
|
|
203
|
+
`driver_dispute.correct` write them; no answer does, so no answer resets them. A second dispute or a second
|
|
199
204
|
correction asks `spec-ambiguous` (`driver_dispute.ambiguous`); its evidence file is the findings file a
|
|
200
|
-
`correct-test` correction reads (`driver_dispute.correct_as_answered`), and its
|
|
201
|
-
reviews (`driver_dispute.
|
|
205
|
+
`correct-test` correction reads (`driver_dispute.correct_as_answered`), and its `key`s are the ones `keep-test`
|
|
206
|
+
closes for later reviews (`driver_dispute.kept`, `driver_fixloop._still_to_correct`).
|
|
207
|
+
- A renamed or added test has a new key, so the per-key rule alone does not bound the arbitrations and the review
|
|
208
|
+
corrections of a ticket, and a review correction does not advance the round. The ticket's `settled` counts them,
|
|
209
|
+
in the same `state.json` write as the record it counts (`_settle`'s `settle`, `correct`'s `settles`), so a resume
|
|
210
|
+
neither counts one twice nor drops one. `driver_dispute.admit` is the one gate before a settlement: a key already
|
|
211
|
+
in the record, or `settled` at `driver_dispute.SETTLEMENTS` (3), asks `spec-ambiguous`, so each further one costs
|
|
212
|
+
an answer. `driver_legacy._per_test` moves a schema 4 record, and the evidence of the ticket's questions, to the
|
|
213
|
+
new keys and seeds `settled`, so the live code knows one key shape.
|
|
202
214
|
- `driver_run._attempts` treats a stop (BLOCKED or NEEDS_CONTEXT, not a dispute of a locked test) of any agent
|
|
203
215
|
as a rejected attempt: the rerun runs on the next entry of the role's list (`_rerun_entry`; the ticket fixer's list
|
|
204
216
|
is the implementer's), with the concerns or the driver's error in its prompt. A second stop or rejection asks a
|
|
@@ -122,7 +122,7 @@ Rules for each agent:
|
|
|
122
122
|
|
|
123
123
|
| Finding | What the driver does |
|
|
124
124
|
|---|---|
|
|
125
|
-
| kind `fixture`, any severity; kind `test`, `critical` or `important`, on a locked file of the ticket; or any kind, `critical` or `important`, on a locked file of another ticket | One test-writer correction, outside the fix rounds. The fixer may not edit a locked file, so a fix round cannot close a `test` finding there. Only a test-writer may change a locked file of another ticket, and it lists the file in `locked`: a ticket whose Touches line names such a file gets its change this way, where a fixer's change would be rejected (issue #116). The corrected files are the new locked versions, and the next review is a full review. A finding that the correction reports in `not_addressed` (it needs a production change first) becomes a finding of kind `code`, with the reason as its evidence, and goes to a fix round at once; the ledger says it was not corrected. A locked file is corrected at most once per ticket, by a review finding or after a `test-wrong` ruling: a finding that needs a second correction of
|
|
125
|
+
| kind `fixture`, any severity; kind `test`, `critical` or `important`, on a locked file of the ticket; or any kind, `critical` or `important`, on a locked file of another ticket | One test-writer correction, outside the fix rounds. The fixer may not edit a locked file, so a fix round cannot close a `test` finding there. Only a test-writer may change a locked file of another ticket, and it lists the file in `locked`: a ticket whose Touches line names such a file gets its change this way, where a fixer's change would be rejected (issue #116). The corrected files are the new locked versions, and the next review is a full review. A finding that the correction reports in `not_addressed` (it needs a production change first) becomes a finding of kind `code`, with the reason as its evidence, and goes to a fix round at once; the ledger says it was not corrected. A finding names the locked test it corrects in `test` (`<locked file>::<test>`), or leaves `test` out when it asks for a test that is missing. The driver keys it by that test; a `fixture` finding that names no test by its file; a missing test by its file and title. Each key is corrected at most once per ticket, by a review finding or after a `test-wrong` ruling: a finding that needs a second correction of the same key asks `spec-ambiguous`, with the finding as the second reading. A finding on another test of a corrected file, or one that asks for another missing test, gets its correction with no question (see Disputed locked tests for the bound). A correction that is rejected twice asks `ticket-blocked`, whose `retry` reviews the tip again. No correction runs after round 2. |
|
|
126
126
|
| `critical` or `important` | One fix round. |
|
|
127
127
|
| `minor` | It stays in the ledger and in the findings file. Each lens of the final review gets the list. |
|
|
128
128
|
|
|
@@ -132,7 +132,9 @@ An implementer or a fixer that finds a locked test contradicting the spec or the
|
|
|
132
132
|
|
|
133
133
|
The **arbitration** is the reviewer on its entry with `prompts/arbitration.md`: the ticket, the spec, the disputed tests and the dispute report. It is read-only, counts as a `reviewer` agent in `summary.md`, and is not a fix round. Its report `arbitration-<n>.json` gives per disputed test the `requirement` it checks, a `ruling` and a `reason`. On `test-wrong`, one test-writer correction (`correction-<n>.json`) runs with the ruling as a finding of kind `ruling` (`ruled-<n>.json`), then the role that disputed runs again on the corrected tests: the implementer, or the fixer of the same round. On `code-wrong`, that role runs again with the ruling in its prompt (`prompts/ruled.md`) and makes the test green. The review after a correction is a full review.
|
|
134
134
|
|
|
135
|
-
A locked
|
|
135
|
+
A locked test is arbitrated once and corrected once per ticket, keyed by `<locked file>::<test>`, so a parametrized case (`test_x[a]`) is its test and another test of a ruled or corrected file is a first dispute or a first correction. `state.json` keeps the ruling in the ticket's `disputes` and the correction in its `corrected`; no answer changes them. A second dispute on a ruled test, or a `test-wrong` ruling or a review finding on a test corrected before, asks one `spec-ambiguous` question naming the test, the requirement and the two readings.
|
|
136
|
+
|
|
137
|
+
A renamed test, or a test a correction added, has a new key, so a count bounds the rest: the ticket's `settled` counts its arbitrations and its review corrections (a `test-wrong` ruling and its correction count once), in the same write of `state.json` as their record. Once it is 3, the next dispute or review correction asks `spec-ambiguous` instead, with the count as the first reading. A correction after a `correct-test` answer does not count.
|
|
136
138
|
|
|
137
139
|
A fix round has three steps: the **fixer** (`prompts/fixer.md`) makes the fast gate green on its final commit, as the implementer does; the driver runs the fast gate on the new tip; a re-review reads the range of the fix. A fixer whose findings need no change, for example because a test-writer correction before it already resolved them, makes no commit and gives in `concerns` a reason for each finding; the round still counts, and the re-review of the same tip checks each reason.
|
|
138
140
|
|
|
@@ -169,6 +171,7 @@ A repository with no `origin` remote skips only step 2 and step 6. The tidied co
|
|
|
169
171
|
- A ticket whose recorded tip is not on its branch goes back to `implement`, from the test-writer commit. A merged ticket whose tip is not in the PR branch does the same.
|
|
170
172
|
- A red full gate at landing moves the ticket to `fix`, advances its round and records the red commit in `landing`, in one write of `state.json`. A resumed run starts that round's fixer and does not gate the red commit again; the fixer's report clears `landing`.
|
|
171
173
|
- A `state.json` before `schema` 4 can hold questions of kinds this driver no longer has (`finding`, `locked-test`, `locked-test-again`, `review-stopped`, `review-rejected`, `implementer-stopped`, `fixer-stopped`, `merged-locked-file`, `final-finding`). An open one ends the run with exit 3 before any agent, naming each such question: answer it with the driver version that asked it, or start the run again. An answered one keeps the ruling sentence the older driver wrote, in the ledger and in the PR body (`driver_legacy.py` keeps those sentences; only a kind or an answer it does not know gets `Ruling: <NN> <kind> (<answer>): <subject>.`). Every answered question keeps its ruling sentence in `state.json`.
|
|
174
|
+
- A `state.json` before `schema` 5 keys `disputes` and `corrected` by the locked file. The resume moves each record to the test it names; a review correction that named only its file stays under the file, the key of a `fixture` finding that names no test. Each finding in the evidence of the ticket's `spec-ambiguous` questions gets the key of its file's record, so a `keep-test` answered before now keeps that test, not the whole file. `settled` starts at one per record that is not the correction of a ruling: an arbitration of two files counts two, so the cap comes no later than it would.
|
|
172
175
|
- A run of an older driver that stopped after its first final review round goes on to its fix batch and the scoped review with its `findings-0.json`, whose findings have no `source`; the findings of the scoped review have the source `final-reviewer`. A run that stopped inside that round runs the three lenses.
|
|
173
176
|
- A slot with the uncommitted work of an interrupted role stays as it is. The role runs there again and is told so.
|
|
174
177
|
|
|
@@ -208,7 +211,7 @@ Every report has `status` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCK
|
|
|
208
211
|
|---|---|---|---|
|
|
209
212
|
| test-writer | `prompts/test-writer.md` | `locked` (test file paths), `red` (`test`, `line`) | The driver reads a test node id `<file>::<test>` in `locked` as its file. With DONE: one commit, one locked file and one red line or more. A correction's test can be green on the implementer's code, so its red line comes from a production edit that the correction makes and reverts. No locked path contains whitespace, since `IMPLEMENT_SPEC_LOCKED` separates the paths by spaces. Each locked path is in a commit that the role made and is a file at the tip: a correction that deletes a locked file leaves it out of `locked`. Each `line` is in the log. A locked file of another ticket whose test-writer has run, merged or not, that the role changed is in `locked`. A correction changes only the files that it lists in `locked`. Each `not_addressed[].finding` is the title of a finding of the correction (the driver logs its reason); a DONE correction with each of its findings there needs no commit. |
|
|
210
213
|
| implementer | `prompts/implementer.md` | `green` | With DONE and no commit: no new commit on the branch, no uncommitted change, and a concern that says why the start needs no change. The driver then gates and reviews the start commit. With BLOCKED, a dispute names a locked file of the ticket and leaves no uncommitted change (also for the fixer). |
|
|
211
|
-
| reviewer | `prompts/reviewer.md` | `findings` (`severity`, `file`, `line`, `title`, `evidence`, `kind`) | None. |
|
|
214
|
+
| reviewer | `prompts/reviewer.md` | `findings` (`severity`, `file`, `line`, `title`, `evidence`, `kind`, and `test` for a `fixture` or `test` finding on a locked test that exists) | None. |
|
|
212
215
|
| reviewer, arbitrating | `prompts/arbitration.md` | `rulings` (`test`, `requirement`, `ruling`: `test-wrong` or `code-wrong`, `reason`) | One ruling for each disputed test, its id as the dispute gives it. |
|
|
213
216
|
| fixer | `prompts/fixer.md` | `green`, `ticket` | With DONE and no commit: no new commit on the branch, no uncommitted change, a gate that is green on the start, and a concern that names each finding of the round. |
|
|
214
217
|
| final-spec, final-correctness, final-structure | `prompts/final-lens.md`, with the lines of `prompts/lens-<source>.md` | `findings` | None. |
|
|
@@ -225,7 +228,7 @@ A question is a bounded choice for the operator. `driver_decisions.py` `KINDS` h
|
|
|
225
228
|
|
|
226
229
|
| Kind | Question id | Asked when | Run exit | Options |
|
|
227
230
|
|---|---|---|---|---|
|
|
228
|
-
| `spec-ambiguous` | `<NN>-spec-ambiguous-<n>` | A second dispute on a locked
|
|
231
|
+
| `spec-ambiguous` | `<NN>-spec-ambiguous-<n>` | A second dispute on a locked test that the reviewer ruled on in the ticket, or a second correction needed for a locked test of the ticket (a `test-wrong` ruling or a review finding on a test corrected before); or a dispute or a review correction after the ticket's locked tests were settled 3 times. Another test of the same file, or another missing test that a review finding asks for, is no second correction. The subject names the test, the requirement and the two readings; the evidence is `spec-ambiguous-<n>.json`. | 2 | No option is recommended. `keep-test`: the role that disputed runs again against the test; after a review finding, the ticket resumes from the review and later findings with the same key are closed: on that test, a `fixture` finding on that file that names no test, or the same missing test. `correct-test`: one more correction, to the second reading, then the role that disputed runs again (the fixer of the same round after the review of its round); after a review finding, the review runs again. `edit-spec`: the ticket stays BLOCKED, with the ruling in the ledger. None of them changes the ticket's `disputes` or `corrected`. |
|
|
229
232
|
| `ticket-blocked` | `<NN>-ticket-blocked-<n>`, `final-ticket-blocked-<n>` | A ticket agent (test-writer, implementer, reviewer, fixer, conflict) or an agent of the end of run stopped with `BLOCKED` or `NEEDS_CONTEXT` or was rejected, and its rerun on the next entry of its list did too; or a finding is open after the scoped review of the final fix batch (one question per finding). The subject names the role and the reason, or the finding. | 2 | `retry` (recommended): the role runs again on its first entry from the tip the ticket left, with its one rerun; for a fixer, the round that stopped does not count: the driver gates and reviews the tip, and a fixer runs that round again on the review's findings. An arbitration or a correction runs for another role, so its work is not kept: after a dispute, the role that disputed runs again from the tip before them; after a review correction, the driver reviews that tip again. For the end of run, the stopped agent runs again from where the end of run is; for an open finding, one more fix batch and scoped review run. `edit`: the ticket, or the end of run, stays BLOCKED, with the ruling in the ledger, so the spec or the ticket can be edited. |
|
|
230
233
|
|
|
231
234
|
`final-finding` (fix or accept a finding open after the second round of the final review) became a `ticket-blocked` question of the end of run, id `final-ticket-blocked-<n>`: whether one more batch runs is the operator's call, and nothing ships with an open finding, so there is no `accept`.
|
|
@@ -49,8 +49,9 @@ KINDS = {
|
|
|
49
49
|
"spec-ambiguous": Kind(
|
|
50
50
|
"Ticket {ticket}: the spec reads two ways on a locked test: {subject}",
|
|
51
51
|
"This locked test was ruled on or corrected once in ticket {ticket}, and a second dispute or a second "
|
|
52
|
-
"correction needs it again: the spec supports both readings.
|
|
53
|
-
"
|
|
52
|
+
"correction needs it again: the spec supports both readings. Or the locked tests of ticket {ticket} were "
|
|
53
|
+
"arbitrated or corrected so often that the driver asks before one more: the first reading says so. Ticket "
|
|
54
|
+
"{ticket} is BLOCKED and each ticket that it blocks waits.",
|
|
54
55
|
"",
|
|
55
56
|
{"keep-test": Option(
|
|
56
57
|
"The test stands as it is. The role that disputed it runs again and makes it green; a review finding that "
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"""A locked test that an implementer or a fixer disputes: the reviewer's arbitration, the test-writer correction
|
|
2
|
-
(after a ruling, a review finding or a `correct-test` answer), and the `spec-ambiguous` question when a locked
|
|
3
|
-
disputed or corrected a second time in its ticket.
|
|
2
|
+
(after a ruling, a review finding or a `correct-test` answer), and the `spec-ambiguous` question when a locked test is
|
|
3
|
+
disputed or corrected a second time in its ticket, or when its locked tests were settled `SETTLEMENTS` times.
|
|
4
4
|
|
|
5
|
-
A dispute is keyed by its locked
|
|
6
|
-
ruled file is
|
|
5
|
+
A dispute is keyed by its locked test, `<locked file>::<test>` (driver_report.test_key), so a parametrized case is its
|
|
6
|
+
test and another test of a ruled file is a first dispute. A review finding is keyed by `requested`. The ticket record
|
|
7
|
+
keeps the ruling in `disputes` and the correction in `corrected`, and counts both in `settled`.
|
|
7
8
|
"""
|
|
8
9
|
from __future__ import annotations
|
|
9
10
|
|
|
@@ -21,20 +22,21 @@ from driver_decisions import Resume
|
|
|
21
22
|
from driver_report import Dispute
|
|
22
23
|
from driver_run import OUT, Blocked, Call, Run, during, ledger, retry_point
|
|
23
24
|
|
|
25
|
+
SETTLEMENTS = 3 # arbitrations and review corrections per ticket before one more asks: no new test dodges the bound
|
|
26
|
+
|
|
24
27
|
class Corrected(NamedTuple):
|
|
25
|
-
"""The reading a locked
|
|
28
|
+
"""The reading a locked test is corrected to, which the ticket's `corrected` keeps: its one correction."""
|
|
26
29
|
test: str
|
|
27
30
|
requirement: str
|
|
28
31
|
reason: str
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
class Reading(NamedTuple):
|
|
32
|
-
"""The two readings of a locked test that a `spec-ambiguous` question asks about.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
"""The two readings of a locked test that a `spec-ambiguous` question asks about. The second is the reason of the
|
|
36
|
+
new dispute or finding."""
|
|
37
|
+
found: Dispute
|
|
35
38
|
requirement: str
|
|
36
|
-
first: str # the reading of its ruling or of its one correction
|
|
37
|
-
second: str # the reading of the new dispute or finding
|
|
39
|
+
first: str # the reading of its ruling or of its one correction, or the count at the cap
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
def _rulings(entry: dict) -> str:
|
|
@@ -58,22 +60,31 @@ def agent(run: Run, call: Call) -> dict:
|
|
|
58
60
|
|
|
59
61
|
def ambiguous(run: Run, number: str, readings: list[Reading], resume: Resume) -> NoReturn:
|
|
60
62
|
"""Ask one `spec-ambiguous` question on `readings` and block the ticket. Its evidence is a findings file that a
|
|
61
|
-
`correct-test` correction reads: one finding per locked
|
|
62
|
-
after the question: `spec-ambiguous-<n>.json` for
|
|
63
|
+
`correct-test` correction reads: one finding per locked test, to correct to the second reading, with the `key` that
|
|
64
|
+
`keep-test` closes. The file is named after the question: `spec-ambiguous-<n>.json` for
|
|
65
|
+
`<NN>-spec-ambiguous-<n>`."""
|
|
63
66
|
question = driver_decisions.question_id("spec-ambiguous", number, run.state.read()["run"]["questions"])
|
|
64
67
|
path = OUT / number / f"{question.removeprefix(f'{number}-')}.json" # the ticket's folder names the ticket
|
|
65
|
-
subjects = [f"{one.test}{f', {one.requirement}' * bool(one.requirement)}: the first
|
|
66
|
-
f"second reading: {one.
|
|
67
|
-
_ruling_findings(path, [(one.
|
|
68
|
+
subjects = [f"{one.found.test or one.found.file}{f', {one.requirement}' * bool(one.requirement)}: the first "
|
|
69
|
+
f"reading: {one.first}; the second reading: {one.found.reason}" for one in readings]
|
|
70
|
+
_ruling_findings(path, [(one.found, subject, f"correct the test to the second reading: {one.found.reason}")
|
|
68
71
|
for one, subject in zip(readings, subjects)])
|
|
69
72
|
subject = "; ".join(subjects)
|
|
70
73
|
run.ask(number, "spec-ambiguous", [subject], str(path), resume)
|
|
71
74
|
raise Blocked(f"the spec reads two ways on a locked test: {subject}")
|
|
72
75
|
|
|
73
76
|
|
|
74
|
-
def
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
+
def requested(finding: dict) -> Dispute:
|
|
78
|
+
"""What a review finding on a locked file asks to correct, keyed: the test it names, the whole file for a
|
|
79
|
+
`fixture` finding that names none, else a test to add, keyed by its title."""
|
|
80
|
+
file, test, title = finding["file"], finding.get("test", ""), finding["title"]
|
|
81
|
+
key = driver_report.test_key(file, test) if test or finding["kind"] == "fixture" else f"{file}::+{title}"
|
|
82
|
+
return Dispute(file, test, f"{title}: {finding['evidence']}", key)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def kept(questions: list[dict], number: str) -> set[str]:
|
|
86
|
+
"""The keys of the `spec-ambiguous` questions of `number` answered `keep-test`."""
|
|
87
|
+
return {finding["key"] for q in questions if (q["ticket"], q["kind"], q["answer"]) ==
|
|
77
88
|
(number, "spec-ambiguous", "keep-test") for finding in json.loads(Path(q["evidence"][0]).read_text())}
|
|
78
89
|
|
|
79
90
|
|
|
@@ -85,38 +96,46 @@ def correction(questions: list[dict], number: str) -> dict:
|
|
|
85
96
|
return answered[-1] if answered else {}
|
|
86
97
|
|
|
87
98
|
|
|
88
|
-
def
|
|
89
|
-
"""
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
def admit(run: Run, number: str, found: list[Dispute], record: str, resume: Resume) -> None:
|
|
100
|
+
"""Ask `spec-ambiguous` instead of settling `found` when the ticket's `record` (`disputes` or `corrected`) has one
|
|
101
|
+
of its keys, or when the ticket's locked tests were settled `SETTLEMENTS` times: a renamed or added test has a new
|
|
102
|
+
key, so only the count bounds them."""
|
|
103
|
+
entry = run.state.read()["tickets"][number]
|
|
104
|
+
again = [Reading(one, entry[record][one.key]["requirement"], entry[record][one.key]["reason"])
|
|
105
|
+
for one in found if one.key in entry[record]]
|
|
106
|
+
if not again and entry["settled"] >= SETTLEMENTS:
|
|
107
|
+
first = f"the locked tests of this ticket were settled {entry['settled']} times, the most without a question"
|
|
108
|
+
again = [Reading(one, "", first) for one in found]
|
|
109
|
+
if again:
|
|
110
|
+
ambiguous(run, number, again, resume)
|
|
93
111
|
|
|
94
112
|
|
|
95
|
-
def _ruling_findings(path: Path, rulings: list[tuple[
|
|
96
|
-
"""Write the findings file of a correction to rulings: a critical finding of kind `ruling` per (
|
|
97
|
-
|
|
98
|
-
findings = [{"severity": "critical", "file": file, "
|
|
99
|
-
"kind": "ruling"} for
|
|
113
|
+
def _ruling_findings(path: Path, rulings: list[tuple[Dispute, str, str]]) -> list[dict]:
|
|
114
|
+
"""Write the findings file of a correction to rulings: a critical finding of kind `ruling` per (dispute, title,
|
|
115
|
+
evidence). Returns the findings."""
|
|
116
|
+
findings = [{"severity": "critical", "file": one.file, "test": one.test, "key": one.key, "line": 0, "title": title,
|
|
117
|
+
"evidence": evidence, "kind": "ruling"} for one, title, evidence in rulings]
|
|
100
118
|
path.write_text(json.dumps(findings, indent=1) + "\n")
|
|
101
119
|
return findings
|
|
102
120
|
|
|
103
121
|
|
|
104
|
-
def correct(run: Run, call: Call, findings: list[dict], readings: dict[str, Corrected], fate: str
|
|
122
|
+
def correct(run: Run, call: Call, findings: list[dict], readings: dict[str, tuple[str, Corrected]], fate: str,
|
|
123
|
+
settles: bool = False) -> dict[str, str]:
|
|
105
124
|
"""One test-writer correction of `findings`, outside the fix rounds. `call` is the test-writer's, its values point
|
|
106
125
|
at the findings file. Its commit becomes the baseline of the ticket's own locked files, and the `corrected` of the
|
|
107
|
-
ticket keeps the reading in `readings` of each
|
|
108
|
-
|
|
126
|
+
ticket keeps, under its key, the reading in `readings` ({title: (key, reading)}) of each finding it corrected; a
|
|
127
|
+
review correction `settles`, in the same write. A ledger line per finding says what it did, with `fate` for one it
|
|
128
|
+
did not correct. Returns {title: reason} of each finding it did not correct."""
|
|
109
129
|
number = call.number
|
|
110
130
|
report = run.agent(replace(call, notes=["correction"],
|
|
111
131
|
check={"correction": True, "findings": [finding["title"] for finding in findings]}))
|
|
112
132
|
tip = driver_slots.head(call.slot)
|
|
113
133
|
reasons = {item["finding"]: item["reason"] for item in report.get("not_addressed", [])}
|
|
114
|
-
kept = {
|
|
115
|
-
if finding["file"] in readings and finding["title"] not in reasons}
|
|
134
|
+
kept = {key: reading._asdict() for title, (key, reading) in readings.items() if title not in reasons}
|
|
116
135
|
|
|
117
136
|
def record(state: dict) -> None:
|
|
118
137
|
entry = state["tickets"][number]
|
|
119
|
-
entry.update(tip=tip, **driver_locked.written(entry, report["locked"], tip))
|
|
138
|
+
entry.update(tip=tip, settled=entry["settled"] + settles, **driver_locked.written(entry, report["locked"], tip))
|
|
120
139
|
entry["corrected"].update(kept)
|
|
121
140
|
|
|
122
141
|
run.state.update(record)
|
|
@@ -138,52 +157,58 @@ def correct_as_answered(run: Run, call: Call, question: dict) -> None:
|
|
|
138
157
|
|
|
139
158
|
|
|
140
159
|
def _settle(run: Run, call: Call, disputed: list[Dispute]) -> None:
|
|
141
|
-
"""A locked
|
|
142
|
-
ruled `test-wrong` gets its one correction (a
|
|
143
|
-
keeps the rulings."""
|
|
160
|
+
"""A locked test disputed before, or a ticket settled `SETTLEMENTS` times, asks `spec-ambiguous`. Else the
|
|
161
|
+
reviewer rules on each disputed test, a test ruled `test-wrong` gets its one correction (a test corrected before
|
|
162
|
+
asks `spec-ambiguous`), and the ticket record keeps the rulings and counts the arbitration in one write."""
|
|
144
163
|
number = call.number
|
|
145
|
-
entry = run.state.read()["tickets"][number]
|
|
146
164
|
resume = retry_point(call.role, driver_slots.head(call.slot), call.fix_round)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
n = 1 + len(entry["disputes"])
|
|
165
|
+
admit(run, number, disputed, "disputes", resume)
|
|
166
|
+
n = 1 + len(run.state.read()["tickets"][number]["disputes"])
|
|
150
167
|
ruled = _arbitrate(run, call, disputed, n)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
168
|
+
|
|
169
|
+
def settle(state: dict) -> None:
|
|
170
|
+
entry = state["tickets"][number]
|
|
171
|
+
entry["disputes"].update({one.key: ruling for one, ruling in ruled})
|
|
172
|
+
entry["settled"] += 1
|
|
173
|
+
|
|
174
|
+
wrong = [(one._replace(reason=ruling["reason"]), ruling) for one, ruling in ruled
|
|
175
|
+
if ruling["ruling"] == "test-wrong"]
|
|
176
|
+
try: # the count did not move since the first admit, so only a test corrected before asks here
|
|
177
|
+
admit(run, number, [one for one, _ in wrong], "corrected", resume)
|
|
178
|
+
except Blocked:
|
|
179
|
+
run.state.update(settle) # the test is arbitrated
|
|
180
|
+
raise
|
|
156
181
|
if wrong:
|
|
157
182
|
_correct(run, call, wrong, n)
|
|
158
|
-
run.state.update(
|
|
183
|
+
run.state.update(settle)
|
|
159
184
|
|
|
160
185
|
|
|
161
|
-
def _arbitrate(run: Run, call: Call, disputed: list[Dispute], n: int) ->
|
|
162
|
-
"""The reviewer's ruling on each disputed locked
|
|
186
|
+
def _arbitrate(run: Run, call: Call, disputed: list[Dispute], n: int) -> list[tuple[Dispute, dict]]:
|
|
187
|
+
"""The reviewer's ruling on each disputed locked test, from `arbitration-<n>.json`, with its dispute."""
|
|
163
188
|
number, slot = call.number, call.slot
|
|
164
|
-
tip,
|
|
189
|
+
tip, by_test = driver_slots.head(slot), {one.test: one for one in disputed}
|
|
165
190
|
asked = {**call.values, "role": call.role, "start_sha": tip,
|
|
166
191
|
"disputed": "".join(f"- {one.test}: {one.reason}\n" for one in disputed),
|
|
167
192
|
"dispute_report": os.path.relpath(OUT / number / f"{call.role}-{call.fix_round}.json", slot)}
|
|
168
193
|
with during("the arbitration"):
|
|
169
194
|
report = run.read_only(number, slot, call.values["branch"], tip, lambda: run.agent(Call(
|
|
170
195
|
"reviewer", number, slot, asked, template="arbitration", name=f"arbitration-{n}", retry=call.role,
|
|
171
|
-
fix_round=call.fix_round, check={"disputed": list(
|
|
196
|
+
fix_round=call.fix_round, check={"disputed": list(by_test)})))
|
|
172
197
|
for ruling in report["rulings"]:
|
|
173
198
|
ledger(f"Ticket {number}: the reviewer ruled {ruling['ruling']} on the locked test {ruling['test']}, "
|
|
174
199
|
f"{ruling['requirement']}: {ruling['reason']}.")
|
|
175
|
-
return
|
|
200
|
+
return [(by_test[ruling["test"]], ruling) for ruling in report["rulings"] if ruling["test"] in by_test]
|
|
176
201
|
|
|
177
202
|
|
|
178
|
-
def _correct(run: Run, call: Call, wrong:
|
|
203
|
+
def _correct(run: Run, call: Call, wrong: list[tuple[Dispute, dict]], n: int) -> None:
|
|
179
204
|
"""The correction of the tests ruled `test-wrong`, each ruling a finding of kind `ruling` in `ruled-<n>.json`."""
|
|
180
205
|
number, slot = call.number, call.slot
|
|
181
206
|
path = OUT / number / f"ruled-{n}.json"
|
|
182
|
-
|
|
183
|
-
|
|
207
|
+
titled = [(one, f"{one.test}, {ruling['requirement']}", ruling) for one, ruling in wrong]
|
|
208
|
+
findings = _ruling_findings(path, [(one, title, ruling["reason"]) for one, title, ruling in titled])
|
|
184
209
|
values = {**call.values, "start_sha": driver_slots.head(slot), "findings": os.path.relpath(path, slot)}
|
|
185
|
-
readings = {
|
|
186
|
-
for
|
|
210
|
+
readings = {title: (one.key, Corrected(one.test, ruling["requirement"], ruling["reason"]))
|
|
211
|
+
for one, title, ruling in titled}
|
|
187
212
|
with during("the test-writer correction"):
|
|
188
213
|
correct(run, Call("test-writer", number, slot, values, name=f"correction-{n}", retry=call.role,
|
|
189
214
|
fix_round=call.fix_round), findings, readings, "")
|
|
@@ -16,7 +16,6 @@ import driver_review
|
|
|
16
16
|
import driver_slots
|
|
17
17
|
from driver_decisions import Resume
|
|
18
18
|
from driver_dispute import Corrected
|
|
19
|
-
from driver_report import Dispute
|
|
20
19
|
from driver_run import OUT, Blocked, Call, Run, during, ledger
|
|
21
20
|
from driver_tickets import Ticket
|
|
22
21
|
|
|
@@ -134,22 +133,19 @@ def _review(job: Job) -> list[dict]:
|
|
|
134
133
|
|
|
135
134
|
|
|
136
135
|
def _correct(job: Job, findings: list[dict]) -> list[dict]:
|
|
137
|
-
"""One test-writer correction for the findings on the locked tests. It is outside the fix rounds. A
|
|
138
|
-
was corrected before in the ticket
|
|
139
|
-
`ticket-blocked`, whose `retry` reviews the tip
|
|
140
|
-
of kind code for the fixer (issue #111)."""
|
|
136
|
+
"""One test-writer correction for the findings on the locked tests. It is outside the fix rounds. A finding whose
|
|
137
|
+
key (driver_dispute.requested) was corrected before in the ticket, or a ticket settled `SETTLEMENTS` times, asks
|
|
138
|
+
`spec-ambiguous` instead. A correction that is rejected twice asks `ticket-blocked`, whose `retry` reviews the tip
|
|
139
|
+
again. Returns the findings that it did not correct, as findings of kind code for the fixer (issue #111)."""
|
|
141
140
|
run, number = job.run, job.ticket.number
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if again := driver_dispute.second_readings(found, corrected):
|
|
146
|
-
with during("the review"):
|
|
147
|
-
driver_dispute.ambiguous(run, number, again, Resume("review"))
|
|
141
|
+
found = {finding["title"]: driver_dispute.requested(finding) for finding in findings}
|
|
142
|
+
with during("the review"):
|
|
143
|
+
driver_dispute.admit(run, number, list(found.values()), "corrected", Resume("review"))
|
|
148
144
|
call = Call("test-writer", number, job.slot, job.pointers(job.round), fix_round=job.round + 1, retry="reviewer")
|
|
145
|
+
readings = {title: (one.key, Corrected(one.test, "", one.reason)) for title, one in found.items()}
|
|
149
146
|
with during("the test-writer correction"):
|
|
150
|
-
reasons = driver_dispute.correct(run, call, findings,
|
|
151
|
-
|
|
152
|
-
" It goes to the fixer as a finding of kind code.")
|
|
147
|
+
reasons = driver_dispute.correct(run, call, findings, readings,
|
|
148
|
+
" It goes to the fixer as a finding of kind code.", settles=True)
|
|
153
149
|
job.tip, job.previous = driver_slots.head(job.slot), ""
|
|
154
150
|
return _uncorrected(job, findings, reasons)
|
|
155
151
|
|
|
@@ -205,14 +201,15 @@ def _fix(job: Job, findings: list[dict], landing: str = "") -> None:
|
|
|
205
201
|
|
|
206
202
|
|
|
207
203
|
def _still_to_correct(job: Job, state: dict, to_correct: list[dict]) -> list[dict]:
|
|
208
|
-
"""The findings for a correction, but those on a
|
|
204
|
+
"""The findings for a correction, but those on a locked test whose `spec-ambiguous` question was answered
|
|
205
|
+
`keep-test`."""
|
|
209
206
|
number = job.ticket.number
|
|
210
|
-
kept = driver_dispute.
|
|
211
|
-
for finding in to_correct
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return [finding for finding in to_correct if finding
|
|
207
|
+
kept = driver_dispute.kept(state["run"]["questions"], number)
|
|
208
|
+
closed = [finding for finding in to_correct if driver_dispute.requested(finding).key in kept]
|
|
209
|
+
for finding in closed:
|
|
210
|
+
ledger(f"Ticket {number}: {finding['kind']} finding in {finding['file']} closed as it is by the ruling "
|
|
211
|
+
f"(keep-test), with no correction: {finding['title']}.")
|
|
212
|
+
return [finding for finding in to_correct if finding not in closed]
|
|
216
213
|
|
|
217
214
|
|
|
218
215
|
def _save_must_fix(state: dict, number: str, findings: list[dict]) -> None:
|
|
@@ -4,17 +4,20 @@
|
|
|
4
4
|
Every run of a newer driver holds `lock` (driver._hold), so a newer and an older driver never run in one repository
|
|
5
5
|
at the same time. The driver calls `resume` once, after the locks and before any check reads a ref: a run with no
|
|
6
6
|
`schema` in state.json gets the new names of its refs; a run before schema 3 gets its gates as the full tier; a run
|
|
7
|
-
before schema 4 keeps the ruling of each answered question, and one with an open question of a removed kind stops
|
|
7
|
+
before schema 4 keeps the ruling of each answered question, and one with an open question of a removed kind stops;
|
|
8
|
+
a run before schema 5 gets its rulings and corrections keyed by their test.
|
|
8
9
|
ponytail: delete this module, tests/test_legacy.py and its one line in driver._hold and in driver._start_errors
|
|
9
10
|
once no older driver is left.
|
|
10
11
|
"""
|
|
11
12
|
from __future__ import annotations
|
|
12
13
|
|
|
14
|
+
import json
|
|
13
15
|
from pathlib import Path
|
|
14
16
|
from types import MappingProxyType
|
|
15
17
|
from typing import IO
|
|
16
18
|
|
|
17
19
|
import driver_decisions
|
|
20
|
+
import driver_report
|
|
18
21
|
import driver_slots
|
|
19
22
|
import driver_state
|
|
20
23
|
from driver_names import Names
|
|
@@ -141,9 +144,34 @@ def _ruled(q: dict) -> str:
|
|
|
141
144
|
return f"Ruling: {q['ticket'] or 'end of run'} {q['kind']} ({q['answer']}): {q['subject']}."
|
|
142
145
|
|
|
143
146
|
|
|
147
|
+
def _per_test(entry: dict, evidence: list[Path]) -> None:
|
|
148
|
+
"""Schema 5: `disputes` and `corrected` move from their locked file to the test each record names, a review
|
|
149
|
+
correction that named only its file to the file itself, and each finding of `evidence`, the files of the ticket's
|
|
150
|
+
`spec-ambiguous` questions, gets the key of its file's record. `settled` counts one per record that is not the
|
|
151
|
+
correction of a ruling, so an arbitration of two files counts two: the cap comes no later than it would."""
|
|
152
|
+
disputes, corrected = entry.get("disputes", {}), entry.get("corrected", {})
|
|
153
|
+
keys = {file: driver_report.test_key(file, record["test"]) for file, record in {**corrected, **disputes}.items()}
|
|
154
|
+
entry["disputes"] = {keys[file]: record for file, record in disputes.items()}
|
|
155
|
+
entry["corrected"] = {keys[file]: record for file, record in corrected.items()}
|
|
156
|
+
entry["settled"] = len(disputes) + len(corrected.keys() - disputes.keys())
|
|
157
|
+
for path in evidence:
|
|
158
|
+
findings = json.loads(path.read_text())
|
|
159
|
+
path.write_text(json.dumps([{"key": keys.get(one["file"], one["file"]), **one} for one in findings],
|
|
160
|
+
indent=1) + "\n")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def _all_per_test(state: dict) -> None:
|
|
164
|
+
"""Schema 5 for each ticket not keyed per test yet, with the evidence of its `spec-ambiguous` questions."""
|
|
165
|
+
for number, entry in state["tickets"].items():
|
|
166
|
+
if "settled" not in entry: # schema 5 added it, so its presence marks a ticket already keyed per test
|
|
167
|
+
asked = [Path(q["evidence"][0]) for q in state["run"].get("questions", [])
|
|
168
|
+
if (q["ticket"], q["kind"]) == (number, "spec-ambiguous")]
|
|
169
|
+
_per_test(entry, [path for path in asked if path.exists()])
|
|
170
|
+
|
|
171
|
+
|
|
144
172
|
def _upgraded(state: dict) -> None:
|
|
145
173
|
"""Schema 3: every gate of an older driver was the full gate, so its greens and its count are of the full tier.
|
|
146
|
-
Schema 4: an answered question keeps its ruling sentence."""
|
|
174
|
+
Schema 4: an answered question keeps its ruling sentence. Schema 5: see `_per_test`."""
|
|
147
175
|
run = state["run"]
|
|
148
176
|
for q in run.get("questions", []):
|
|
149
177
|
if q["answer"] is not None:
|
|
@@ -151,6 +179,7 @@ def _upgraded(state: dict) -> None:
|
|
|
151
179
|
for record in [run.get("final", {}), *state["tickets"].values()]:
|
|
152
180
|
if isinstance(record.get("green_gates"), list):
|
|
153
181
|
record["green_gates"] = {**driver_state.tiers(), "full": record["green_gates"]}
|
|
182
|
+
_all_per_test(state)
|
|
154
183
|
if isinstance(run.get("gates"), int):
|
|
155
184
|
run["gates"] = {"fast": 0, "full": run["gates"]}
|
|
156
185
|
run["schema"] = driver_state.SCHEMA
|
|
@@ -160,11 +160,20 @@ def _locked_file(name: str, locked: list[str]) -> str:
|
|
|
160
160
|
return found[0] if len(found) == 1 else ""
|
|
161
161
|
|
|
162
162
|
|
|
163
|
+
def test_key(file: str, test: str) -> str:
|
|
164
|
+
"""`<locked file>::<test>`, the key of a locked test in `disputes` and `corrected`: `test` is an id `<path>::<test>`
|
|
165
|
+
or a bare name, and a parametrized case is its test. The file itself when `test` names no test."""
|
|
166
|
+
name = re.sub(r"\[.*\]$", "", test.partition("::")[2] if "::" in test else test)
|
|
167
|
+
return f"{file}::{name}" if name and name != file else file
|
|
168
|
+
|
|
169
|
+
|
|
163
170
|
class Dispute(NamedTuple):
|
|
164
|
-
"""One concern `locked test contradicts spec: <file>::<test>: <reason>` of a BLOCKED implementer or fixer
|
|
171
|
+
"""One concern `locked test contradicts spec: <file>::<test>: <reason>` of a BLOCKED implementer or fixer, or a
|
|
172
|
+
review finding on a locked file (driver_dispute.requested)."""
|
|
165
173
|
file: str # the locked file it names; "" when it names no file of the ticket's `locked`
|
|
166
|
-
test: str
|
|
174
|
+
test: str # as the report gives it; "" for a review finding that names no test
|
|
167
175
|
reason: str
|
|
176
|
+
key: str # what `disputes` and `corrected` key it by: one dispute or correction each
|
|
168
177
|
|
|
169
178
|
|
|
170
179
|
def disputes(role: str, report: dict, locked: list[str]) -> list[Dispute]:
|
|
@@ -175,7 +184,8 @@ def disputes(role: str, report: dict, locked: list[str]) -> list[Dispute]:
|
|
|
175
184
|
for concern in report["concerns"]:
|
|
176
185
|
if concern.startswith(CONTRADICTS):
|
|
177
186
|
test, _, reason = concern[len(CONTRADICTS):].strip().partition(": ")
|
|
178
|
-
|
|
187
|
+
file = _locked_file(test.partition("::")[0], locked)
|
|
188
|
+
found.append(Dispute(file, test, reason, test_key(file, test)))
|
|
179
189
|
return found
|
|
180
190
|
|
|
181
191
|
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
{"run": {revision, pr_branch, schema, gates: {fast, full}, stops, agents: [{ticket, role, entry, seconds, cost, tokens}], questions, start,
|
|
4
4
|
landed: [[ticket, the PR tip its merge made]], final},
|
|
5
5
|
"tickets": {"NN": {phase, round, tip, test_writer_sha, locked, green_gates, slot, note,
|
|
6
|
-
landing, disputes, corrected}}}
|
|
6
|
+
landing, disputes, corrected, settled}}}
|
|
7
7
|
|
|
8
8
|
green_gates is {"fast": [commit], "full": [commit]}, in a ticket and in run.final: a fast green never stands in for a
|
|
9
9
|
full one. landing is the commit whose full gate was red at the landing while the fixer of the round it started has
|
|
10
|
-
not reported, else None. disputes is {locked file
|
|
11
|
-
the
|
|
12
|
-
at most one of each per ticket
|
|
10
|
+
not reported, else None. disputes is {<locked file>::<test>: {test, requirement, ruling, reason}}, the reviewer's
|
|
11
|
+
ruling on the test; corrected is {<locked file>::<test>: {test, requirement, reason}}, the reading of its one
|
|
12
|
+
correction. A locked test has at most one of each per ticket. settled counts the arbitrations and review corrections
|
|
13
|
+
of the ticket's locked tests. No answer writes the three."""
|
|
13
14
|
from __future__ import annotations
|
|
14
15
|
|
|
15
16
|
import fcntl
|
|
@@ -23,8 +24,8 @@ from typing import IO
|
|
|
23
24
|
from driver_names import Names
|
|
24
25
|
from driver_slots import ancestor, git, on_branch, path
|
|
25
26
|
|
|
26
|
-
SCHEMA =
|
|
27
|
-
# the ruling kept on an answered question. A run of an older driver has none.
|
|
27
|
+
SCHEMA = 5 # the version of this contract; 2: the names of driver_names, 3: gate tiers, 4: the two question kinds and
|
|
28
|
+
# the ruling kept on an answered question, 5: disputes and corrected per locked test. A run of an older driver has none.
|
|
28
29
|
PHASES = ("pending", "test-writer", "implement", "gate", "review", "fix", "merge", "merged", "blocked")
|
|
29
30
|
|
|
30
31
|
|
|
@@ -35,7 +36,7 @@ def tiers() -> dict:
|
|
|
35
36
|
|
|
36
37
|
def _ticket() -> dict:
|
|
37
38
|
return {"phase": "pending", "round": 0, "tip": None, "test_writer_sha": None, "locked": [], "green_gates": tiers(),
|
|
38
|
-
"slot": None, "note": "", "landing": None, "disputes": {}, "corrected": {}}
|
|
39
|
+
"slot": None, "note": "", "landing": None, "disputes": {}, "corrected": {}, "settled": 0}
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
def _final() -> dict:
|
|
@@ -3,6 +3,7 @@ This call is a correction of the locked tests, not a new test set. Read in {find
|
|
|
3
3
|
A `ruling` finding: a ruling says that a locked test contradicts the spec, and its `evidence` gives the reading of the spec that the test must assert. Change what the test asserts to that reading.
|
|
4
4
|
A `fixture` finding: a locked test encodes a stale path, format, fixture layout or setup detail. Correct only that detail and keep what each test asserts.
|
|
5
5
|
A `test` finding: a locked test is too weak, for example it stays green when the production line it protects is broken. Make the test assert the behavior of its criterion so that it fails on that break. Do not remove an assertion.
|
|
6
|
+
A `test` finding with no `test` field: a test that the ticket asks for is missing. Add it to the finding's file.
|
|
6
7
|
A finding on a locked file of another ticket, of any kind: only this correction may change that file. When the ticket must change it, as one that its Touches line names, make the change, keep what each test of the other ticket asserts, and list the file in `locked`.
|
|
7
8
|
For this you may read the implementation. Keep each test that no finding names as it is, and commit only the test files you correct.
|
|
8
9
|
When a finding needs a production change first, so that no correct test can be green, leave the test as it is and add the finding to `not_addressed`: `finding` is its `title` as the findings file gives it, `reason` is the production change it needs. The driver sends it to the fixer as a finding of kind `code`. A correction whose findings are all in `not_addressed` may report DONE with no commit.
|