Skip to content

Commit 9bf3286

Browse files
fix(devx): point shallow-clone refusals at ci.yml's history fetch step (#31667)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbASbE5AXy68rApzP2nGVtXY)_ Fixes #31649 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:五个门禁脚本在浅克隆时的拒绝提示文案。原来只叫 CI 设 `fetch-depth: 0`,现在同时点名 ci.yml 的取历史步骤与 lint.yml 的全量检出。 - 为什么改:ci.yml 读历史的作业已改为深度 1 检出加取历史步骤,旧提示会把 CI 读者引向错误的修法。 - 风险与回滚:只改提示字符串与两处断言,退出码与逻辑不动;回滚即 revert 本 PR。 - 先看:`packages/spec/scripts/build-schemas.ts` 的 remedy 串;`ui/scripts/check-changeset-presence.mjs` 的 SHALLOW 分支;`ui/scripts/__tests__/check-changeset-presence.test.ts` 的浅克隆用例。 - 两分钟验证:`pnpm --dir ui exec vitest run scripts/__tests__/check-changeset-presence.test.ts`,预期全绿,且浅克隆用例断言了步骤名。 - 需要你做的:无,席位落地。 ## What changes On main 532230f, five shallow-clone refusal messages told a CI reader that the fix was `fetch-depth: 0`. That is no longer what works in a `ci.yml` job that reads history. Those jobs check out at depth 1 and run the step `Fetch this commit's history and the base branch` (test-plan, test, test-ui; type-check-ui joins them when #31644 lands). `lint.yml` still checks out with `fetch-depth: 0`. Each message's "In CI" clause now names both remedies: run that step before the gate (ci.yml), or give the checkout `fetch-depth: 0` (lint.yml). The local advice, exit codes and every other line are unchanged. No logic changes, and no workflow file is touched. | Script | Who runs it | Change | |:--|:--|:--| | `packages/spec/scripts/build-schemas.ts` (`resolveBaselineWithoutMergeBase` remedy) | spec's `build` in every job that builds spec (both kinds), and `check:authorable-surface` in lint.yml | both remedies named | | `ui/scripts/check-new-cross-file-line-citations.mjs` | no workflow step on main | both remedies named, generically | | `ui/scripts/check-changeset-claims.mjs` | no workflow step on main | both remedies named, generically | | `ui/scripts/check-changeset-overwrite.mjs` | same text, added by Claim amendment 6726615830 | same wording | | `ui/scripts/check-changeset-presence.mjs` | same text, added by Claim amendment 6726615830 | same wording | **About #31644:** the wording is conditional on the job's shape ("in a job that runs the step, or a full checkout"), so it holds whether #31644 has landed or not. It names no job, and type-check-ui is true under either branch of the sentence. `check-i18n-en-drift.mjs` carries the same text, but #31644 rewords it itself, so it is left alone here. **Changeset:** `skip-changeset`. These are repository scripts and tests. `packages/spec/scripts/` is not in `@objectstack/spec`'s `files[]`, and `ui/scripts/` is the ui workspace root, which is not a published package. ## Tests The pins move with the prose. Both still assert `fetch-depth: 0`, and each now also asserts the step name: - `packages/spec/scripts/build-schemas-check-mode.git-topology.test.ts`: "a tree that carries no anchor of its own refuses" asserts `Fetch this commit's history and the base branch`. - `ui/scripts/__tests__/check-changeset-presence.test.ts`: the depth-1 clone case asserts the same. No pin asserted the old text of the other three messages. A grep of the tests for each old string returned no other hits. ## Acceptance notes - Two nearby strings in `build-schemas.ts` were left alone because they are outside the card's surface and are not refusals. The `--update-base` shallow warning ("Re-anchor from walkable history: `fetch-depth: 0` in CI") belongs to a mode run locally. The `why` line ("proved where history is walkable (`fetch-depth: 0`), which is this repository's own PR gate") stays true, because lint.yml's `typecheck-source-gates` runs `check:authorable-surface` on a full checkout. - `check:new-line-citations` and `check:changeset-claims` are not run as a step by any workflow on main, so their "In CI" line can only describe the two job shapes. ## Verification All runs below are on head `243250a6`. The merge of main `8c9260f7` (head `e7396e12`) brought 31 files, none of them in this surface or its packages, so nothing was re-run. <details><summary>Dispatch gates: 66 derived, 65 run, 1 NOT MEASURED</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 66 commands. All exited 0 except one. - NOT MEASURED: `pnpm check:dual-build-cjs-loads` exited 3 (PREREQUISITE NOT MET: about 33 packages have no `dist/`). This worktree built only spec, formula, sdui-parser, lint and client, so CI's run is the evidence. - `node scripts/check-plugin-teardown-shape.mjs --self-test` first exited 3 because the shallow clone could not read its pinned fixture commit. After `git fetch --depth=1 origin 621a487`, it exited 0 with 48 cases. - `pnpm check:query-options-erasure` hit the loop's 300 s timeout. Run alone, it exited 0. - `pnpm --dir ui exec vitest run scripts/` exited 0: 170 files passed and 2 skipped; 5021 tests passed and 2 skipped. - `pnpm check:pm-dispatch-gates` exited 0: 2205 fast-tier cases. - `dispatch-gates --ran`: 66 derived families accounted for (65 run, 1 NOT MEASURED). </details> <details><summary>Pins: red on main's text, green on the fix</summary> - Red leg: `git restore --source=532230f3` of `check-changeset-presence.mjs` and `build-schemas.ts`, tree only. "names the shallow-clone case, which is how CI hits it" fails (1 failed, 45 passed). "a tree that carries no anchor of its own refuses" fails (1 failed). Both files were then restored to HEAD, and `git diff HEAD` was empty. - Green: `build-schemas-check-mode.git-topology.test.ts` passed 17/17. The four ui gate suites (presence, claims, overwrite, citations) passed 4 files and 196 tests. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jQqimUnb4io8LpGcvH)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent cd43416 commit 9bf3286

