feat: connect selector-based merge request flow

This commit is contained in:
2026-08-18 08:06:02 +09:00
parent 9a548d2b5e
commit f86ae6d52f
6 changed files with 45 additions and 16 deletions
+10 -9
View File
@@ -24,7 +24,7 @@ pub fn builtin_flow_source(slug: &str) -> Option<BuiltinFlowSource> {
match slug {
CODER_REVIEW_FLOW_SLUG => Some(BuiltinFlowSource {
slug: CODER_REVIEW_FLOW_SLUG,
revision: 2,
revision: 3,
path: "builtin/flows/coder-review.dcdl",
content: CODER_REVIEW_FLOW_SOURCE,
}),
@@ -35,7 +35,7 @@ pub fn builtin_flow_source(slug: &str) -> Option<BuiltinFlowSource> {
pub fn builtin_flow_sources() -> &'static [BuiltinFlowSource] {
const SOURCES: &[BuiltinFlowSource] = &[BuiltinFlowSource {
slug: CODER_REVIEW_FLOW_SLUG,
revision: 2,
revision: 3,
path: "builtin/flows/coder-review.dcdl",
content: CODER_REVIEW_FLOW_SOURCE,
}];
@@ -69,20 +69,21 @@ mod tests {
}
#[test]
fn coder_review_starts_on_a_ticket_branch_and_requires_committed_review_evidence() {
fn coder_review_publishes_immutable_source_before_review_and_preserves_fresh_review() {
let source =
builtin_flow_source(CODER_REVIEW_FLOW_SLUG).expect("coder-review Flow must exist");
for required in [
"detached HEAD",
"Workdir Git state",
"work/<ticket-id>-<slug>",
"explicitly authorized",
"git add",
"git commit",
"Workdir is clean",
"current head commit",
"same Ticket work branch",
"new revision",
"Publish the committed source ref",
"verify that the remote selector resolves to the exact local HEAD",
"immutable Merge Request",
"current Merge Request subject",
"fresh read-only Reviewer child",
"do not update the target selector",
] {
assert!(
source.content.contains(required),
+22
View File
@@ -665,9 +665,31 @@ mod tests {
"Do not spawn, restore, assign, or route work to Backend/Runtime Reviewer Workers"
));
assert!(prompt.contains("never compensate by creating an independent Reviewer Worker"));
assert!(prompt.contains("durable `ready -> queued` transition delegates"));
assert!(prompt.contains("use the Ticket repository `origin` transport"));
assert!(prompt.contains("guarded non-force push"));
assert!(prompt.contains("Never mutate a Server-side repository path"));
assert!(prompt.contains("If the repository push succeeds but completion recording fails"));
assert!(prompt.contains("closes the current assignment atomically"));
assert!(!prompt.contains("sibling Coder/Reviewer Workers"));
}
#[test]
fn coder_and_reviewer_roles_preserve_immutable_subject_authority() {
let catalog = PromptCatalog::builtins_only().unwrap();
let coder = &catalog.projection.templates["role.coder"];
assert!(coder.contains("publish the committed source selector without force"));
assert!(coder.contains("exact local `HEAD`"));
assert!(coder.contains("keep that source ref immutable"));
assert!(coder.contains("Do not update the target selector"));
let reviewer = &catalog.projection.templates["role.reviewer"];
assert!(reviewer.contains("never as a supplied verdict"));
assert!(reviewer.contains("ReviewRequested.subject_ref"));
assert!(reviewer.contains("do not merge"));
assert!(reviewer.contains("update a repository ref"));
}
#[test]
fn existing_internal_prompt_render_contracts_are_preserved() {
let catalog = PromptCatalog::builtins_only().unwrap();