fix(#2375): pr_is_open state check at submission + atomic fetched_sha INSERT
Two hardening items from argus's review of #2374: 1. PR state check at submission: - Add `pr_is_open(repo, pr)` to forge/pr_merge.rs using `repo_get_pull_request` + `StateType` — early error if the PR is already closed or merged instead of queuing a card that fails later - Call it in `submit_merge_config_pr` before fetching the head sha 2. Atomic fetched_sha INSERT: - Add `fetched_sha: Option<&str>` to `Approvals::submit_kind` so the sha can be included in the INSERT rather than a follow-up UPDATE - MergeConfigPr already knows the sha before inserting the row (pr_head_sha runs first) → pass `Some(&sha)`, drop the separate `set_fetched_sha` call → truly atomic - ApplyCommit still needs two writes (sha resolved by git_fetch_to_tag after the row exists) → pass `None`, `set_fetched_sha` unchanged - All other callers (InitConfig, Spawn, UpdateMetaInputs, SchedulePrompt) pass `None` — no behavioural change - Add `fetched_sha_in_insert_is_readable_via_get` test covering the MergeConfigPr path
This commit is contained in:
parent
d39d05b0b3
commit
96eda4ed6b
7 changed files with 102 additions and 15 deletions
|
|
@ -10,7 +10,7 @@ mod users;
|
|||
|
||||
pub use pr_merge::{
|
||||
ForgeMergeError, config_repo, fetch_pr_head_into_applied, ff_push_to_main, mark_pr_merged,
|
||||
pr_head_sha,
|
||||
pr_head_sha, pr_is_open,
|
||||
};
|
||||
pub use repos::{
|
||||
create_agent_repo, ensure_config_repo, ensure_knowledge_repo, ensure_meta_remote, ensure_repo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue