@muggleai/works 5.24.0-staging.164 → 5.24.0-staging.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/{chunk-YVR2MCR2.js → chunk-CUL7GQDB.js} +47 -10
- package/dist/{chunk-6AAGQQDL.js → chunk-OPJUT6PX.js} +34 -45
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/scripts/guardrails.mjs +132 -6
- package/dist/plugin/scripts/pr-watch-arm.sh +3 -3
- package/dist/plugin/scripts/pr-watch-fetch.sh +2 -2
- package/dist/plugin/scripts/pr-watch-loop.sh +2 -2
- package/dist/plugin/scripts/pr-watch-state.jq +8 -2
- package/dist/plugin/skills/_shared/pr-followup-helpers/classify.md +2 -0
- package/dist/plugin/skills/do/address-reviews.md +12 -8
- package/dist/plugin/skills/do/cycle-size.md +33 -0
- package/dist/plugin/skills/do/e2e-acceptance.md +7 -1
- package/dist/plugin/skills/do/e2e-repair.md +4 -0
- package/dist/plugin/skills/do/fix-ci.md +3 -3
- package/dist/plugin/skills/do/impact-analysis.md +11 -0
- package/dist/plugin/skills/do/open-prs/forward.md +4 -0
- package/dist/plugin/skills/do/open-prs/update.md +7 -4
- package/dist/plugin/skills/do/pre-flight.md +6 -3
- package/dist/plugin/skills/do/resolve-conflicts.md +2 -2
- package/dist/plugin/skills/do/wave-e2e.md +85 -0
- package/dist/plugin/skills/muggle-do/SKILL.md +4 -2
- package/dist/plugin/skills/muggle-test-prepare/SKILL.md +7 -0
- package/dist/release-manifest.json +3 -3
- package/dist/{src-OHWBRW4X.js → src-3I5BNAZ7.js} +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/scripts/guardrails.mjs +132 -6
- package/plugin/scripts/pr-watch-arm.sh +3 -3
- package/plugin/scripts/pr-watch-fetch.sh +2 -2
- package/plugin/scripts/pr-watch-loop.sh +2 -2
- package/plugin/scripts/pr-watch-state.jq +8 -2
- package/plugin/skills/_shared/pr-followup-helpers/classify.md +2 -0
- package/plugin/skills/do/address-reviews.md +12 -8
- package/plugin/skills/do/cycle-size.md +33 -0
- package/plugin/skills/do/e2e-acceptance.md +7 -1
- package/plugin/skills/do/e2e-repair.md +4 -0
- package/plugin/skills/do/fix-ci.md +3 -3
- package/plugin/skills/do/impact-analysis.md +11 -0
- package/plugin/skills/do/open-prs/forward.md +4 -0
- package/plugin/skills/do/open-prs/update.md +7 -4
- package/plugin/skills/do/pre-flight.md +6 -3
- package/plugin/skills/do/resolve-conflicts.md +2 -2
- package/plugin/skills/do/wave-e2e.md +85 -0
- package/plugin/skills/muggle-do/SKILL.md +4 -2
- package/plugin/skills/muggle-test-prepare/SKILL.md +7 -0
|
@@ -193,6 +193,7 @@ var GuardrailBackgroundJob = /* @__PURE__ */ ((GuardrailBackgroundJob2) => {
|
|
|
193
193
|
GuardrailBackgroundJob2["ReserveWalkthroughComment"] = "reserve-walkthrough-comment";
|
|
194
194
|
GuardrailBackgroundJob2["SettleWalkthroughSkipped"] = "settle-walkthrough-skipped";
|
|
195
195
|
GuardrailBackgroundJob2["SettleWalkthroughUnreasoned"] = "settle-walkthrough-unreasoned";
|
|
196
|
+
GuardrailBackgroundJob2["SettleWalkthroughNoAppLogicChange"] = "settle-walkthrough-no-app-logic-change";
|
|
196
197
|
return GuardrailBackgroundJob2;
|
|
197
198
|
})(GuardrailBackgroundJob || {});
|
|
198
199
|
|
|
@@ -703,12 +704,14 @@ function applyRecordedRun(state, run) {
|
|
|
703
704
|
let next = state;
|
|
704
705
|
if (run.unitTestPassed) {
|
|
705
706
|
next = { ...next, unitTestsGreen: true, e2eRun: false };
|
|
707
|
+
if (next.e2eSkipCycleScoped === true) next = { ...next, e2eSkipped: false, e2eSkipCycleScoped: false };
|
|
706
708
|
}
|
|
707
709
|
if (run.e2eRan) {
|
|
708
710
|
next = { ...next, e2eRun: true, e2eBlockCount: 0 };
|
|
709
711
|
}
|
|
710
712
|
if (run.e2eSkipped) {
|
|
711
|
-
|
|
713
|
+
const isEnvironmentSkipHeld = next.e2eSkipped === true && next.e2eSkipCycleScoped !== true;
|
|
714
|
+
next = { ...next, e2eSkipped: true, e2eSkipCycleScoped: !isEnvironmentSkipHeld && run.e2eSkipCycleScoped === true };
|
|
712
715
|
}
|
|
713
716
|
return next;
|
|
714
717
|
}
|
|
@@ -785,6 +788,9 @@ var REPORT_SENTINEL = "muggle-pr-section";
|
|
|
785
788
|
var WALKTHROUGH_SLOT_MARKER = "<!-- muggle-pr-walkthrough:v1 -->";
|
|
786
789
|
var WALKTHROUGH_SKIPPED_MARKER = "<!-- muggle-pr-walkthrough-status:skipped -->";
|
|
787
790
|
var WALKTHROUGH_COMMENT_HEADING = "### Muggle AI \u2014 PR visual walkthrough";
|
|
791
|
+
var REPORT_SENTINEL_TAG = new RegExp(`<!--\\s*${REPORT_SENTINEL}[^>]*-->\\s*`, "g");
|
|
792
|
+
var LAST_FULL_RUN_OPENING = "<details><summary>Last full E2E run on this PR</summary>";
|
|
793
|
+
var SHORT_SHA_LENGTH = 7;
|
|
788
794
|
var GH_COMMENT_TIMEOUT_MS = 1e4;
|
|
789
795
|
|
|
790
796
|
// src/guardrails/prReportPost.ts
|
|
@@ -933,6 +939,7 @@ var E2eSkipCode = /* @__PURE__ */ ((E2eSkipCode3) => {
|
|
|
933
939
|
E2eSkipCode3["MuggleAuthDown"] = "MUGGLE_AUTH_DOWN";
|
|
934
940
|
E2eSkipCode3["NoPr"] = "NO_PR";
|
|
935
941
|
E2eSkipCode3["UserWaived"] = "USER_WAIVED";
|
|
942
|
+
E2eSkipCode3["NoAppLogicChange"] = "NO_APP_LOGIC_CHANGE";
|
|
936
943
|
return E2eSkipCode3;
|
|
937
944
|
})(E2eSkipCode || {});
|
|
938
945
|
|
|
@@ -940,14 +947,34 @@ var E2eSkipCode = /* @__PURE__ */ ((E2eSkipCode3) => {
|
|
|
940
947
|
var E2E_SKIP_DECLARATION = /^\s*echo\s+["']?MUGGLE_E2E_SKIP:(.*)$/;
|
|
941
948
|
var SKIP_CODE_TOKEN = /^[\s:]*([A-Za-z_]+)/;
|
|
942
949
|
var E2E_SKIP_CODES = Object.values(E2eSkipCode);
|
|
950
|
+
var NON_APP_PATH_SUMMARY = "docs, tests, lint/format config, or CI config";
|
|
943
951
|
var E2E_SKIP_CODE_CLAIMS = {
|
|
944
952
|
["NO_WEB_SURFACE" /* NoWebSurface */]: "the repo ships no web surface to drive",
|
|
945
953
|
["DEV_SERVER_UNREACHABLE" /* DevServerUnreachable */]: "the named dev server does not answer",
|
|
946
954
|
["EMPTY_DIFF" /* EmptyDiff */]: "the branch carries no diff against its base",
|
|
947
955
|
["MUGGLE_AUTH_DOWN" /* MuggleAuthDown */]: "the stored Muggle session is missing or expired",
|
|
948
956
|
["NO_PR" /* NoPr */]: "no pull request was handled this session",
|
|
949
|
-
["USER_WAIVED" /* UserWaived */]: "the user waived E2E in their own words"
|
|
957
|
+
["USER_WAIVED" /* UserWaived */]: "the user waived E2E in their own words",
|
|
958
|
+
["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */]: `every path changed since the named commit is ${NON_APP_PATH_SUMMARY}`
|
|
950
959
|
};
|
|
960
|
+
var CYCLE_SCOPED_SKIP_CODES = ["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */];
|
|
961
|
+
var PRE_CYCLE_SHA_TOKEN = /^([0-9a-f]{7,40})(?![0-9a-z_])/i;
|
|
962
|
+
var NON_APP_PATH_PATTERNS = [
|
|
963
|
+
/\.(md|markdown|rst)$/i,
|
|
964
|
+
/(^|\/)[^/]+\.(test|spec)\.[^/]+$/,
|
|
965
|
+
/(^|\/)(__tests__|__snapshots__|__mocks__)\//,
|
|
966
|
+
/(^|\/)test_[^/]+\.py$/,
|
|
967
|
+
/(^|\/)[^/]+_test\.(py|go)$/,
|
|
968
|
+
/^tests?\//,
|
|
969
|
+
/(^|\/)\.(eslintrc|prettierrc|stylelintrc)(\.[a-z]+)?$/,
|
|
970
|
+
/(^|\/)(eslint|prettier|stylelint)\.config\.[cm]?[jt]s$/,
|
|
971
|
+
/(^|\/)\.(eslint|prettier|stylelint)ignore$/,
|
|
972
|
+
/(^|\/)\.markdownlint[^/]*$/,
|
|
973
|
+
/(^|\/)(biome\.jsonc?|\.editorconfig)$/,
|
|
974
|
+
/^\.github\/workflows\//,
|
|
975
|
+
/^\.gitlab-ci\.yml$/
|
|
976
|
+
];
|
|
977
|
+
var MAX_NAMED_APP_LOGIC_PATHS = 5;
|
|
951
978
|
var USER_WAIVE_PHRASE = "SKIP E2E";
|
|
952
979
|
var DEV_SERVER_PROBE_TIMEOUT_MS = 2e3;
|
|
953
980
|
var GIT_PROBE_TIMEOUT_MS = 5e3;
|
|
@@ -976,6 +1003,18 @@ var WEB_SURFACE_CONFIG_FILES = [
|
|
|
976
1003
|
var OAUTH_SESSION_FILE = /^oauth-session[\w.-]*\.json$/;
|
|
977
1004
|
var MUGGLE_HOME_DIR_NAME = ".muggle-ai";
|
|
978
1005
|
|
|
1006
|
+
// src/e2e-skip/noAppLogicChange.ts
|
|
1007
|
+
function parseNoAppLogicChangeDetail(detail) {
|
|
1008
|
+
const stated = detail.trim();
|
|
1009
|
+
const preCycleSha = stated.match(PRE_CYCLE_SHA_TOKEN)?.[1];
|
|
1010
|
+
if (!preCycleSha) return null;
|
|
1011
|
+
const reason = stated.slice(preCycleSha.length).replace(/^[\s:,;.-]+/, "").trim();
|
|
1012
|
+
return { preCycleSha, reason };
|
|
1013
|
+
}
|
|
1014
|
+
function isNonAppPath(repoRelativePath) {
|
|
1015
|
+
return NON_APP_PATH_PATTERNS.some((pattern) => pattern.test(repoRelativePath));
|
|
1016
|
+
}
|
|
1017
|
+
|
|
979
1018
|
// src/pr-walkthrough/comment.ts
|
|
980
1019
|
function renderReservedComment() {
|
|
981
1020
|
return `${WALKTHROUGH_SLOT_MARKER}
|
|
@@ -999,6 +1038,34 @@ ${WALKTHROUGH_COMMENT_HEADING}
|
|
|
999
1038
|
|
|
1000
1039
|
**No E2E run, and no verified reason given.** The session ended still owing an acceptance run and cited no skip code that Muggle could verify. Treat this PR as unvalidated by E2E.`;
|
|
1001
1040
|
}
|
|
1041
|
+
var shortSha = (sha) => sha.slice(0, SHORT_SHA_LENGTH);
|
|
1042
|
+
function renderNoAppLogicChangeComment(declared, headSha, lastFullRun) {
|
|
1043
|
+
const cycleStart = declared.preCycleSha.toLowerCase();
|
|
1044
|
+
const head = headSha?.toLowerCase() ?? null;
|
|
1045
|
+
const isHeadPastCycleStart = head !== null && !head.startsWith(cycleStart) && !cycleStart.startsWith(head);
|
|
1046
|
+
const headline = isHeadPastCycleStart ? `**E2E skipped \u2014 no app-logic change in \`${shortSha(head)}\`.**` : `**E2E skipped \u2014 no app-logic change since \`${shortSha(cycleStart)}\`.**`;
|
|
1047
|
+
const qualifier = declared.reason ? ` \u2014 ${declared.reason}` : "";
|
|
1048
|
+
const evidence = lastFullRun ? `${LAST_FULL_RUN_OPENING}
|
|
1049
|
+
|
|
1050
|
+
${lastFullRun}
|
|
1051
|
+
|
|
1052
|
+
</details>` : "_No full E2E run is on record for this PR._";
|
|
1053
|
+
return `${WALKTHROUGH_SLOT_MARKER}
|
|
1054
|
+
${WALKTHROUGH_SKIPPED_MARKER}
|
|
1055
|
+
${WALKTHROUGH_COMMENT_HEADING}
|
|
1056
|
+
|
|
1057
|
+
${headline} Muggle verified \`${"NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */}\` \u2014 every path changed since \`${shortSha(cycleStart)}\` is ${NON_APP_PATH_SUMMARY}${qualifier}.
|
|
1058
|
+
|
|
1059
|
+
` + evidence;
|
|
1060
|
+
}
|
|
1061
|
+
function lastFullRunOf(body) {
|
|
1062
|
+
const status = classifyComment(body);
|
|
1063
|
+
if (status === "reported" /* Reported */) return body.replace(REPORT_SENTINEL_TAG, "").trim();
|
|
1064
|
+
if (status !== "skipped" /* Skipped */) return null;
|
|
1065
|
+
const start = body.indexOf(LAST_FULL_RUN_OPENING);
|
|
1066
|
+
if (start === -1) return null;
|
|
1067
|
+
return body.slice(start + LAST_FULL_RUN_OPENING.length).replace(/\s*<\/details>\s*$/, "").trim();
|
|
1068
|
+
}
|
|
1002
1069
|
function classifyComment(body) {
|
|
1003
1070
|
if (body.includes(REPORT_SENTINEL)) return "reported" /* Reported */;
|
|
1004
1071
|
if (!body.includes(WALKTHROUGH_SLOT_MARKER)) return "not-designated" /* NotDesignated */;
|
|
@@ -1043,6 +1110,13 @@ function listPrComments(pr, run) {
|
|
|
1043
1110
|
return null;
|
|
1044
1111
|
}
|
|
1045
1112
|
}
|
|
1113
|
+
function readPrHeadSha(pr, run) {
|
|
1114
|
+
try {
|
|
1115
|
+
return run(["api", `repos/${pr.repo}/pulls/${pr.prNumber}`, "--jq", ".head.sha"])?.trim() || null;
|
|
1116
|
+
} catch {
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1046
1120
|
function writeJson(args, payload, run) {
|
|
1047
1121
|
try {
|
|
1048
1122
|
return run(args, JSON.stringify(payload)) !== null;
|
|
@@ -1096,6 +1170,19 @@ function settleWith(prUrl, body, run) {
|
|
|
1096
1170
|
function settleWalkthroughCommentAsSkipped(prUrl, code, detail, run = defaultGhRunner) {
|
|
1097
1171
|
return settleWith(prUrl, renderSkippedComment(code, detail), run);
|
|
1098
1172
|
}
|
|
1173
|
+
function settleWalkthroughCommentForNoAppLogicChange(prUrl, detail, run = defaultGhRunner) {
|
|
1174
|
+
const pr = parsePrUrl(prUrl);
|
|
1175
|
+
const declared = parseNoAppLogicChangeDetail(detail);
|
|
1176
|
+
if (!pr || !declared) return false;
|
|
1177
|
+
const comments = listPrComments(pr, run);
|
|
1178
|
+
if (comments === null) return false;
|
|
1179
|
+
const designated = comments.find(
|
|
1180
|
+
(comment) => classifyComment(comment.body) !== "not-designated" /* NotDesignated */
|
|
1181
|
+
);
|
|
1182
|
+
const lastFullRun = designated ? lastFullRunOf(designated.body) : null;
|
|
1183
|
+
const body = renderNoAppLogicChangeComment(declared, readPrHeadSha(pr, run), lastFullRun);
|
|
1184
|
+
return designated ? patchPrComment(pr, designated.id, body, run) : postPrComment(pr, body, run);
|
|
1185
|
+
}
|
|
1099
1186
|
function settleWalkthroughCommentAsUnreasoned(prUrl, run = defaultGhRunner) {
|
|
1100
1187
|
return settleWith(prUrl, renderUnreasonedSkipComment(), run);
|
|
1101
1188
|
}
|
|
@@ -1203,13 +1290,39 @@ var verifyUserWaived = (context) => {
|
|
|
1203
1290
|
if (waived) return verified;
|
|
1204
1291
|
return refuted(`no user turn in the transcript contains "${USER_WAIVE_PHRASE}"`);
|
|
1205
1292
|
};
|
|
1293
|
+
var namePaths = (paths) => {
|
|
1294
|
+
const named = paths.slice(0, MAX_NAMED_APP_LOGIC_PATHS).join(", ");
|
|
1295
|
+
const unnamed = paths.length - MAX_NAMED_APP_LOGIC_PATHS;
|
|
1296
|
+
return unnamed > 0 ? `${named} and ${unnamed} more` : named;
|
|
1297
|
+
};
|
|
1298
|
+
var verifyNoAppLogicChange = (context, detail) => {
|
|
1299
|
+
if (!context.cwd) return refuted("no working directory was available to inspect");
|
|
1300
|
+
const declared = parseNoAppLogicChangeDetail(detail);
|
|
1301
|
+
if (!declared) {
|
|
1302
|
+
return refuted("the detail names no pre-cycle commit \u2014 cite it as NO_APP_LOGIC_CHANGE: <sha> <what changed>");
|
|
1303
|
+
}
|
|
1304
|
+
const sha = declared.preCycleSha;
|
|
1305
|
+
const diff = context.probe.runGit(
|
|
1306
|
+
["diff", "--name-only", "--no-renames", "-z", `${sha}^{commit}`, "HEAD"],
|
|
1307
|
+
context.cwd
|
|
1308
|
+
);
|
|
1309
|
+
if (diff === null) return refuted(`${sha} does not resolve to a commit here, or its diff to HEAD could not be read`);
|
|
1310
|
+
const changedPaths = diff.split("\0").filter(Boolean);
|
|
1311
|
+
if (changedPaths.length === 0) {
|
|
1312
|
+
return refuted(`HEAD carries no change since ${sha} \u2014 declare the skip once the cycle's commits are on HEAD`);
|
|
1313
|
+
}
|
|
1314
|
+
const appLogicPaths = changedPaths.filter((path) => !isNonAppPath(path));
|
|
1315
|
+
if (appLogicPaths.length > 0) return refuted(`app-logic paths changed since ${sha}: ${namePaths(appLogicPaths)}`);
|
|
1316
|
+
return verified;
|
|
1317
|
+
};
|
|
1206
1318
|
var VERIFIERS = {
|
|
1207
1319
|
["NO_WEB_SURFACE" /* NoWebSurface */]: verifyNoWebSurface,
|
|
1208
1320
|
["DEV_SERVER_UNREACHABLE" /* DevServerUnreachable */]: verifyDevServerUnreachable,
|
|
1209
1321
|
["EMPTY_DIFF" /* EmptyDiff */]: verifyEmptyDiff,
|
|
1210
1322
|
["MUGGLE_AUTH_DOWN" /* MuggleAuthDown */]: verifyMuggleAuthDown,
|
|
1211
1323
|
["NO_PR" /* NoPr */]: verifyNoPr,
|
|
1212
|
-
["USER_WAIVED" /* UserWaived */]: verifyUserWaived
|
|
1324
|
+
["USER_WAIVED" /* UserWaived */]: verifyUserWaived,
|
|
1325
|
+
["NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */]: verifyNoAppLogicChange
|
|
1213
1326
|
};
|
|
1214
1327
|
function verifyDeclaredSkip(skip, context) {
|
|
1215
1328
|
return VERIFIERS[skip.code](context, skip.detail);
|
|
@@ -1760,10 +1873,12 @@ function recordTests() {
|
|
|
1760
1873
|
const cmd = input.tool_input?.command ?? "";
|
|
1761
1874
|
const stateBefore = readState(sessionId);
|
|
1762
1875
|
const judgedSkip = judgeE2eSkip(input, stateBefore);
|
|
1876
|
+
const acceptedSkip = judgedSkip?.accepted ? judgedSkip.skip : null;
|
|
1763
1877
|
const run = {
|
|
1764
1878
|
unitTestPassed: isTestCommand(cmd) && testsPassed(input),
|
|
1765
1879
|
e2eRan: isE2ERun(input),
|
|
1766
|
-
e2eSkipped:
|
|
1880
|
+
e2eSkipped: acceptedSkip !== null,
|
|
1881
|
+
e2eSkipCycleScoped: acceptedSkip !== null && CYCLE_SCOPED_SKIP_CODES.includes(acceptedSkip.code)
|
|
1767
1882
|
};
|
|
1768
1883
|
const walkthroughPosted = detectWalkthroughPost(input);
|
|
1769
1884
|
const failedRunId = detectFailedRunId(input);
|
|
@@ -1779,13 +1894,17 @@ function recordTests() {
|
|
|
1779
1894
|
if (isWalkthroughGateArmed(next) && !isWalkthroughGateArmed(stateBefore)) {
|
|
1780
1895
|
startBackgroundJob("scan-walkthroughs" /* ScanWalkthroughs */, [sessionId], input.cwd);
|
|
1781
1896
|
}
|
|
1782
|
-
if (
|
|
1897
|
+
if (acceptedSkip) recordSkipReasonOnPrs(next, acceptedSkip);
|
|
1783
1898
|
if (judgedSkip && !judgedSkip.accepted) {
|
|
1784
1899
|
return envelope("PostToolUse", explainRejection(judgedSkip), host);
|
|
1785
1900
|
}
|
|
1786
1901
|
return "{}";
|
|
1787
1902
|
}
|
|
1788
1903
|
function recordSkipReasonOnPrs(state, skip) {
|
|
1904
|
+
if (skip.code === "NO_APP_LOGIC_CHANGE" /* NoAppLogicChange */) {
|
|
1905
|
+
startBackgroundJob("settle-walkthrough-no-app-logic-change" /* SettleWalkthroughNoAppLogicChange */, [skip.detail], input.cwd);
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1789
1908
|
for (const prUrl of state.prsHandled) {
|
|
1790
1909
|
startBackgroundJob("settle-walkthrough-skipped" /* SettleWalkthroughSkipped */, [prUrl, skip.code, skip.detail]);
|
|
1791
1910
|
}
|
|
@@ -2074,11 +2193,18 @@ function settleWalkthroughUnreasonedJob() {
|
|
|
2074
2193
|
if (prUrl) settleWalkthroughCommentAsUnreasoned(prUrl);
|
|
2075
2194
|
return "{}";
|
|
2076
2195
|
}
|
|
2196
|
+
function settleWalkthroughNoAppLogicChangeJob() {
|
|
2197
|
+
const [detail] = jobArgs;
|
|
2198
|
+
const prUrl = defaultPrWalkthroughLookup.branchPrUrl();
|
|
2199
|
+
if (prUrl && detail) settleWalkthroughCommentForNoAppLogicChange(prUrl, detail);
|
|
2200
|
+
return "{}";
|
|
2201
|
+
}
|
|
2077
2202
|
var backgroundJobs = {
|
|
2078
2203
|
["scan-walkthroughs" /* ScanWalkthroughs */]: scanWalkthroughsJob,
|
|
2079
2204
|
["reserve-walkthrough-comment" /* ReserveWalkthroughComment */]: reserveWalkthroughCommentJob,
|
|
2080
2205
|
["settle-walkthrough-skipped" /* SettleWalkthroughSkipped */]: settleWalkthroughSkippedJob,
|
|
2081
|
-
["settle-walkthrough-unreasoned" /* SettleWalkthroughUnreasoned */]: settleWalkthroughUnreasonedJob
|
|
2206
|
+
["settle-walkthrough-unreasoned" /* SettleWalkthroughUnreasoned */]: settleWalkthroughUnreasonedJob,
|
|
2207
|
+
["settle-walkthrough-no-app-logic-change" /* SettleWalkthroughNoAppLogicChange */]: settleWalkthroughNoAppLogicChangeJob
|
|
2082
2208
|
};
|
|
2083
2209
|
var runSubcommand = isBackgroundJob(sub) ? backgroundJobs[sub] : handlers[sub] ?? (() => "{}");
|
|
2084
2210
|
process.stdout.write(runSubcommand());
|
|
@@ -62,7 +62,7 @@ fi
|
|
|
62
62
|
watch_read_state_fields "$state_line"
|
|
63
63
|
pr_state="${STATE_FIELDS[0]-}"
|
|
64
64
|
head_sha="${STATE_FIELDS[1]-}"
|
|
65
|
-
|
|
65
|
+
base_tip_sha="${STATE_FIELDS[2]-}"
|
|
66
66
|
mergeable="${STATE_FIELDS[3]-}"
|
|
67
67
|
latest_review="${STATE_FIELDS[4]-}"
|
|
68
68
|
latest_comment="${STATE_FIELDS[5]-}"
|
|
@@ -82,11 +82,11 @@ if [ "${pending_checks:-0}" -eq 0 ] 2>/dev/null && [ "${failed_checks:-0}" -gt 0
|
|
|
82
82
|
ci_red_floor="$head_sha"
|
|
83
83
|
fi
|
|
84
84
|
|
|
85
|
-
# Same for staleness: keyed on the head/base pair, so it re-arms when either moves.
|
|
85
|
+
# Same for staleness: keyed on the head/base-tip pair, so it re-arms when either moves.
|
|
86
86
|
rebase_floor=""
|
|
87
87
|
behind_count="$(watch_fetch_behind_count "$repo" "$base_branch" "$head_sha" "$slot")"
|
|
88
88
|
if [ "$mergeable" = "CONFLICTING" ] || { [ -n "$behind_count" ] && [ "$behind_count" -gt 0 ] 2>/dev/null; }; then
|
|
89
|
-
rebase_floor="${head_sha}..${
|
|
89
|
+
rebase_floor="${head_sha}..${base_tip_sha}"
|
|
90
90
|
fi
|
|
91
91
|
|
|
92
92
|
thread_count=0
|
|
@@ -16,7 +16,7 @@ query($owner: String!, $name: String!, $number: Int!) {
|
|
|
16
16
|
pullRequest(number: $number) {
|
|
17
17
|
state
|
|
18
18
|
headRefOid
|
|
19
|
-
|
|
19
|
+
baseRef { target { oid } }
|
|
20
20
|
mergeable
|
|
21
21
|
commits(last: 1) {
|
|
22
22
|
nodes {
|
|
@@ -48,7 +48,7 @@ query($owner: String!, $name: String!, $number: Int!) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
# behind_by needs its own call — see watch_wake_rebase for why no field on the
|
|
51
|
-
# PR carries it. The loop makes it only when the head/base pair moved, so the
|
|
51
|
+
# PR carries it. The loop makes it only when the head/base-tip pair moved, so the
|
|
52
52
|
# steady state stays one request per iteration.
|
|
53
53
|
watch_fetch_behind_count() {
|
|
54
54
|
local repo="$1" base_branch="$2" head_sha="$3" slot="$4"
|
|
@@ -152,7 +152,7 @@ while :; do
|
|
|
152
152
|
watch_read_state_fields "$state_line"
|
|
153
153
|
pr_state="${STATE_FIELDS[0]-}"
|
|
154
154
|
head_sha="${STATE_FIELDS[1]-}"
|
|
155
|
-
|
|
155
|
+
base_tip_sha="${STATE_FIELDS[2]-}"
|
|
156
156
|
mergeable="${STATE_FIELDS[3]-}"
|
|
157
157
|
latest_review="${STATE_FIELDS[4]-}"
|
|
158
158
|
latest_comment="${STATE_FIELDS[5]-}"
|
|
@@ -201,7 +201,7 @@ while :; do
|
|
|
201
201
|
floor_ci_red="$head_sha"
|
|
202
202
|
fi
|
|
203
203
|
|
|
204
|
-
rebase_key="${head_sha}..${
|
|
204
|
+
rebase_key="${head_sha}..${base_tip_sha}"
|
|
205
205
|
if [ "$rebase_key" != "$watermark_rebase" ] && [ "$rebase_key" != "$floor_rebase" ]; then
|
|
206
206
|
behind_count=$(watch_fetch_behind_count "$repo" "$base_branch" "$head_sha" "$slot")
|
|
207
207
|
if watch_wake_rebase "$pr_number" "$mergeable" "$behind_count" "$rebase_key" ""; then
|
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
# which is how the echo wake below survived unnoticed.
|
|
5
5
|
#
|
|
6
6
|
# Field order is the contract pr-watch-loop.sh reads positionally:
|
|
7
|
-
# state, headRefOid,
|
|
7
|
+
# state, headRefOid, base-tip, mergeable, latest-review, latest-comment,
|
|
8
8
|
# unresolved-thread-ids, pending-checks, failed-checks, check-digest
|
|
9
|
+
#
|
|
10
|
+
# base-tip is where the base branch points now, the base half of the rebase key.
|
|
11
|
+
# Not baseRefOid: GitHub moves that only when the head is pushed, so a key built
|
|
12
|
+
# from it stays equal to an escalated or floored key however far the base
|
|
13
|
+
# advances, and the branch never wakes again. A deleted base branch projects as
|
|
14
|
+
# an empty field rather than a missing one, so no later field shifts.
|
|
9
15
|
|
|
10
16
|
def loop_marked: ((.body // "") | contains("<!-- muggle-do:bot -->"));
|
|
11
17
|
|
|
@@ -40,7 +46,7 @@ def loop_marked: ((.body // "") | contains("<!-- muggle-do:bot -->"));
|
|
|
40
46
|
[
|
|
41
47
|
$pr.state,
|
|
42
48
|
$pr.headRefOid,
|
|
43
|
-
$pr.
|
|
49
|
+
($pr.baseRef.target.oid // ""),
|
|
44
50
|
$pr.mergeable,
|
|
45
51
|
(([$pr.reviews.nodes[] | select(is_echo_review | not) | .databaseId] | max) // 0),
|
|
46
52
|
(($liveComments | map(select(loop_marked | not) | .databaseId) | max) // 0),
|
|
@@ -23,6 +23,8 @@ Only reviews that survive the self-loop check proceed to classify below.
|
|
|
23
23
|
|
|
24
24
|
Default to **actionable**. CI catches wrong attempts; reviewers correct on the next round. Escalation is a round-trip with an absent user — reserve it.
|
|
25
25
|
|
|
26
|
+
Classification decides only whether to act. How much of the cycle runs is decided later, by the caller, from the diff the work produced — never from how the review was worded or how many comments it carried.
|
|
27
|
+
|
|
26
28
|
Reply shape (all replies for one review reference the same SHA):
|
|
27
29
|
|
|
28
30
|
- **threaded** (default): `Done in <sha> — <attribution>. (Review #<review_id>, cycle <status>.)`
|
|
@@ -82,23 +82,27 @@ The actionable reviews together carry a flat list of change items, one per line
|
|
|
82
82
|
|
|
83
83
|
#### 4b. Apply design + code-logic changes
|
|
84
84
|
|
|
85
|
-
Invoke [`build.md`](build.md) with the review-derived requirements: for each comment, what to change and where. `build.md` makes the edits in the working tree but does not commit.
|
|
85
|
+
Record `pre_cycle_sha` per [`cycle-size.md`](cycle-size.md) before the first edit. Invoke [`build.md`](build.md) with the review-derived requirements: for each comment, what to change and where. `build.md` makes the edits in the working tree but does not commit.
|
|
86
86
|
|
|
87
87
|
If `build.md` reports that the requested work requires rethinking the design (e.g. the requested change conflicts with a load-bearing invariant), exit early per Step 7 (design-adjustment escalation).
|
|
88
88
|
|
|
89
|
-
#### 4c.
|
|
89
|
+
#### 4c. Size the cycle
|
|
90
|
+
|
|
91
|
+
Invoke [`impact-analysis.md`](impact-analysis.md) with `pre_cycle_sha` — the forward pipeline's Stage 4, plus the cycle's own diff. Its `cycleSize` picks the tail per [`cycle-size.md`](cycle-size.md): **minor** runs 4d → 4f → 4g, **full** runs 4d → 4e → 4f → 4g, and an empty `cycleFiles` goes straight to 4g. The Step 2 classification never sizes the cycle — a one-line comment can need the full tail and a long review the minor one.
|
|
92
|
+
|
|
93
|
+
#### 4d. Create or update unit tests
|
|
90
94
|
|
|
91
95
|
Invoke [`unit-tests.md`](unit-tests.md). Cover the surface that just changed; respect existing test conventions.
|
|
92
96
|
|
|
93
|
-
####
|
|
97
|
+
#### 4e. Run ONE E2E acceptance pass (full cycle only)
|
|
94
98
|
|
|
95
|
-
Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass covering all related test cases for this PR, not one per comment. The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md).
|
|
99
|
+
Invoke [`e2e-acceptance.md`](e2e-acceptance.md). One pass covering all related test cases for this PR, not one per comment. When `state.md` records `Wave: on`, the pass runs against the wave stack — siblings started from their PRs' current heads — and the refreshed walkthrough goes to every sibling too, per [`wave-e2e.md`](wave-e2e.md#later-cycles-on-one-wave-pr). The stage reads the persisted validation context (seeded by pre-flight or by bootstrap Step 6.5); a poll-only session with no context (e.g. auto-track) is reported `SKIPPED`. The persisted `Validation` strategy is the standing decision — no per-tick `autoE2ETest` prompt. See [`e2e-acceptance.md`](e2e-acceptance.md) Step 0 and [`../_shared/resolve-e2e-validation-context.md`](../_shared/resolve-e2e-validation-context.md). A minor cycle skips this step, wave or not.
|
|
96
100
|
|
|
97
|
-
####
|
|
101
|
+
#### 4f. Create or update the PR
|
|
98
102
|
|
|
99
|
-
Invoke [`open-prs/update.md`](open-prs/update.md) (pass the PR URL + slug + existing PR number). It pushes, refreshes title/description on state change,
|
|
103
|
+
Invoke [`open-prs/update.md`](open-prs/update.md) (pass the PR URL + slug + existing PR number, the cycle size, and `pre_cycle_sha`). It pushes, refreshes title/description on state change, settles the walkthrough comment — a fresh walkthrough for a full cycle, the `NO_APP_LOGIC_CHANGE` skip for a minor one — and appends the new SHA to `last_seen.pushed_shas[]`. Capture the new `head_sha`.
|
|
100
104
|
|
|
101
|
-
####
|
|
105
|
+
#### 4g. Post per-comment inline replies
|
|
102
106
|
|
|
103
107
|
Invoke [`per-comment-replies.md`](per-comment-replies.md) with the actionable reviews (`gitlab`: discussions) and the new SHA. One reply per comment, in its own thread, describing what was done for it. The reply is the whole of it — neither provider's threads get resolved by the loop.
|
|
104
108
|
|
|
@@ -129,7 +133,7 @@ Emit one event per [`../_shared/telemetry-events/muggle-do-cycle.md`](../_shared
|
|
|
129
133
|
- `"mixed"` — both branches ran.
|
|
130
134
|
- `"no-op"` — every input id was already in `escalated_review_ids` (the watcher shouldn't have dispatched, but defensive coverage).
|
|
131
135
|
|
|
132
|
-
Emit additional events as Steps fired them (escalation event in Step 3; resolve-reminder event in Step
|
|
136
|
+
Emit additional events as Steps fired them (escalation event in Step 3; resolve-reminder event in Step 5.5).
|
|
133
137
|
|
|
134
138
|
## Design-adjustment escalation (Step 4b early exit)
|
|
135
139
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Cycle size (watcher-dispatched cycles)
|
|
2
|
+
|
|
3
|
+
Address-reviews, fix-ci, and rebase cycles each run a **minor** or a **full** tail. The diff the cycle produced picks it — never how a review was worded, how many comments asked, or which check was red.
|
|
4
|
+
|
|
5
|
+
## Starting commit
|
|
6
|
+
|
|
7
|
+
`pre_cycle_sha` is the PR head the cycle started from, read with `git rev-parse HEAD` in the PR's working tree before the cycle's first change: address-reviews right after its Step 0 sync, fix-ci's `red_sha`, rebase's `rebase_sha`.
|
|
8
|
+
|
|
9
|
+
## Size
|
|
10
|
+
|
|
11
|
+
Once the cycle's edits are in the working tree — or the rebase has replayed — run [`impact-analysis.md`](impact-analysis.md) with `pre_cycle_sha`. Its `cycleSize` is:
|
|
12
|
+
|
|
13
|
+
- **minor** — every path the cycle changed is docs, tests, lint/format config, or CI config, exactly as the `NO_APP_LOGIC_CHANGE` rule in [`e2e-acceptance.md`](e2e-acceptance.md) defines them.
|
|
14
|
+
- **full** — anything else, a comment-only or formatting-only edit in a source file included. The rule reads paths, not content, because a path rule is what the guardrail can verify.
|
|
15
|
+
|
|
16
|
+
A rebase compares trees, so app logic the base brought in makes the rebase full. An empty `cycleFiles` is neither size: the cycle changed nothing (every review was an answerable question), so it runs no tail — no unit run, no push, no declaration — and goes straight to the mode's replies.
|
|
17
|
+
|
|
18
|
+
## Full tail
|
|
19
|
+
|
|
20
|
+
Unit tests → E2E per [`e2e-acceptance.md`](e2e-acceptance.md) → push → walkthrough repost: fire [`postPRVisualWalkthrough`](../muggle-preferences/preference-gates/postPRVisualWalkthrough.md), then [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A → the mode's remaining steps.
|
|
21
|
+
|
|
22
|
+
## Minor tail
|
|
23
|
+
|
|
24
|
+
Unit tests → push → declare the skip → the mode's remaining steps. No E2E run, no walkthrough render.
|
|
25
|
+
|
|
26
|
+
Declare after the push, as one Bash call from the PR's working tree. Only then is local HEAD the head the PR carries: server-signed commits reach the local branch when the push syncs it, and a base sync during the push can rewrite the head.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
echo "MUGGLE_E2E_SKIP: NO_APP_LOGIC_CHANGE: <pre_cycle_sha> <what changed, e.g. README typo, test rename>"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **Accepted** — Muggle rewrites the PR's designated walkthrough comment to "E2E skipped — no app-logic change in `<short-sha>`" with the stated reason, and keeps the last full run's walkthrough collapsed beneath it. The walkthrough check passes on the new head when that run passed. When it failed, the check stays red: commits that changed no app logic cannot have repaired a failing case, so that red is fix-ci's walkthrough repair, never a minor cycle's.
|
|
33
|
+
- **Rejected** — the reply names the paths that refuted it. The cycle is full after all: run E2E on the pushed head, repost the walkthrough, then continue.
|
|
@@ -23,7 +23,9 @@ This stage is **mode-driven by pre-flight**:
|
|
|
23
23
|
|
|
24
24
|
**Every SKIPPED exit from this stage** (Step 0 poll-only, Step 1 `unit-only`/`skip`, Step 1.5 placeholder branch) also runs `echo "MUGGLE_E2E_SKIP: <CODE>: <detail>"` as a single Bash call before exiting — it records the skip in guardrail session state so the Stop-hook E2E gate releases instead of blocking the turn.
|
|
25
25
|
|
|
26
|
-
`<CODE>` is one of `NO_WEB_SURFACE`, `DEV_SERVER_UNREACHABLE`, `EMPTY_DIFF`, `MUGGLE_AUTH_DOWN`, `NO_PR`, `USER_WAIVED`, and the guardrail verifies it
|
|
26
|
+
`<CODE>` is one of `NO_WEB_SURFACE`, `DEV_SERVER_UNREACHABLE`, `EMPTY_DIFF`, `MUGGLE_AUTH_DOWN`, `NO_PR`, `USER_WAIVED`, `NO_APP_LOGIC_CHANGE` — the one list of verified skip codes, which other files reference rather than restate — and the guardrail verifies it before the gate releases. Every code names a fact the guardrail checks for itself, about the environment or about which paths a commit range touched; none names a judgment about the change, so "static page", "layout only", "unit tests cover it" and "verified with another tool" have no way through — cite a code that holds, or run the tests. `USER_WAIVED` needs the user's own literal `SKIP E2E` in the transcript, never an inferred go-ahead. A rejected declaration is answered with the check that failed, and the turn stays blocked.
|
|
27
|
+
|
|
28
|
+
`NO_APP_LOGIC_CHANGE` belongs to a watcher cycle's minor tail ([`cycle-size.md`](cycle-size.md)), never to a Stage 6 exit. Its detail opens with the cycle's starting commit. Muggle diffs that commit against HEAD and accepts only when every changed path is docs (`*.md`, `*.markdown`, `*.rst`), tests (`*.test.*`, `*.spec.*`, `__tests__/`, `__snapshots__/`, `__mocks__/`, `test_*.py`, `*_test.py`, `*_test.go`, a root-level `test/` or `tests/`), lint/format config (ESLint, Prettier, Stylelint and markdownlint config or ignore files, `biome.json`, `.editorconfig`), or CI config (`.github/workflows/`, `.gitlab-ci.yml`). A commit it cannot resolve, an empty diff, or any other path — a comment-only edit in a source file included — fails.
|
|
27
29
|
- `staging-replay` is not executed in this stage path and should be surfaced as `INCONCLUSIVE` unless the caller has already routed to a dedicated staging runner.
|
|
28
30
|
|
|
29
31
|
For local runs, the tool boundaries are:
|
|
@@ -58,6 +60,10 @@ Otherwise the block was seeded by pre-flight or bootstrap per [`../_shared/resol
|
|
|
58
60
|
|
|
59
61
|
For a `local-e2e` block, use `localUrl`, `projectId`, and the working-tree path from `state.md`. Missing any → seeding bug; escalate with the session path and halt; do not ask the user.
|
|
60
62
|
|
|
63
|
+
### Step 0.4: Wave cycles
|
|
64
|
+
|
|
65
|
+
`state.md` records `Wave: on` → this stage runs **once for the whole wave**, not per repo, per [`wave-e2e.md`](wave-e2e.md): the wave stack starts from every member's worktree, test cases are selected against the union of diffs, each case runs once, and each failure names its `implicatedRepo`. The steps below apply with those changes.
|
|
66
|
+
|
|
61
67
|
### Step 0.5: Pre-flight verification probes
|
|
62
68
|
|
|
63
69
|
Before launching the local runner:
|
|
@@ -15,6 +15,10 @@ Runs between Stage 7's posted walkthrough and Stage 8's watcher dispatch. A fail
|
|
|
15
15
|
- The PR opened by [`open-prs/forward.md`](open-prs/forward.md) — repo and number, for the escalation event and the refresh path.
|
|
16
16
|
- `repairIteration` — how many times this stage has already run in this session, read from `iterations/<NNN>.md`.
|
|
17
17
|
|
|
18
|
+
## Wave cycles
|
|
19
|
+
|
|
20
|
+
`state.md` records `Wave: on` → the loop runs once for the wave per [`wave-e2e.md`](wave-e2e.md): repairs land in each failure's `implicatedRepo` (`unknown` is `ask`), re-runs use the wave stack, and every wave PR's walkthrough and title are refreshed after each pass.
|
|
21
|
+
|
|
18
22
|
## Step 0: Clearance check
|
|
19
23
|
|
|
20
24
|
Read the Stage 6 run-level verdict, defined in [`../_shared/failure-mode-handling.md`](../_shared/failure-mode-handling.md) section F.
|
|
@@ -20,7 +20,7 @@ From `~/.muggle-ai/muggle-do/sessions/<slug>/`: `prs.json` (PR + local checkout
|
|
|
20
20
|
|
|
21
21
|
### Step 1 — Re-attach
|
|
22
22
|
|
|
23
|
-
Check out the PR branch in the session's working tree (per `state.md`). Capture `red_sha = prs.json[0].head_sha
|
|
23
|
+
Check out the PR branch in the session's working tree (per `state.md`). Capture `red_sha = prs.json[0].head_sha` — this cycle's `pre_cycle_sha` ([`cycle-size.md`](cycle-size.md)).
|
|
24
24
|
|
|
25
25
|
### Step 2 — Map each failing check to a local command
|
|
26
26
|
|
|
@@ -39,13 +39,13 @@ An empty-comment failure (no run ever posted) skips items 1–2: run the suite a
|
|
|
39
39
|
### Step 3 — Verify before push
|
|
40
40
|
|
|
41
41
|
- Build (typecheck + lint on the changed surface) + unit suite must pass.
|
|
42
|
-
-
|
|
42
|
+
- Size the fix per [`cycle-size.md`](cycle-size.md) with `pre_cycle_sha = red_sha`. A full fix runs E2E before the push; a minor one skips it and declares `NO_APP_LOGIC_CHANGE` after Step 4's push. A lint or format fix that edits a source file is full. A Step 2.5 repair always runs the full suite.
|
|
43
43
|
|
|
44
44
|
A fix that can't be made green locally is not pushed → Step 6.
|
|
45
45
|
|
|
46
46
|
### Step 4 — Commit + push
|
|
47
47
|
|
|
48
|
-
Commit per the `fix(ci): <check> — <what>` convention ([`../_shared/pr-followup-helpers/reply-routing.md`](../_shared/pr-followup-helpers/reply-routing.md)). Push. Append the new SHA to `last_seen.pushed_shas`. **No PR replies** — the fix commit is the response.
|
|
48
|
+
Commit per the `fix(ci): <check> — <what>` convention ([`../_shared/pr-followup-helpers/reply-routing.md`](../_shared/pr-followup-helpers/reply-routing.md)). Push. Append the new SHA to `last_seen.pushed_shas`. Then finish the tail [`cycle-size.md`](cycle-size.md) picked: a full fix reposts the walkthrough (a Step 2.5 repair settles it there instead), a minor one declares the skip. **No PR replies** — the fix commit is the response.
|
|
49
49
|
|
|
50
50
|
### Step 5 — Update state + respawn
|
|
51
51
|
|
|
@@ -80,3 +80,14 @@ recommendation: SKIPPED — placeholder branch, no code under test
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
`do/e2e-acceptance.md` Step 1.5 reads this and exits the stage cleanly with a SKIPPED verdict — do not silently run tests against master.
|
|
83
|
+
|
|
84
|
+
## Output state — cycleSize (watcher-dispatched cycles)
|
|
85
|
+
|
|
86
|
+
When the caller passes `pre_cycle_sha` ([`cycle-size.md`](cycle-size.md)), also list the paths this cycle changed, committed or not: `git diff --name-only --no-renames <pre_cycle_sha>` for tracked files, plus `git ls-files --others --exclude-standard` for new ones. Emit:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
cycleFiles: [<path>, ...]
|
|
90
|
+
cycleSize: <minor | full>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`minor` only when every path in `cycleFiles` is in the `NO_APP_LOGIC_CHANGE` path set defined in [`e2e-acceptance.md`](e2e-acceptance.md); otherwise `full`. The rest of this stage still runs against the default branch, so a full cycle's E2E routes from `pathClassification` as in a forward run.
|
|
@@ -14,6 +14,10 @@ Forward pipeline's Stage 7. Invoked by `/muggle-do` after stages 1–6 of a fres
|
|
|
14
14
|
- Requirements: goal, acceptance criteria.
|
|
15
15
|
- **Optional** E2E acceptance report from stage 6. Produced by [`../e2e-acceptance.md`](../e2e-acceptance.md); schema in [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md).
|
|
16
16
|
|
|
17
|
+
## Wave cycles
|
|
18
|
+
|
|
19
|
+
`state.md` records `Wave: on` → follow the Stage 7 ordering in [`../wave-e2e.md`](../wave-e2e.md): open every wave PR before settling any walkthrough, add the `## Wave` section to each body, give every member the same title prefix, and settle each PR's walkthrough with the same report (Mode A, PR number + repo passed explicitly). The per-repo steps below run with those changes.
|
|
20
|
+
|
|
17
21
|
## Per repo
|
|
18
22
|
|
|
19
23
|
0. **`autoCreatePR` gate** — apply per [`../../muggle-preferences/preference-gates/autoCreatePR.md`](../../muggle-preferences/preference-gates/autoCreatePR.md). On skip, record the reason in `result.md` and move on.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Update PR — address-reviews mode
|
|
2
2
|
|
|
3
|
-
Invoked by `/muggle-do`'s address-reviews orchestrator after
|
|
3
|
+
Invoked by `/muggle-do`'s address-reviews orchestrator after build, impact analysis, unit tests, and — for a full cycle — E2E ran on the existing PR. The PR already exists; this stage pushes the branch, refreshes title/description if state changed, and settles the walkthrough comment.
|
|
4
4
|
|
|
5
5
|
Does **not** create a PR, seed session state, or dispatch a watcher (`/muggle-do` respawns the watcher at the end of its address-reviews cycle).
|
|
6
6
|
|
|
@@ -15,6 +15,7 @@ Does **not** create a PR, seed session state, or dispatch a watcher (`/muggle-do
|
|
|
15
15
|
- Per-repo: path, branch (head ref name).
|
|
16
16
|
- The existing PR URL + number from `~/.muggle-ai/muggle-do/sessions/<slug>/prs.json`.
|
|
17
17
|
- **Optional** E2E acceptance report from stage 6. Produced by [`../e2e-acceptance.md`](../e2e-acceptance.md); schema in [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md).
|
|
18
|
+
- The cycle size and `pre_cycle_sha` per [`../cycle-size.md`](../cycle-size.md).
|
|
18
19
|
|
|
19
20
|
## Procedure
|
|
20
21
|
|
|
@@ -40,7 +41,9 @@ Resolve the provider once per [`../../_shared/vcs/detect-vcs.md`](../../_shared/
|
|
|
40
41
|
|
|
41
42
|
4. **Refresh body when validation outcome changed** — only when the `## Validation` section's content differs from what's in the body. Use the `--body-file` form in [`../../_shared/vcs/github/pr-edit.md`](../../_shared/vcs/github/pr-edit.md). Preserve `## Goal` and `## Acceptance Criteria` verbatim. Re-stamp the signature: delete the existing block from the `<!-- muggle-works:signature -->` marker to the end, then append the editable-body signature (command `/muggle-do`) as the last thing in the body per [`../../_shared/vcs/post-signature.md`](../../_shared/vcs/post-signature.md) — this keeps exactly one signature across refreshes.
|
|
42
43
|
|
|
43
|
-
5. **Visual walkthrough comment
|
|
44
|
+
5. **Visual walkthrough comment.**
|
|
45
|
+
- **An E2E report exists** (a full cycle, or Step 0's verify gate ran E2E) — fire [`postPRVisualWalkthrough`](../../muggle-preferences/preference-gates/postPRVisualWalkthrough.md) (PR number from `prs.json`); on skip, record `skipped (gate)` and continue. Otherwise invoke [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) Mode A, which settles the PR's designated walkthrough comment in place — one walkthrough per PR, always reflecting the latest run.
|
|
46
|
+
- **No report, minor cycle** — declare the `NO_APP_LOGIC_CHANGE` skip per [`../cycle-size.md`](../cycle-size.md) Minor tail. Step 1's push has landed, so HEAD is what the PR carries; the accepted declaration settles the designated comment. A rejected one makes the cycle full: run [`../e2e-acceptance.md`](../e2e-acceptance.md) on the pushed head, then take the branch above.
|
|
44
47
|
|
|
45
48
|
6. **Overflow comment** — same rule as forward mode: post when the walkthrough skill returns non-null `comment`, via [`../../_shared/vcs/github/top-level-comment.md`](../../_shared/vcs/github/top-level-comment.md). End the posted body with the signature line (command `/muggle-do`) per [`../../_shared/vcs/post-signature.md`](../../_shared/vcs/post-signature.md).
|
|
46
49
|
|
|
@@ -50,7 +53,7 @@ Return control to `/muggle-do`'s address-reviews orchestrator. The orchestrator
|
|
|
50
53
|
|
|
51
54
|
## Invariants
|
|
52
55
|
|
|
53
|
-
- Branch synced with its base before the push, never after; push; new SHA appended to `pushed_shas`; title/body refreshed only on state change; walkthrough comment via Mode A.
|
|
56
|
+
- Branch synced with its base before the push, never after; push; new SHA appended to `pushed_shas`; title/body refreshed only on state change; walkthrough comment via Mode A, or via the `NO_APP_LOGIC_CHANGE` skip after the push for a minor cycle.
|
|
54
57
|
- No `gh pr create`, no `/loop` dispatch.
|
|
55
58
|
|
|
56
59
|
## Output
|
|
@@ -59,5 +62,5 @@ Return control to `/muggle-do`'s address-reviews orchestrator. The orchestrator
|
|
|
59
62
|
**PR updated:** URL (new SHA: `<short-sha>`)
|
|
60
63
|
**Title refreshed:** yes | no
|
|
61
64
|
**Body refreshed:** yes | no
|
|
62
|
-
**Walkthrough comment:** posted | skipped (no report) | skipped (gate)
|
|
65
|
+
**Walkthrough comment:** posted | settled as skipped (`NO_APP_LOGIC_CHANGE`) | skipped (no report) | skipped (gate)
|
|
63
66
|
**Overflow comment:** posted | skipped
|
|
@@ -36,14 +36,15 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
36
36
|
- Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
|
|
37
37
|
- How many commits behind `origin/<default>`? `git -C <repo> fetch origin && git -C <repo> rev-list --count "HEAD..origin/$(git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short | sed 's|origin/||')"`.
|
|
38
38
|
10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
|
|
39
|
-
11. **
|
|
39
|
+
11. **Wave candidate?** Two or more candidate repos, one PR each, and validation leaning `local-e2e` → the cycle is a wave per [`wave-e2e.md`](wave-e2e.md): the repos' services start together from their branches and one E2E run covers every PR. Record each repo's worktree path for the `Wave members` block. Not a wave → note why.
|
|
40
|
+
12. **CI check present?** For each GitHub repo, whether `.github/workflows/muggle-walkthrough.yml` exists on its default branch. Missing and [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) resolves to `ask` → surface in Q14.
|
|
40
41
|
|
|
41
42
|
## The consolidated questionnaire
|
|
42
43
|
|
|
43
44
|
Present **one `AskUserQuestion`** (or the platform's structured-selection equivalent) that collects every remaining decision. Use detected values as defaults whenever possible. Questions to include, in this order:
|
|
44
45
|
|
|
45
46
|
1. **Task scope clarification** — only if the task description is genuinely ambiguous. Offer 2–3 interpretations as options plus "Other — type a clarification." If the task is unambiguous, omit.
|
|
46
|
-
2. **Repo(s) to modify** — pre-selected with the best silent match. "Confirm <repo>" / "Change repo" / "Multi-repo (list them)".
|
|
47
|
+
2. **Repo(s) to modify** — pre-selected with the best silent match. "Confirm <repo>" / "Change repo" / "Multi-repo (list them)". When multi-repo with one PR per repo, state in the option that the PRs ship as a wave tested together in one E2E run ([`wave-e2e.md`](wave-e2e.md)) — no separate question.
|
|
47
48
|
3. **Branch name** — default: `users/<user>/<slug>` derived from the task. "Use default" / "Use different name (type)".
|
|
48
49
|
4. **Validation strategy** — the single most important question. Options:
|
|
49
50
|
- **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
|
|
@@ -59,7 +60,7 @@ Present **one `AskUserQuestion`** (or the platform's structured-selection equiva
|
|
|
59
60
|
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
60
61
|
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
61
62
|
13. **Run E2E at the end of every cycle?** — gate: [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md), only if step 10's silent detection resolved to `ask`. Options: always run stage 6, or ask each cycle.
|
|
62
|
-
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step
|
|
63
|
+
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 12 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
63
64
|
|
|
64
65
|
If fewer than two of the above need the user, still gather them in a single turn — never open a second round.
|
|
65
66
|
|
|
@@ -78,6 +79,8 @@ After the user answers, write **`state.md`** with every resolved value, verbatim
|
|
|
78
79
|
|
|
79
80
|
- Task: <one-line goal>
|
|
80
81
|
- Repos: <repo1>, <repo2>
|
|
82
|
+
- Wave: <on | off — reason | N/A (single repo)>
|
|
83
|
+
- Wave members: <one line per repo when on — `<owner/repo> → <worktree path> (branch <branch>)`; see wave-e2e.md>
|
|
81
84
|
- Branch: <branch-name>
|
|
82
85
|
- Validation: <strategy>
|
|
83
86
|
- Local URL: <url or N/A>
|