Skip to content

Commit 0b83fe7

Browse files
authored
upstreaming: repair legacy scopes by exact path (#4994)
1 parent ad49c2d commit 0b83fe7

10 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎.github/workflows/upstreaming-worker.lock.yml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/upstreaming-worker.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ change without asking the reviewer to use command syntax. The trusted publisher
319319
will admit only the exact changed paths in this repair and persist verified
320320
additions to contribution scope. This does not permit globs or unrelated files.
321321
Inline review comment paths are present in the human-relay evidence data.
322+
For contributions whose dossier predates mandatory path coverage,
323+
`legacy_scope_extension` is true during repair. CI evidence may then justify an
324+
additional exact file under the same rules. This compatibility path is absent
325+
for new, complete dossiers.
322326

323327
## Mandatory change-history research
324328

‎SESSIONLOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@
2424
- Addressed PR #4989 review feedback by moving the status-page generator into `upstreaming/`, invoking it through `uv run`, and adding focused rendering coverage.
2525
- Fixed review and CI reconciliation so pending human feedback survives head changes, every repair carries and acknowledges all feedback evidence, `fix_needed` cannot be overwritten before dispatch, and any executed build or test failure returns handoff to automated development repair.
2626
- Replaced the rejected workflow-glob approach with complete dossier path coverage and natural-language review scope extension: human-relay-backed repairs may add exact changed paths, which trusted publication verifies and persists without requiring command syntax.
27+
- Added an exact-path repair compatibility flag for live contributions whose dossiers predate mandatory path coverage; new dossiers are marked coverage-complete and cannot use the legacy allowance.

‎upstreaming/INTEGRATION.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ later asks in ordinary natural language for a change that requires another
197197
file, the human-relay-backed repair may identify and change that additional
198198
exact path without command syntax. The trusted publisher admits only exact
199199
paths actually changed by that repair, applies all existing content and workflow
200-
safety checks, and persists the verified paths into contribution scope.
200+
safety checks, and persists the verified paths into contribution scope. Live
201+
contributions whose dossiers predate mandatory path coverage receive the same
202+
exact-path compatibility only during repair; new dossiers are marked complete
203+
and cannot use that legacy allowance.
201204

202205
Previously merged implementation:
203206

‎upstreaming/fork_publish.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def publish(*, record: dict, task: dict, proposal: dict, mbox: bytes, token: str
235235
outside_scope = sorted(path for path in claimed if not any(
236236
fnmatch.fnmatchcase(path, allowed) for allowed in scope.allowed_globs))
237237
if outside_scope:
238-
if not task.get("review_scope_extension"):
238+
if not (task.get("review_scope_extension") or task.get("legacy_scope_extension")):
239239
return Outcome("rejected", f"proposal changes files outside admitted scope: {outside_scope}",
240240
candidate=cand, failure_class="validation")
241241
if any(any(ch in path for ch in "*?[]") for path in outside_scope):

‎upstreaming/reconcile.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def apply_publication(rec: dict, outcome: dict, *, now: str, policy: dict | None
282282
new["activity"] = "idle"
283283
new["admission_class"] = dossier["proposal"]["admission_class"]
284284
new["scope_paths"] = list(dossier["proposal"]["allowed_paths"])
285+
new["scope_coverage_complete"] = True
285286
new["pending_human_action"] = None
286287
new["revision"] += 1
287288
staged.append(("events", lifecycle._event(rec, new, "dossier_develop", "observation",

‎upstreaming/schemas/contribution.schema.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,9 @@
982982
}
983983
]
984984
},
985+
"scope_coverage_complete": {
986+
"type": "boolean"
987+
},
985988
"scope_paths": {
986989
"anyOf": [
987990
{

‎upstreaming/tests/test_dossier_gate.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ def test_authorized_human_relay_enables_natural_review_scope_extension(self):
201201
ordinary = work.node(request, rec, control_repo_id="7", allowed_paths=["build.yml"],
202202
context={"reason_evidence": [{"evidence_id": "ci-1", "kind": "ci"}]})
203203
self.assertFalse(ordinary["payload"]["review_scope_extension"])
204+
self.assertTrue(ordinary["payload"]["legacy_scope_extension"])
205+
rec["scope_coverage_complete"] = True
206+
complete = work.node(request, rec, control_repo_id="7", allowed_paths=["build.yml"],
207+
context={"reason_evidence": [{"evidence_id": "ci-1", "kind": "ci"}]})
208+
self.assertFalse(complete["payload"]["legacy_scope_extension"])
204209

205210
def test_full_description_url_and_links_frozen_into_work(self):
206211
body = "### Additional context\n\nhttps://github.com/example/proj/pull/31488\n" + "user context\n" * 500

‎upstreaming/tests/test_observation.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ def test_investigation_outcome_auto_admits_development(self):
404404
self.assertEqual((final["phase"], final["activity"], final["revision"]), ("provisioning", "waiting_capacity", 1))
405405
self.assertEqual(final["admission_class"], "configuration_integration")
406406
self.assertEqual(final["scope_paths"], [".github/workflows/*", "README.rst"])
407+
self.assertTrue(final["scope_coverage_complete"])
407408
self.assertIsNone(final["pending_human_action"])
408409
self.assertIsNone(final["proposal_artifact"])
409410
self.assertEqual(len(out.report["provision_requests"]), 1)

‎upstreaming/work.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def payload(request: dict, record: dict, *, control_repo_id: str, allowed_paths:
8888
"allowed_paths": allowed_paths,
8989
"review_scope_extension": task in ("development_repair", "upstream_revision") and any(
9090
item.get("kind") == "human_relay" for item in context.get("reason_evidence") or []),
91+
"legacy_scope_extension": task in ("development_repair", "upstream_revision")
92+
and record.get("scope_coverage_complete") is not True,
9193
"distributions": record.get("distributions") or [],
9294
"admission_class": record.get("admission_class"),
9395
"reason_ids": request.get("reason_ids") or [],

0 commit comments

Comments
 (0)