Skip to content

Commit deedaed

Browse files
authored
feat: finish first-minute guidance and gate release timing (#1178)
* feat: complete cold first-run guidance and release checks * test: assert the candidate timing gate in release stages * docs: record the hosted first-minute timing matrix
1 parent 8aee701 commit deedaed

14 files changed

Lines changed: 134 additions & 30 deletions

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ jobs:
4343
release_gate_fixture: ${{ inputs.release_gate_fixture || false }}
4444
first-minute:
4545
needs: [npm-candidate]
46-
if: ${{ !cancelled() && needs.npm-candidate.result == 'success' && inputs.dry_run }}
46+
if: ${{ !cancelled() && needs.npm-candidate.result == 'success' }}
4747
uses: ./.github/workflows/first-minute.yml # zizmor: ignore[self-repository] -- measure this release's candidate artifact
4848
with:
4949
candidate: true
5050

5151
# The npm publish lives here, not in a reusable stage: Scorecard's Packaging check needs a publish in a workflow with its own runs.
5252
npm-publish:
53-
needs: [npm-candidate]
54-
if: ${{ !cancelled() && needs.npm-candidate.result == 'success' }}
53+
needs: [first-minute]
54+
if: ${{ !cancelled() && needs.first-minute.result == 'success' }}
5555
runs-on: ubuntu-latest
5656
timeout-minutes: 10
5757
permissions:

‎changes/389-autopilot-no-fixes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Explain when the first forecast has no offline Autopilot fixes and omit an empty preview command.

‎docs/QUICKSTART.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ npx --yes @velella/offing
2020

2121
No subcommand is needed. Offing scans the current directory and prints the top findings and upcoming lifecycle deadlines. After installation, it reads repository files such as manifests, lockfiles, workflows, and source files, plus local Ebb lifecycle data. The first run never prompts, writes files, or uses the network. If Git history is unavailable, it still scans the files on disk. For the full report with finding IDs, replacements, and evidence, run `npx --yes @velella/offing scan .`. Use `npx --yes @velella/offing --json` for the structured forecast without the next-step hints.
2222

23-
If the first Autopilot wave has confirmed offline codemods, the forecast ends with their count. Run `offing autopilot . --dry-run --wave 0` to see which findings have a deterministic edit available. The preview uses the current files without applying patches or running tests.
23+
If the first Autopilot wave has confirmed offline codemods, the forecast ends with their count. Run `npx --yes @velella/offing autopilot . --dry-run --wave 0` to see which findings have a deterministic edit available. The preview uses the current files without applying patches or running tests. If the wave has no offline fixes, the forecast says there is nothing for Autopilot to fix and omits the preview command.
2424

25-
The bare invocation starts working with the release that includes this change. To try it before then, use a checkout of Offing as shown below.
25+
The bare invocation requires Offing 0.1.2 or later. Use a checkout of Offing to try it before release.
2626

2727
### Try the demo
2828

@@ -55,15 +55,15 @@ On macOS arm64 with Node.js 22.23.1 and npm 10.9.8, a clean-cache `npx` install
5555

5656
### Time to the first forecast
5757

58-
A hosted release dry run measured a local candidate tarball on three pinned public repositories. Each run used a fresh npm cache and measured dependency downloads, installation, and the first forecast. The weekly run uses an exact published npm version and also measures transfer of the Offing tarball itself.
58+
A hosted release dry run measured a candidate tarball on three pinned public repositories. Each run used a fresh npm cache and measured dependency downloads, installation, and the first forecast. The weekly run uses an exact published npm version and also measures transfer of the Offing tarball itself.
5959

6060
| Hosted runner | Node.js 22.23.5 | Node.js 24.22.3 |
6161
| --- | ---: | ---: |
62-
| Linux x64 | 2.875–3.310 s | 3.961–4.513 s |
63-
| macOS arm64 | 4.761–5.152 s | 3.003–4.766 s |
64-
| Windows x64 | 10.987–12.888 s | 7.067–8.798 s |
62+
| Linux x64 | 2.687–3.249 s | 3.691–4.264 s |
63+
| macOS arm64 | 4.727–7.012 s | 4.279–7.011 s |
64+
| Windows x64 | 6.873–16.733 s | 7.369–9.430 s |
6565

66-
The dry run and weekly benchmark require each first forecast in under 10 seconds and retain timings when a runner misses. In this candidate run, Windows with Node.js 22 exceeded the budget. Downloads and installation overlap, so the reports show the tarball download span, npm's full install phase, and the time after install separately. [Candidate timing evidence](https://github.com/velella-sh/offing/actions/runs/45940201878) · [Weekly First minute runs](https://github.com/velella-sh/offing/actions/workflows/first-minute.yml)
66+
The release, dry run, and weekly benchmark require each first forecast in under 10 seconds and retain timings when a runner misses. One Windows run with Node.js 22 exceeded the budget and blocked the dry run's publish stage. The timing report separates the tarball download span, npm's full install phase (which includes downloads), and time after install. [Candidate timing evidence](https://github.com/velella-sh/offing/actions/runs/46086052323) · [Weekly First minute runs](https://github.com/velella-sh/offing/actions/workflows/first-minute.yml)
6767

6868
## 2. Check one dependency before adding it
6969

‎docs/RELEASING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Every gate must pass on the commit you will tag. None of them is optional.
2727

2828
The last weekly run of the corpus workflow should also be green. If either is red, fix or explain it before tagging.
2929

30-
Run `gh workflow run release.yml -f dry_run=true -f from=vX.Y.Z` to collect first-minute evidence for an unpublished candidate. Use the latest published tag for the notes baseline. The check requires a forecast in under 10 seconds on each supported runner pair and uploads its timing artifacts even when a pair misses the budget. This performance check runs in the no-publish dry run and the weekly [First minute workflow](../.github/workflows/first-minute.yml).
30+
Run `gh workflow run release.yml -f dry_run=true -f from=vX.Y.Z` to collect first-minute evidence for an unpublished candidate. Use the latest published tag for the notes baseline. The check requires a forecast in under 10 seconds on each supported runner pair and uploads its timing artifacts even when a pair misses the budget. The exact candidate must pass the same check before npm publication. The published package is also measured by the weekly [First minute workflow](../.github/workflows/first-minute.yml).
3131

3232
## Action bundles on release tags
3333

‎package.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@
9090
"skills",
9191
"!schemas/vendor",
9292
"!**/*.map",
93+
"!dist/src/agent-hooks/**/*.d.ts",
94+
"!dist/src/commands/**/*.d.ts",
95+
"!dist/src/drift/**/*.d.ts",
96+
"!dist/src/fix/**/*.d.ts",
97+
"!dist/src/forecast-tool/**/*.d.ts",
98+
"!dist/src/inventory/**/*.d.ts",
99+
"!dist/src/reporters/**/*.d.ts",
93100
"!skills/**/evals"
94101
],
95102
"scripts": {

‎src/cli-main.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ export async function run(rawArgs: readonly string[] = process.argv.slice(2)): P
4242
try {
4343
return await main(rawArgs);
4444
} catch (error) {
45-
const { code, kind } = classifyError(error);
46-
// Only Offing and Ebb errors classify as anything but internal, and both are Errors.
47-
if (kind !== "internal" && error instanceof Error) return fail(kind, error.message, "", code);
48-
const { message, appendix } = unexpectedFailure(error, cliOptionArgs(rawArgs).includes("--debug"));
49-
return fail("internal", message, appendix, code);
45+
return reportCliFailure(error, rawArgs);
5046
}
5147
}
48+
49+
export function reportCliFailure(error: unknown, rawArgs: readonly string[]): number {
50+
const { code, kind } = classifyError(error);
51+
// Only Offing and Ebb errors classify as anything but internal, and both are Errors.
52+
if (kind !== "internal" && error instanceof Error) return fail(kind, error.message, "", code);
53+
const { message, appendix } = unexpectedFailure(error, cliOptionArgs(rawArgs).includes("--debug"));
54+
return fail("internal", message, appendix, code);
55+
}

‎src/cli.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ if (nodeProblem) {
3030
// Answered before the command table loads: `cli-main` pulls in every detector, so `--version` would pay for a scan.
3131
const { VERSION } = await import("./version.js");
3232
process.stdout.write(`${VERSION}\n`);
33+
} else if (rawArgs.length === 0) {
34+
try {
35+
const { runFirstForecast } = await import("./onboarding/first-run.js");
36+
process.exitCode = await runFirstForecast();
37+
} catch (error) {
38+
const { reportCliFailure } = await import("./cli-main.js");
39+
process.exitCode = reportCliFailure(error, rawArgs);
40+
}
3341
} else if (await runPromptFastPath(args)) {
3442
// `prompt` runs on every shell prompt, so it is answered before the command table and every detector load.
3543
} else if (isHookRequest(args)) {

‎src/onboarding/first-run.ts‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import process from "node:process";
55
import { parseArgs, promisify } from "node:util";
66
import { DEFAULT_FORECAST_MONTHS } from "@velella/ebb/forecast";
77
import { isIsoDate } from "@velella/ebb/registry";
8-
import { command as forecastCommand } from "../commands/forecast.js";
98
import type { CommandContext } from "../commands/types.js";
109
import type { ScanResult } from "../domain.js";
1110
import { forecastWeather, locationText, singleLine } from "../forecast-core.js";
@@ -73,8 +72,15 @@ export async function runOnboarding(args: readonly string[], ctx: CommandContext
7372
return ctx.fail("usage", "Usage: offing [--as-of <YYYY-MM-DD>] [--json]");
7473
}
7574
if (asOf !== undefined && !isIsoDate(asOf)) return ctx.fail("usage", "--as-of must be a date (YYYY-MM-DD).");
76-
if (json) return forecastCommand.run(asOf === undefined ? ["--json"] : ["--json", "--as-of", asOf], ctx, true);
75+
if (json) {
76+
const { command } = await import("../commands/forecast.js");
77+
return command.run(asOf === undefined ? ["--json"] : ["--json", "--as-of", asOf], ctx, true);
78+
}
79+
return runFirstForecast(asOf);
80+
}
7781

82+
/** The bare executable shares this path without importing the full command table. */
83+
export async function runFirstForecast(asOf?: string): Promise<number> {
7884
const root = process.cwd();
7985
const [scan, entries, history] = await Promise.all([
8086
scanWithBuiltIns(root, asOf === undefined ? { noCache: true } : replayScanOptions(asOf)),
@@ -91,11 +97,21 @@ export async function runOnboarding(args: readonly string[], ctx: CommandContext
9197
),
9298
);
9399
// Historical forecasts have no equivalent Autopilot invocation.
94-
if (asOf === undefined && scan.findings.length > 0) {
100+
if (asOf === undefined) await printAutopilotPreview(scan);
101+
return 0;
102+
}
103+
104+
async function printAutopilotPreview(scan: ScanResult): Promise<void> {
105+
let count = 0;
106+
if (scan.findings.length > 0) {
95107
const { countFirstWaveCodemods } = await import("../autopilot/plan.js");
96-
const count = await countFirstWaveCodemods(scan).catch(() => 0);
97-
if (count > 0)
98-
process.stdout.write(`Autopilot can fix ${count}; run offing autopilot . --dry-run --wave 0 to preview.\n`);
108+
const assessed = await countFirstWaveCodemods(scan).catch(() => undefined);
109+
if (assessed === undefined) return;
110+
count = assessed;
99111
}
100-
return 0;
112+
process.stdout.write(
113+
count === 0
114+
? "There is nothing for Autopilot to fix.\n"
115+
: `Autopilot can fix ${count}; run offing autopilot . --dry-run --wave 0 to preview.\n`,
116+
);
101117
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
examples/gallery/nodejs: Autopilot can fix 1; run offing autopilot . --dry-run --wave 0 to preview.
2+
examples/demo: There is nothing for Autopilot to fix.

‎tests/first-run-empty.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ test("bare Offing explains what to scan and how to try a demo in an empty folder
1212
assert.equal(result.code, 0, result.stderr);
1313
assert.match(result.stdout, /^Weather: clear\nForecast:/);
1414
assert.match(result.stdout, /This folder is empty\. Offing looks for manifests, lockfiles, and CI workflows\./);
15+
assert.match(result.stdout, /There is nothing for Autopilot to fix\.\n$/);
16+
assert.doesNotMatch(result.stdout, /offing autopilot/);
1517
assert.match(result.stdout, /Try the demo: https:\/\/.*QUICKSTART\.md#try-the-demo/);
1618
});

0 commit comments

Comments
 (0)