7 files changed

Lines changed: 20 additions & 9 deletions

‎packages/spec/scripts/build-schemas-check-mode.git-topology.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ describe('build-schemas.ts — a shallow checkout re-anchors the deletion gate,
832832
expect(status).toBe(1);
833833
expect(output).toContain('No baseline to anchor the deletion checks on');
834834
expect(output).toContain('authorable-surface.base.json');
835+
// Both CI remedies: ci.yml's history fetch step, and lint.yml's full checkout.
836+
expect(output).toContain("Fetch this commit's history and the base branch");
835837
expect(output).toContain('fetch-depth: 0');
836838
expect(output).not.toContain('anchors on the origin/main TIP');
837839
expect(output).not.toContain('deleted without proof');

‎packages/spec/scripts/build-schemas.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,8 +2426,9 @@ function resolveBaselineWithoutMergeBase(
24262426
committed: AuthorableSurfaceBase | null,
24272427
): { rev: string; why: string } | { refusal: string } {
24282428
const remedy =
2429-
` A checkout with walkable history anchors on the merge base instead: in CI the\n` +
2430-
` checkout step needs \`fetch-depth: 0\`; locally, \`git fetch --unshallow origin\`.`;
2429+
` A checkout with walkable history anchors on the merge base instead: in CI, run the\n` +
2430+
` step \`Fetch this commit's history and the base branch\` before this build (ci.yml), or\n` +
2431+
` give the checkout \`fetch-depth: 0\` (lint.yml); locally, \`git fetch --unshallow origin\`.`;
24312432
if (!committed) {
24322433
return {
24332434
refusal:

‎ui/scripts/__tests__/check-changeset-presence.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ describe('a missing input is a failure, never a silent pass', () => {
914914
expect(run.status).toBe(1);
915915
expect(run.output).toMatch(/SHALLOW/);
916916
expect(run.output).toMatch(/fetch-depth: 0/);
917+
expect(run.output).toContain("Fetch this commit's history and the base branch");
917918
});
918919

919920
it('FAILS when .changeset/ does not exist', () => {

‎ui/scripts/check-changeset-claims.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,8 +1421,10 @@ if (isEntrypoint(import.meta.url)) {
14211421
? ' That base was named EXPLICITLY, so it is not guessed around. Name a commit that\n' +
14221422
' exists in this clone, or pass none.\n'
14231423
: base.shallow
1424-
? ' This clone is SHALLOW. In CI, give the checkout `fetch-depth: 0`; locally, run\n' +
1425-
' `git fetch --no-tags origin main` (or `git fetch --unshallow`).\n'
1424+
? ' This clone is SHALLOW. In CI, run the step\n' +
1425+
" `Fetch this commit's history and the base branch` before this gate (ci.yml), or give the\n" +
1426+
' checkout `fetch-depth: 0` (lint.yml); locally, run `git fetch --no-tags origin main`\n' +
1427+
' (or `git fetch --unshallow`).\n'
14261428
: ' Fetch the base branch (`git fetch --no-tags origin main`) and re-run.\n') +
14271429
' A failure, not a skip: report-only means this gate declines to fail on its FINDINGS,\n' +
14281430
' never that it passes without looking (objectstack#4928, objectui#4690).',

‎ui/scripts/check-changeset-overwrite.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,10 @@ if (isEntrypoint(import.meta.url)) {
295295
' some other commit would answer a question nobody asked, and answer it\n' +
296296
' confidently. Name a commit that exists in this clone, or pass none.\n'
297297
: base.shallow
298-
? ' This clone is SHALLOW. In CI, give the checkout `fetch-depth: 0`; locally,\n' +
299-
' run `git fetch --no-tags origin main` (or `git fetch --unshallow`).\n'
298+
? ' This clone is SHALLOW. In CI, run the step\n' +
299+
" `Fetch this commit's history and the base branch` before this gate (ci.yml), or give the\n" +
300+
' checkout `fetch-depth: 0` (lint.yml); locally, run `git fetch --no-tags origin main`\n' +
301+
' (or `git fetch --unshallow`).\n'
300302
: ' Fetch the base branch (`git fetch --no-tags origin main`) and re-run.\n') +
301303
' A failure, not a skip: report-only means this gate declines to fail on its\n' +
302304
' FINDINGS, never that it passes without looking (objectstack#4928, objectui#4690).',

‎ui/scripts/check-changeset-presence.mjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,10 @@ if (invokedDirectly) {
11001100
' confidently. Name a commit that exists in this clone, or pass none and let the\n' +
11011101
' merge base with the target branch be found.\n'
11021102
: base.shallow
1103-
? ' This clone is SHALLOW. In CI, give the checkout `fetch-depth: 0`; locally,\n' +
1104-
' run `git fetch --no-tags origin main` (or `git fetch --unshallow`).\n'
1103+
? ' This clone is SHALLOW. In CI, run the step\n' +
1104+
" `Fetch this commit's history and the base branch` before this gate (ci.yml), or give the\n" +
1105+
' checkout `fetch-depth: 0` (lint.yml); locally, run `git fetch --no-tags origin main`\n' +
1106+
' (or `git fetch --unshallow`).\n'
11051107
: ' Fetch the base branch (`git fetch --no-tags origin main`) and re-run.\n') +
11061108
' This is a failure, not a skip: a diff gate with no diff would report a\n' +
11071109
' declaration present while having looked at nothing (objectstack#4928).',

‎ui/scripts/check-new-cross-file-line-citations.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ function main(argv, env = process.env) {
502502
' This run measured NOTHING. It is not a green, and it is not a red about any citation.',
503503
);
504504
console.error(
505-
' In CI the checkout needs `fetch-depth: 0`; locally, `git fetch origin main` first, or',
505+
" In CI, run the step `Fetch this commit's history and the base branch` before this gate\n" +
506+
' (ci.yml), or give the checkout `fetch-depth: 0` (lint.yml); locally, `git fetch origin main` first, or',
506507
);
507508
console.error(' name a base explicitly with `--base <ref>`.');
508509
return EXIT_CODES.couldNotRun;

0 commit comments

Comments
 (0)