Skip to content

Commit 2c4d182

Browse files
committed
probe: run nightly on a branch tip and print the generated patch sections (#3293)
Scratch branch for evidence only; it is deleted after the run and nothing here is meant to merge. It adds the `Fetch origin/main for arch-docs check` step the composite action already runs (nightly.yml omits it, so a branch dispatch dies in lint at arch-docs:FAIL — cannot diff against origin/main), and a step that runs `node scripts/ds-bot-patches.mjs generate` and prints the generated sections for the three upstream test files this task edits. Written-by: Dev-8570 Docs-not-needed: scratch branch, deleted after the evidence run.
1 parent b38f41e commit 2c4d182

2 files changed

Lines changed: 73 additions & 0 deletions

File tree

‎.github/workflows/nightly.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ jobs:
8989
node-version: ${{ matrix.node }}
9090
cache: npm
9191
cache-dependency-path: core/package-lock.json
92+
- name: Probe scratch: print the generated test patch sections (#3293)
93+
if: github.event_name == 'workflow_dispatch'
94+
shell: bash
95+
run: |
96+
node ../scripts/ds-bot-patches.mjs generate
97+
git -C .. status --porcelain
98+
node ../scripts/probe-sections.mjs test/diagnostics.test.js test/secrets.test.js test/group-work.test.js
9299
- name: npm ci
93100
run: npm ci --no-fund --no-audit
94101
timeout-minutes: 5
@@ -97,6 +104,22 @@ jobs:
97104
timeout-minutes: 5
98105
env:
99106
DSH: ${{ matrix.dsh }}
107+
- name: Fetch origin/main for arch-docs check (scratch probe)
108+
shell: bash
109+
run: |
110+
set -euo pipefail
111+
git fetch --no-tags --depth=1 origin +main:refs/remotes/origin/main
112+
for n in 50 200 1000 5000; do
113+
if git merge-base origin/main HEAD >/dev/null 2>&1; then
114+
break
115+
fi
116+
git fetch --no-tags --deepen="$n" origin main 2>/dev/null || true
117+
git fetch --no-tags --deepen="$n" origin HEAD 2>/dev/null || true
118+
done
119+
if ! git merge-base origin/main HEAD >/dev/null 2>&1; then
120+
git fetch --unshallow 2>/dev/null || git fetch --no-tags origin main
121+
fi
122+
git rev-parse --verify origin/main^{commit}
100123
- name: Lint
101124
run: npm run lint
102125
- name: Build (client bundle is up to date)
@@ -151,6 +174,13 @@ jobs:
151174
node-version: ${{ matrix.node }}
152175
cache: npm
153176
cache-dependency-path: core/package-lock.json
177+
- name: Probe scratch: print the generated test patch sections (#3293)
178+
if: github.event_name == 'workflow_dispatch'
179+
shell: bash
180+
run: |
181+
node ../scripts/ds-bot-patches.mjs generate
182+
git -C .. status --porcelain
183+
node ../scripts/probe-sections.mjs test/diagnostics.test.js test/secrets.test.js test/group-work.test.js
154184
- name: npm ci
155185
run: npm ci --no-fund --no-audit
156186
timeout-minutes: 5
@@ -159,6 +189,22 @@ jobs:
159189
timeout-minutes: 5
160190
env:
161191
DSH: ${{ matrix.dsh }}
192+
- name: Fetch origin/main for arch-docs check (scratch probe)
193+
shell: bash
194+
run: |
195+
set -euo pipefail
196+
git fetch --no-tags --depth=1 origin +main:refs/remotes/origin/main
197+
for n in 50 200 1000 5000; do
198+
if git merge-base origin/main HEAD >/dev/null 2>&1; then
199+
break
200+
fi
201+
git fetch --no-tags --deepen="$n" origin main 2>/dev/null || true
202+
git fetch --no-tags --deepen="$n" origin HEAD 2>/dev/null || true
203+
done
204+
if ! git merge-base origin/main HEAD >/dev/null 2>&1; then
205+
git fetch --unshallow 2>/dev/null || git fetch --no-tags origin main
206+
fi
207+
git rev-parse --verify origin/main^{commit}
162208
- name: Lint
163209
run: npm run lint
164210
- name: Build (client bundle is up to date)

‎scripts/probe-sections.mjs‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Scratch-branch helper (#3293 windows evidence): print, from the freshly generated
2+
// patch series, the section that belongs to each named file, so it can be carried back
3+
// to a machine without git. Not part of any shipped tree.
4+
import { readFileSync, readdirSync } from 'node:fs'
5+
import { dirname, join } from 'node:path'
6+
import { fileURLToPath } from 'node:url'
7+
8+
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)))
9+
const PATCHES = join(ROOT, 'patches', 'ds-bot')
10+
const series = readdirSync(PATCHES).filter(name => /^\d{4}-.*\.patch$/.test(name)).sort()
11+
12+
for (const file of process.argv.slice(2)) {
13+
const marker = `diff --git a/${file} b/${file}\n`
14+
let found = false
15+
for (const patch of series) {
16+
const text = readFileSync(join(PATCHES, patch), 'utf8')
17+
const start = text.indexOf(marker)
18+
if (start < 0) continue
19+
found = true
20+
const next = text.indexOf('diff --git ', start + marker.length)
21+
const section = text.slice(start, next < 0 ? text.length : next)
22+
console.log(`===== BEGIN ${file} (${patch}) =====`)
23+
process.stdout.write(section.endsWith('\n') ? section : `${section}\n`)
24+
console.log(`===== END ${file} (${patch}) =====`)
25+
}
26+
if (!found) console.log(`===== ABSENT ${file} =====`)
27+
}

0 commit comments

Comments
 (0)