Skip to content

Commit f080943

Browse files
committed
fix(config): lock the ignored --no-workflow shim
1 parent 09a40d0 commit f080943

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
@@ -750,6 +750,7 @@ Flags:
750750
the default settings file is machine-wide;
751751
--config selects another source
752752
--auto / --no-auto auto mode on/off
753+
--no-workflow deprecated and ignored
753754
--help, -h show this help
754755
--version, -V show version
755756
`;
@@ -960,9 +961,9 @@ export async function loadConfig(
960961
auto = false;
961962
continue;
962963
}
963-
// CL-10755: deprecated no-op retained for one release as warn-and-ignore
964-
// so existing `--no-workflow` wrappers keep starting instead of hitting
965-
// the catch-all "unrecognized flag" error below.
964+
// Warn-and-ignore so existing `--no-workflow` wrappers keep starting
965+
// instead of the unrecognized-flag error. Do not consume the next token
966+
// or set a config field.
966967
if (arg === "--no-workflow") {
967968
process.stderr.write(
968969
"--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
@@ -215,22 +215,29 @@ test("loadConfig --no-auto disables auto mode", async () => {
215215
});
216216
});
217217

218-
// CL-10755: --no-workflow is a deprecated no-op. It must stay accepted for
219-
// one release (stderr warn-and-ignore) instead of hitting the catch-all
220-
// "unrecognized flag" error.
218+
// Warn-and-ignore: the flag must not consume the following task token or
219+
// change parsed command/auto versus the same argv without it.
221220
test("loadConfig --no-workflow warns and is ignored", async () => {
222221
await withSettings(async ({ cwd, globalSettingsPath }) => {
223222
const { impl } = offlineFetch();
224223
const stderr = captureStderr();
225224
try {
225+
const options = {
226+
globalSettingsPath,
227+
pricing: { fetchImpl: impl },
228+
};
226229
const config = await loadConfig(
227230
["--cwd", cwd, "--no-workflow", "do something"],
228-
{
229-
globalSettingsPath,
230-
pricing: { fetchImpl: impl },
231-
},
231+
options,
232+
);
233+
const baseline = await loadConfig(
234+
["--cwd", cwd, "do something"],
235+
options,
232236
);
233237
expect(config.configured).toBe(true);
238+
expect(config.task).toBe(baseline.task);
239+
expect(config.command).toBe(baseline.command);
240+
expect(config.auto).toBe(baseline.auto);
234241
expect(stderr.output()).toContain(
235242
"--no-workflow is deprecated and has no effect; ignoring.",
236243
);

0 commit comments

Comments
 (0)