Skip to content

Commit 00a52ea

Browse files
Name the closing-issue trust check for its decision
Rename closing_issue_use/ClosingIssueUse to closing_issue_trust/UntrustedClosingIssue, parallel to issue_trust/UntrustedIssue, and is_untrusted_edit to is_untrusted_closing_issue now that an untrusted author with no edit also stops the run. Index closing_issue_trust and its ClosingIssues/review_input enforcement points in docs/code-navigation.md. No behaviour change.
1 parent a2ba006 commit 00a52ea

6 files changed

Lines changed: 35 additions & 29 deletions

File tree

‎docs/code-navigation.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Start with the issue's terms in `GLOSSARY.md`, then use this index to find their
3434
| Session prompt, Factory skills | `src/prompt.rs`; `src/skills.rs`; `skills/` | `src/skills/tests.rs`, `tests/packaging.rs`, `tests/ui_evidence.rs` |
3535
| Visual evidence | `skills/thirdshift-verify-ui/`, `skills/thirdshift-pr/` — exploration, walkthrough recording and pre-upload validation; `src/prompt.rs` — `open_pr_visual_evidence`, `spec_review`, `TicketScope`; `src/setup/visual_evidence.rs` — `probe`, `install`; `.agents/skills/create-verification-skill/`, `.agents/skills/maintain-verification-skill/`, `.agents/skills/verify-console/`, `.agents/skills/verify-site/` | `tests/ui_evidence.rs`, `tests/setup.rs`, `tests/spec_run.rs`, `tests/process/land_tickets.rs`, `site/tests/docs.test.cjs` |
3636
| Release run | `src/release.rs` — versioned and Pass admission, local lock, origin reservation and isolated Git repository; `src/release/recovery.rs` — unfinished-release discovery, publication verification, exact-bump trees and re-cuts; `src/release/workflow.rs` — PR checks, one in-process Fix, summary refresh, tag/publication/merge ordering; `src/release/controls.rs` — optional in-process Experiment and terminal summary review; `src/release/selection.rs` — shipped-path filter and green first-parent candidate selection; `src/release/summary.rs` — sandboxed recorded summary Session; `src/github/release.rs` — release transport; `src/prompt.rs` — compiled prompts | `tests/release.rs` (end-to-end Command against a bare origin with fake `gh` and Harness) and `tests/release/` (`native.rs` command-line contract, `checks.rs` targeted Fix, `recovery.rs`, `ancestry.rs`, `lifetime.rs`, `experiments.rs`, `summaries.rs`); `tests/experiments/release.rs` (real release Experiment); lifecycle: `src/logs/reading/run_kinds_tests.rs`; Console: `tests/console/start.rs`, `console/tests/start.test.cjs` |
37-
| Trusted account, the issue a session gets | `src/trust.rs` — `issue_trust`, `ticket_trust`, `untrusted_edit`, `untrusted_edit_since_ready` over `Reads`; the GitHub adapter's trust reads, `src/github/trust.rs`; `src/github/session_issue.rs` — `issue_for_session`; `src/delivery.rs` — `hand_over_issue` | Inline tests, including `src/trust.rs` and `src/prompt.rs`; `tests/fresh_run.rs`, `tests/pickup_run.rs` |
37+
| Trusted account, the issue a session gets | `src/trust.rs` — `issue_trust`, `ticket_trust`, `closing_issue_trust`, `untrusted_edit`, `untrusted_edit_since_ready` over `Reads`; the GitHub adapter's trust reads, `src/github/trust.rs`; `src/github/session_issue.rs` — `issue_for_session`; `src/github/review.rs` — `review_input`; `src/delivery.rs` — `hand_over_issue`, `ClosingIssues` | Inline tests, including `src/trust.rs` and `src/prompt.rs`; `tests/fresh_run.rs`, `tests/pickup_run.rs`, `tests/review_run.rs`, `tests/fix_run.rs` |
3838
| Session trace, Resume | `src/session.rs` and `src/session/`; `src/session/kind.rs` — `Kind`, `Logged`: every session kind, its Session-trace token, the Command record stage it enters and its `--session` rule (`selects`); `src/processes.rs` — `execute_steps`: killed-work context across Custom process Steps | `src/session/execution_tests.rs`, inline tests in `src/session/kind.rs`, `tests/background_work.rs`, `tests/process.rs` |
3939
| Private Session, Scoring Grader, auxiliary analysis | `src/session/private.rs` — `run_scoring` and `run`: one sandbox, launch, recording and completion lifecycle; closed profiles retain Scoring's ordinary unscoped invocation and captured Command, and auxiliary analysis's scoped Trial invocation, caps, deadline and retained artifacts; callers own Model selection, packets and response validation | `src/session/private/tests.rs`, `tests/scoring/grading.rs`, `tests/experiments/model_graders.rs`, `tests/bug_origins.rs` |
4040
| OTLP JSON Lines (Session-trace file format) | `src/otlp_jsonl.rs` — application-independent requests, `Writer`, `Reader`; `src/otlp_jsonl/value.rs` — attribute values and byte encoding | `src/otlp_jsonl/tests.rs`; official examples and local Collector config in `src/otlp_jsonl/fixtures/` |

