Skip to content

fix(roadmap): judge a pyproject tool setting by its diff - #6089

Merged
dan-petty merged 4 commits into
mainfrom
fix/3491-pyproject-tool-diff
Nov 17, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/3491-pyproject-tool-diff

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

A change that edits only tool settings in pyproject.toml needs no spec delta. The paths gate read the whole file instead of its diff, so a change of a tool setting failed when other tables existed.

Now the stage check parses the diff of pyproject.toml with unidiff. When every changed key is under a [tool.*] table, the check refuses a spec delta. When another table changes or when a dependency changes, the check accepts a spec delta.

The folder of case 2163 holds its pyproject.toml diff in pyproject.diff, which the case loader reads when it is present, so the replay judges the case with the gate paths. The replay now judges 86 of the 322 known defects, not 85, and the replay tests record the new total.

Closes #3491

Change: openspec/changes/archive/2026-11-17-3491-pyproject-tool-diff/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 17, 2026
@dan-petty
dan-petty force-pushed the fix/3491-pyproject-tool-diff branch from ab74676 to 6cccf92 Compare November 17, 2026 08:24
@dan-petty

Copy link
Copy Markdown
Owner Author

Fix of the failing checks

The branch is rebased onto origin/main (new head 6cccf9219). The merge commits of main are gone.

Failure Cause Fix
mypy: stage_change.py:831: Module "unidiff" does not explicitly export attribute "PatchSet" The package unidiff imports PatchSet but does not export it. Import PatchSet from unidiff.patch, as implement_eval_properties.py does.
swallowed failures row (ratchet exceeded in stage_change.py) is_tool_setting_diff caught every Exception around the parse. It catches unidiff.errors.UnidiffParseError only, the error of a diff that unidiff cannot parse. The ceiling did not change.
test_roadmap_stage_eval_command.py: the replay judges 86 of 322 known defects, the test expects 85 The new gate judges case 2163 (spec_delta_wrong, gate none to gate paths). That is the acceptance criterion of #3491, so the new total is correct. The two replay tests record 86 of 322 (27%). --record writes only the constants that the plans cite, so the totals live only in this test. No threshold changed.
(no check, found in review) stage_eval_gates.py held the diff of case 2163 as a constant keyed by issue number, so product code held a test case. Task 2.1 says the diff goes into facts.json. The diff is now pyproject_diff in the facts.json of case 2163, and PlanUnderTest.of_case reads case.facts.pyproject_diff.

Proof: uv run devops ci --check --only swallowed-failures,lint,format,typecheck,test-tree,docs,openspec,startup-imports,roadmap-stage-eval-commits,uv-check passes. uv run devops ci test on the four changed stage modules gives 3251 passed, 1 skipped.

The body of the pull request now names the new replay total.

Note: no production caller passes pyproject_diff to check_proposal yet, so a live plan that changes pyproject.toml still needs a spec delta, as before. Only the replay reads the diff.

@dan-petty
dan-petty force-pushed the fix/3491-pyproject-tool-diff branch from 6cccf92 to 41849c5 Compare November 17, 2026 08:39
@dan-petty

Copy link
Copy Markdown
Owner Author

Follow-up: Fail-to-Pass

New head 41849c53f, rebased onto origin/main.

Failure Cause Fix
Fail-to-Pass Check on 6cccf9219: test_an_unknown_case_exits_1_and_names_it failed on base, and the fix does not change it My last push put the key pyproject_diff in the facts.json of case 2163. The CaseFacts model of base does not know the key, so base cannot load the golden set, and each test that loads it fails on base. The diff is now the file pyproject.diff in the case folder. The loader reads it into CaseFacts.pyproject_diff when the file is present, as it reads trace.json. facts.json is the same as on main, and the base loader ignores the new file.

Proof: uv run devops ci fail-to-pass --base origin/main exits 0: only the tests that the change adds or changes fail on base. The eval tests give 148 passed, uv run devops ci test src/devops_cli/roadmap/stage/stage_eval_cases.py gives 1027 passed, and the static rows pass. The body of the pull request names the new file.

@dan-petty
dan-petty marked this pull request as ready for review November 17, 2026 08:42
@dan-petty
dan-petty enabled auto-merge (squash) November 17, 2026 08:42
A change that edits only tool settings in pyproject.toml needs no spec
delta. The paths gate read the whole file instead of its diff, so a
change of a tool setting failed when other tables existed.

