flow: require coder work branch commits
This commit is contained in:
@@ -25,17 +25,6 @@ Workerの状態から純粋に再現可能で、且つ揮発性の無い操作
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Git操作
|
|
||||||
|
|
||||||
明示的に指示されない限り、読み取り以外の操作は控えること。
|
|
||||||
基本はworktree上の一時的なブランチでコミットを重ね、メインブランチに取り込む運用をしている。
|
|
||||||
Orchestrator の cwd が orchestration 用ブランチ/worktree の場合、通常作業では親ブランチの dirty state を気にしない。
|
|
||||||
コミットメッセージは適当に`<prefix>: *簡潔な1行*`で書いている。
|
|
||||||
|
|
||||||
外部の参考プロジェクトは必要に応じてローカルの外部 checkout からReadすること。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 検証
|
## 検証
|
||||||
|
|
||||||
開発中は、変更した契約を証明する最小の target / filter から実行する。
|
開発中は、変更した契約を証明する最小の target / filter から実行する。
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ pub fn builtin_flow_source(slug: &str) -> Option<BuiltinFlowSource> {
|
|||||||
match slug {
|
match slug {
|
||||||
CODER_REVIEW_FLOW_SLUG => Some(BuiltinFlowSource {
|
CODER_REVIEW_FLOW_SLUG => Some(BuiltinFlowSource {
|
||||||
slug: CODER_REVIEW_FLOW_SLUG,
|
slug: CODER_REVIEW_FLOW_SLUG,
|
||||||
revision: 1,
|
revision: 2,
|
||||||
path: "builtin/flows/coder-review.dcdl",
|
path: "builtin/flows/coder-review.dcdl",
|
||||||
content: CODER_REVIEW_FLOW_SOURCE,
|
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] {
|
pub fn builtin_flow_sources() -> &'static [BuiltinFlowSource] {
|
||||||
const SOURCES: &[BuiltinFlowSource] = &[BuiltinFlowSource {
|
const SOURCES: &[BuiltinFlowSource] = &[BuiltinFlowSource {
|
||||||
slug: CODER_REVIEW_FLOW_SLUG,
|
slug: CODER_REVIEW_FLOW_SLUG,
|
||||||
revision: 1,
|
revision: 2,
|
||||||
path: "builtin/flows/coder-review.dcdl",
|
path: "builtin/flows/coder-review.dcdl",
|
||||||
content: CODER_REVIEW_FLOW_SOURCE,
|
content: CODER_REVIEW_FLOW_SOURCE,
|
||||||
}];
|
}];
|
||||||
@@ -61,9 +61,32 @@ mod tests {
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
assert_eq!(definition.name, source.slug);
|
assert_eq!(definition.name, source.slug);
|
||||||
assert_eq!(
|
let selected =
|
||||||
builtin_flow_source(source.slug).map(|item| item.content),
|
builtin_flow_source(source.slug).expect("builtin Flow must be selectable");
|
||||||
Some(source.content)
|
assert_eq!(selected.content, source.content);
|
||||||
|
assert_eq!(selected.revision, source.revision);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn coder_review_starts_on_a_ticket_branch_and_requires_committed_review_evidence() {
|
||||||
|
let source =
|
||||||
|
builtin_flow_source(CODER_REVIEW_FLOW_SLUG).expect("coder-review Flow must exist");
|
||||||
|
|
||||||
|
for required in [
|
||||||
|
"detached HEAD",
|
||||||
|
"work/<ticket-id>-<slug>",
|
||||||
|
"explicitly authorized",
|
||||||
|
"git add",
|
||||||
|
"git commit",
|
||||||
|
"Workdir is clean",
|
||||||
|
"current head commit",
|
||||||
|
"same Ticket work branch",
|
||||||
|
"new revision",
|
||||||
|
] {
|
||||||
|
assert!(
|
||||||
|
source.content.contains(required),
|
||||||
|
"coder-review Flow must preserve branch/commit policy token {required:?}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6389,7 +6389,10 @@ mod build_summary_prompt_tests {
|
|||||||
.lock()
|
.lock()
|
||||||
.expect("flow runtime state lock") = Some(state.clone());
|
.expect("flow runtime state lock") = Some(state.clone());
|
||||||
|
|
||||||
assert!(matches!(segments[0], Segment::Text { .. }));
|
assert_eq!(
|
||||||
|
segments[0],
|
||||||
|
Segment::text("Implement the Ticket and request review.")
|
||||||
|
);
|
||||||
assert_eq!(segments[1], Segment::text("Implement Ticket 00001"));
|
assert_eq!(segments[1], Segment::text("Implement Ticket 00001"));
|
||||||
assert_eq!(state.instance.definition_revision, 3);
|
assert_eq!(state.instance.definition_revision, 3);
|
||||||
assert_eq!(state.instance.current_state.as_str(), "implement");
|
assert_eq!(state.instance.current_state.as_str(), "implement");
|
||||||
|
|||||||
@@ -10281,7 +10281,7 @@ mod tests {
|
|||||||
assert_eq!(builtin.definition.name, "coder-review");
|
assert_eq!(builtin.definition.name, "coder-review");
|
||||||
assert_eq!(builtin.selector.to_string(), "builtin:coder-review");
|
assert_eq!(builtin.selector.to_string(), "builtin:coder-review");
|
||||||
assert_eq!(builtin.flow_id, "builtin:coder-review");
|
assert_eq!(builtin.flow_id, "builtin:coder-review");
|
||||||
assert_eq!(builtin.revision, 1);
|
assert_eq!(builtin.revision, 2);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
api.store
|
api.store
|
||||||
.list_flow_sources(&api.config.workspace_id)
|
.list_flow_sources(&api.config.workspace_id)
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
states = {
|
states = {
|
||||||
implement = {
|
implement = {
|
||||||
instructions = "Implement the requested Ticket scope, run the narrow and dependent validation required by the changed contracts, and record the concrete repository/test evidence. When the implementation is ready for independent review, request a Flow transition.";
|
instructions = "Before editing, inspect the assigned Workdir's Git state. A newly delegated Git Workdir normally starts at a detached HEAD. If HEAD is detached, create and switch to a local branch named `work/<ticket-id>-<slug>`, using the canonical Ticket id and a short lowercase kebab-case slug derived from the Ticket title or implementation scope. If the Workdir is already on a suitable work branch after restore, keep it. Never delete, reset, or overwrite an existing branch to resolve a name collision; choose a concise collision-free suffix and report the actual branch. For this assigned Ticket Workdir, you are explicitly authorized to create or switch the local work branch and to use `git add` and `git commit`. Commit coherent, validated implementation slices while working; do not push, merge, force-rewrite a submitted revision, delete branches, or discard pre-existing changes. Implement the requested Ticket scope, run the narrow and dependent validation required by the changed contracts, and record the concrete repository/test evidence. Before requesting review, commit all intended changes and confirm that the Workdir is clean.";
|
||||||
transitions = {
|
transitions = {
|
||||||
review = {
|
review = {
|
||||||
target = "review";
|
target = "review";
|
||||||
condition = "The requested implementation is present, the relevant validation has completed, and there is enough bounded repository and session evidence for an independent Reviewer to evaluate the change.";
|
condition = "The requested implementation is present on the Ticket work branch, all intended changes are committed, the Workdir is clean, the relevant validation has completed, and there is enough bounded repository and session evidence for an independent Reviewer to evaluate the current head commit.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
fix = {
|
fix = {
|
||||||
instructions = "Resolve every open Reviewer finding, rerun the validation affected by the fixes, and preserve concrete evidence. Do not claim approval from the prior request_changes review. When the corrected implementation is ready for a new independent review, request a Flow transition.";
|
instructions = "Resolve every open Reviewer finding on the same Ticket work branch, rerun the validation affected by the fixes, commit the corrected implementation as a new revision, and preserve concrete evidence. Do not rewrite the previously reviewed commit or claim approval from the prior request_changes review. When the corrected committed revision is ready for a new independent review, request a Flow transition.";
|
||||||
transitions = {
|
transitions = {
|
||||||
review = {
|
review = {
|
||||||
target = "review";
|
target = "review";
|
||||||
|
|||||||
Reference in New Issue
Block a user