‎src/delivery.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,12 @@ fn run_checked<T, S>(
654654
let interrupted = interrupt::requested();
655655
let error = interrupted_or(error, interrupted);
656656
// Review Self-merge runs after Delivery has already left the PR
657-
// ready for review: an untrusted closing-issue edit stops
657+
// ready for review: an untrusted linked closing issue stops
658658
// cleanly without drafting the PR or pushing dirty/unreviewed
659659
// Repair work.
660-
if context.is_review_self_merge() && ClosingIssues::is_untrusted_edit(&error) {
660+
if context.is_review_self_merge()
661+
&& ClosingIssues::is_untrusted_closing_issue(&error)
662+
{
661663
let stopped_at = stopped_at(tracker, &error);
662664
let mut recovery = Recovery::new(stopped_at, Preservation::None);
663665
recovery.record_worktree(worktree.path().to_path_buf());
@@ -1233,7 +1235,7 @@ impl ClosingIssues {
12331235
/// An untrusted edit since the run started, or a linked closing issue that
12341236
/// must not be used at all. Either stops the run without drafting the
12351237
/// pull request or posting from the untrusted text.
1236-
pub(crate) fn is_untrusted_edit(error: &anyhow::Error) -> bool {
1238+
pub(crate) fn is_untrusted_closing_issue(error: &anyhow::Error) -> bool {
12371239
error
12381240
.chain()
12391241
.any(|layer| layer.is::<UntrustedEdit>() || layer.is::<trust::UnusableClosingIssue>())
@@ -1293,7 +1295,7 @@ pub(crate) fn no_untrusted_edit_since(
12931295
/// is not a Trusted account, or an account that is not one edited its title
12941296
/// or body.
12951297
fn refuse_unusable_closing_issue(issue: &IssueUrl) -> Result<()> {
1296-
match trust::closing_issue_use(&GitHub::new(), issue)? {
1298+
match trust::closing_issue_trust(&GitHub::new(), issue)? {
12971299
Some(why) => Err(trust::UnusableClosingIssue::new(issue.number, why).into()),
12981300
None => Ok(()),
12991301
}
@@ -1620,7 +1622,7 @@ impl RunOutside<'_> {
16201622
fn finish_session_or_fix<T>(&mut self, result: Result<T>) -> Result<()> {
16211623
let checked = self.check_closing_issues();
16221624
match (result, checked) {
1623-
(_, Err(err)) if ClosingIssues::is_untrusted_edit(&err) => return Err(err),
1625+
(_, Err(err)) if ClosingIssues::is_untrusted_closing_issue(&err) => return Err(err),
16241626
(Err(err), _) => return Err(err),
16251627
(Ok(_), Err(err)) => return Err(err),
16261628
(Ok(_), Ok(())) => {}

‎src/github/review.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl GitHub {
418418
);
419419
let closing_issues = self.closing_issues(pr)?;
420420
for issue in &closing_issues {
421-
if let Some(why) = crate::trust::closing_issue_use(self, issue)? {
421+
if let Some(why) = crate::trust::closing_issue_trust(self, issue)? {
422422
return Err(crate::trust::UnusableClosingIssue::new(issue.number, why).into());
423423
}
424424
}

‎src/processes/review.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl ReviewProcess {
486486
last_log = log.clone();
487487
let review = match review {
488488
Err(error)
489-
if crate::delivery::ClosingIssues::is_untrusted_edit(
489+
if crate::delivery::ClosingIssues::is_untrusted_closing_issue(
490490
&error,
491491
) =>
492492
{

‎src/processes/review/delivery.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl Delivery<'_> {
5959
};
6060
if readiness
6161
.as_ref()
62-
.is_err_and(crate::delivery::ClosingIssues::is_untrusted_edit)
62+
.is_err_and(crate::delivery::ClosingIssues::is_untrusted_closing_issue)
6363
{
6464
return readiness;
6565
}

‎src/trust.rs‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ impl fmt::Display for IssueText {
5757

5858
/// Why a linked closing issue must not be handed to a session.
5959
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60-
pub enum ClosingIssueUse {
60+
pub enum UntrustedClosingIssue {
6161
Author,
6262
Edited(IssueText),
6363
}
6464

65-
impl fmt::Display for ClosingIssueUse {
65+
impl fmt::Display for UntrustedClosingIssue {
6666
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6767
match self {
6868
Self::Author => f.write_str("author is not a Trusted account"),
@@ -80,11 +80,11 @@ impl fmt::Display for ClosingIssueUse {
8080
#[derive(Debug)]
8181
pub struct UnusableClosingIssue {
8282
number: u64,
83-
why: ClosingIssueUse,
83+
why: UntrustedClosingIssue,
8484
}
8585

8686
impl UnusableClosingIssue {
87-
pub(crate) fn new(number: u64, why: ClosingIssueUse) -> Self {
87+
pub(crate) fn new(number: u64, why: UntrustedClosingIssue) -> Self {
8888
Self { number, why }
8989
}
9090
}
@@ -171,18 +171,21 @@ pub fn ticket_trust(
171171
.map(UntrustedIssue::Edited))
172172
}
173173

174-
/// Whether `issue` may be used as a linked closing issue. Its author must be
175-
/// a Trusted account, and no account that is not one may have edited its
176-
/// title or body. The author is read first; edits are read only after that
177-
/// passes, body before title.
178-
pub fn closing_issue_use(reads: &impl Reads, issue: &IssueUrl) -> Result<Option<ClosingIssueUse>> {
174+
/// Check a linked closing issue: its author must be a Trusted account, and
175+
/// no account that is not one may have edited its title or body. The author
176+
/// is read first; edits are read only after that passes, body before title.
177+
/// `None` means the issue may be used.
178+
pub fn closing_issue_trust(
179+
reads: &impl Reads,
180+
issue: &IssueUrl,
181+
) -> Result<Option<UntrustedClosingIssue>> {
179182
let mut check = Check::new(reads);
180183
if !check.trusted_author(issue)? {
181-
return Ok(Some(ClosingIssueUse::Author));
184+
return Ok(Some(UntrustedClosingIssue::Author));
182185
}
183186
Ok(check
184187
.untrusted_edit(issue, None)?
185-
.map(ClosingIssueUse::Edited))
188+
.map(UntrustedClosingIssue::Edited))
186189
}
187190

188191
/// The first edit to `issue`'s body or title made after `since`, or ever
@@ -704,8 +707,8 @@ mod tests {
704707
});
705708

706709
assert_eq!(
707-
closing_issue_use(&reads, &url(ISSUE)).unwrap(),
708-
Some(ClosingIssueUse::Author)
710+
closing_issue_trust(&reads, &url(ISSUE)).unwrap(),
711+
Some(UntrustedClosingIssue::Author)
709712
);
710713
assert!(reads.edits_read.borrow().is_empty());
711714
}
@@ -718,20 +721,21 @@ mod tests {
718721
..Issue::default()
719722
});
720723
assert_eq!(
721-
closing_issue_use(&body, &url(ISSUE)).unwrap(),
722-
Some(ClosingIssueUse::Edited(IssueText::Body))
724+
closing_issue_trust(&body, &url(ISSUE)).unwrap(),
725+
Some(UntrustedClosingIssue::Edited(IssueText::Body))
723726
);
724727

725728
let title = InMemory::with(Issue {
726729
title_edits: vec![unknown(1)],
727730
..Issue::default()
728731
});
729732
assert_eq!(
730-
closing_issue_use(&title, &url(ISSUE)).unwrap(),
731-
Some(ClosingIssueUse::Edited(IssueText::Title))
733+
closing_issue_trust(&title, &url(ISSUE)).unwrap(),
734+
Some(UntrustedClosingIssue::Edited(IssueText::Title))
732735
);
733736
assert_eq!(
734-
UnusableClosingIssue::new(ISSUE, ClosingIssueUse::Edited(IssueText::Body)).to_string(),
737+
UnusableClosingIssue::new(ISSUE, UntrustedClosingIssue::Edited(IssueText::Body))
738+
.to_string(),
735739
"#7 body edited by an account that is not a Trusted account; starting no further session"
736740
);
737741
}
@@ -745,7 +749,7 @@ mod tests {
745749
..Issue::default()
746750
});
747751

748-
assert_eq!(closing_issue_use(&reads, &url(ISSUE)).unwrap(), None);
752+
assert_eq!(closing_issue_trust(&reads, &url(ISSUE)).unwrap(), None);
749753
}
750754

751755
#[test]
@@ -755,7 +759,7 @@ mod tests {
755759
..Issue::default()
756760
});
757761

758-
let error = closing_issue_use(&reads, &url(ISSUE)).unwrap_err();
762+
let error = closing_issue_trust(&reads, &url(ISSUE)).unwrap_err();
759763
assert!(
760764
format!("{error:#}").contains("could not check Trusted account membership"),
761765
"{error:#}"

0 commit comments

Comments
 (0)