Now the stage check parses the diff of pyproject.toml with unidiff.
When every changed key is under a [tool.*] table, the check refuses a
spec delta. When another table changes or when a dependency changes, the
check accepts a spec delta.

Case 2163 in the golden set now moves from missed to caught.

Closes #3491
mypy refused the import of PatchSet from the unidiff package, which does
not export it; it now comes from unidiff.patch, as in
implement_eval_properties.py. A diff that unidiff cannot parse raises
UnidiffParseError, so the check catches that class, not every exception.

The diff of case 2163 was a constant of stage_eval_gates.py, keyed by
the issue number. It is now the pyproject_diff of the facts file of the
case, as task 2.1 of the change says, so product code holds no case.

The paths gate now judges case 2163, so the replay judges 86 of the 322
known defects, not 85. The replay tests record the new total.
A new key in facts.json fails to load on a base whose CaseFacts does not
know it, so every test that loads the golden set failed on base and the
Fail-to-Pass check refused the change. The diff now sits in
pyproject.diff in the case folder, which the loader reads into
pyproject_diff when it is present, as it reads trace.json.
Changed-line coverage was 87%, under the floor of 90%: no test reached
an empty diff, a file other than pyproject.toml, a table header that
only the base file holds, an added table header, a comment or blank
line, or the no-newline marker. One parametrized test gives each case
and the answer it must get.
@dan-petty
dan-petty force-pushed the fix/3491-pyproject-tool-diff branch from 41849c5 to 7d55799 Compare November 17, 2026 08:52
@dan-petty

Copy link
Copy Markdown
Owner Author

Follow-up: changed-line coverage

New head 7d55799cc, rebased onto origin/main (which now holds #6092).

Failure Cause Fix
Tests & Coverage, Changed-Line Coverage: 87%, under the floor of 90% (stage_change.py lines 771-772, 790, 794, 797-799, 829, 841) No test reached these branches of is_tool_setting_diff: an empty diff, a file other than pyproject.toml, a table header that only the base file holds, an added table header, a comment or blank line, and the no-newline marker. The step did not run before because the test shards failed first. test_a_pyproject_diff_is_a_tool_setting_only_when_every_changed_key_is_under_a_tool_table gives 8 cases, each with the answer it must get. The floor did not change.

Finding: the classifier resolves a removed line only from the base text. With no base text, a removed key under [tool.*] counts as outside a tool table, so the change keeps its spec delta. That is the safe answer, and the test gives the base text for that case.

Proof: the eval tests give 156 passed, and --cov=devops_cli.roadmap.stage.stage_change reports no missing line from 762 to 848. The rows test-tree, typecheck, lint and format pass.

@dan-petty
dan-petty merged commit 0a787eb into main Nov 17, 2026
23 checks passed
@dan-petty
dan-petty deleted the fix/3491-pyproject-tool-diff branch November 17, 2026 09:02
dan-petty pushed a commit that referenced this pull request Nov 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.171.0](v0.170.0...v0.171.0)
(2026-11-17)


### Features

* **roadmap:** Run review scanners in the runner pod
([#6114](#6114))
([ddde85a](ddde85a))
* **service:** Roll the Service with a surge release
([#6146](#6146))
([a459b65](a459b65))


### Bug Fixes

* **k8s:** Run kube-linter on the Argo CD builds in CI
([#6112](#6112))
([dba90f1](dba90f1)),
closes [#6068](#6068)
* **k8s:** Take the k8s area of the config-read list to zero
([#6124](#6124))
([0857ee5](0857ee5)),
closes [#6119](#6119)
* **roadmap:** judge a pyproject tool setting by its diff
([#6089](#6089))
([0a787eb](0a787eb)),
closes [#3491](#3491)
* **roadmap:** Name both command registration forms
([#6148](#6148))
([0d3b1e1](0d3b1e1))
* **roadmap:** Read the files of a named pull request
([#6144](#6144))
([5a29fed](5a29fed))
* **roadmap:** refuse a placeholder group title in a plan
([#6092](#6092))
([cfd820b](cfd820b))
* **service:** the metrics row sends too many counted requests
([#6095](#6095))
([b3fc5dc](b3fc5dc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(roadmap): judge a pyproject tool setting by its diff

1 participant