feat: close completed delegated parent from Filed review (Closes #925)
CI / lint (pull_request) Successful in 2m5s
CI / build-release (pull_request) Successful in 6s
CI / browser-journey (pull_request) Successful in 1m4s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy committed 2026-08-16 00:58:39 +00:00
1 parent 40b124bc2c
commit 05b2f769e4
3 files changed
+116 -17

No files matched your search

+62 -2
View File
@@ -129,6 +129,7 @@ process.stdout.write(JSON.stringify({{relationship, unrelated, mismatch, inciden
},
"taskIndex": 0,
"alreadyCompleted": False,
"checklistComplete": False,
},
"unrelated": None,
"mismatch": None,
@@ -154,15 +155,72 @@ process.stdout.write(JSON.stringify({{changed, repeated}}));
"body": "Plan\r\n - [x] [Ship mobile flow](https://forge.example/git/stackchain/dashboard/issues/44)\r\n- [ ] Duplicate words\r\n- [x] [Already](https://forge.example/issues/9)",
"taskIndex": 0,
"alreadyCompleted": False,
"checklistComplete": False,
},
"repeated": {
"body": "Plan\r\n - [x] [Ship mobile flow](https://forge.example/git/stackchain/dashboard/issues/44)\r\n- [ ] Duplicate words\r\n- [x] [Already](https://forge.example/issues/9)",
"taskIndex": 0,
"alreadyCompleted": True,
"checklistComplete": False,
},
}
def test_delegated_parent_completion_reports_when_the_final_task_is_complete():
script = f"""
const sheet = require({json.dumps(str(ISSUE_SHEET))});
const childUrl = 'https://forge.example/git/stackchain/dashboard/issues/44';
const pending = sheet.completeDelegatedParentTask('- [ ] [Ship](' + childUrl + ')', childUrl);
const already = sheet.completeDelegatedParentTask('- [x] [Ship](' + childUrl + ')', childUrl);
process.stdout.write(JSON.stringify({{pending, already}}));
"""
completed = subprocess.run(["node", "-e", script], capture_output=True, text=True)
assert completed.returncode == 0, completed.stderr
result = json.loads(completed.stdout)
assert result["pending"]["checklistComplete"] is True
assert result["already"]["checklistComplete"] is True
def test_final_delegated_parent_update_closes_before_acknowledgement_can_continue():
script = f"""
const finish = require({json.dumps(str(ISSUE_SHEET))}).finishDelegatedParentReview;
const childUrl = 'https://forge.example/git/stackchain/dashboard/issues/44';
const calls = [];
(async () => {{
const changed = await finish({{
relationship:{{alreadyCompleted:false, checklistComplete:true}},
parentItem:{{repository:'stackchain/dashboard', number:12}},
parentDetail:{{title:'Launch', body:'- [ ] [Ship](' + childUrl + ')', updated_at:'rev-1'}},
childUrl,
updateContent:async (_item, payload) => calls.push(['update', payload.body]),
closeParent:async () => calls.push(['close']),
}});
const already = await finish({{
relationship:{{alreadyCompleted:true, checklistComplete:true}},
parentItem:{{repository:'stackchain/dashboard', number:12}},
parentDetail:{{title:'Launch', body:'- [x] [Ship](' + childUrl + ')', updated_at:'rev-2'}},
childUrl,
updateContent:async () => calls.push(['duplicate-update']),
closeParent:async () => calls.push(['retry-close']),
}});
process.stdout.write(JSON.stringify({{changed, already, calls}}));
}})().catch(error => {{ console.error(error); process.exit(1); }});
"""
completed = subprocess.run(["node", "-e", script], capture_output=True, text=True)
assert completed.returncode == 0, completed.stderr
assert json.loads(completed.stdout) == {
"changed": {"updated": True, "closed": True},
"already": {"updated": False, "closed": True},
"calls": [
["update", "- [x] [Ship](https://forge.example/git/stackchain/dashboard/issues/44)"],
["close"],
["retry-close"],
],
}
@pytest.mark.anyio
async def test_completed_filed_review_offers_parent_completion_before_acknowledgement():
markup = (Path(__file__).parents[1] / "frontend" / "index.html").read_text()
@@ -174,8 +232,10 @@ async def test_completed_filed_review_offers_parent_completion_before_acknowledg
handler = source.split("qs('#complete-parent-and-acknowledge').addEventListener('click'", 1)[1].split(
"function renderCheckSection", 1
)[0]
assert "await issueController.updateContent" in handler
assert handler.index("await issueController.updateContent") < handler.index("acknowledgeCompletedFiled")
assert "window.confirm" in handler
assert "await issueController.finishDelegatedParentReview" in handler
assert handler.index("await issueController.finishDelegatedParentReview") < handler.index("acknowledgeCompletedFiled")
assert "Complete & close parent · acknowledge" in source
def test_completed_filed_acknowledgement_survives_refresh_until_upstream_update():