Skip to content

Commit f009f1e

Browse files
committed
fix(config): lock the ignored --no-workflow shim
1 parent 13339e6 commit f009f1e

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

‎src/config/index.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ Flags:
747747
the default settings file is machine-wide;
748748
--config selects another source
749749
--auto / --no-auto auto mode on/off
750+
--no-workflow deprecated and ignored
750751
--help, -h show this help
751752
--version, -V show version
752753
`;
@@ -957,9 +958,9 @@ export async function loadConfig(
957958
auto = false;
958959
continue;
959960
}
960-
// CL-10755: deprecated no-op retained for one release as warn-and-ignore
961-
// so existing `--no-workflow` wrappers keep starting instead of hitting
962-
// the catch-all "unrecognized flag" error below.
961+
// Warn-and-ignore so existing `--no-workflow` wrappers keep starting
962+
// instead of the unrecognized-flag error. Do not consume the next token
963+
// or set a config field.
963964
if (arg === "--no-workflow") {
964965
process.stderr.write(
965966
"--no-workflow is deprecated and has no effect; ignoring.\n",

‎src/config/settings.test.ts‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,29 @@ test("loadConfig --no-auto disables auto mode", async () => {
202202
});
203203
});
204204

205-
// CL-10755: --no-workflow is a deprecated no-op. It must stay accepted for
206-
// one release (stderr warn-and-ignore) instead of hitting the catch-all
207-
// "unrecognized flag" error.
205+
// Warn-and-ignore: the flag must not consume the following task token or
206+
// change parsed command/auto versus the same argv without it.
208207
test("loadConfig --no-workflow warns and is ignored", async () => {
209208
await withSettings(async ({ cwd, globalSettingsPath }) => {
210209
const { impl } = offlineFetch();
211210
const stderr = captureStderr();
212211
try {
212+
const options = {
213+
globalSettingsPath,
214+
pricing: { fetchImpl: impl },
215+
};
213216
const config = await loadConfig(
214217
["--cwd", cwd, "--no-workflow", "do something"],
215-
{
216-
globalSettingsPath,
217-
pricing: { fetchImpl: impl },
218-
},
218+
options,
219+
);
220+
const baseline = await loadConfig(
221+
["--cwd", cwd, "do something"],
222+
options,
219223
);
220224
expect(config.configured).toBe(true);
225+
expect(config.task).toBe(baseline.task);
226+
expect(config.command).toBe(baseline.command);
227+
expect(config.auto).toBe(baseline.auto);
221228
expect(stderr.output()).toContain(
222229
"--no-workflow is deprecated and has no effect; ignoring.",
223230
);

0 commit comments

Comments
 (0)