Skip to content

Commit 986b665

Browse files
committed
fix: normalize CI artifact paths and capture framework build diagnostics
1 parent 0c9df22 commit 986b665

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

‎.github/workflows/vextjs-ci.yml‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ jobs:
3333
cache: npm
3434
- run: npm ci
3535
- run: npm run build && npm run build:tests
36+
- id: paths
37+
name: Resolve physical artifact paths
38+
shell: bash
39+
run: |
40+
node --input-type=module - <<'JS'
41+
import path from 'node:path';
42+
import { appendFileSync, mkdirSync } from 'node:fs';
43+
const artifacts = path.resolve(process.env.CG_ARTIFACTS_DIR);
44+
const framework = path.resolve(process.env.VEXT_ROOT);
45+
const verification = path.join(artifacts, 'verification');
46+
mkdirSync(verification, {recursive:true});
47+
appendFileSync(process.env.GITHUB_ENV, `CG_ARTIFACTS_DIR=${artifacts}\nVEXT_ROOT=${framework}\n`);
48+
appendFileSync(process.env.GITHUB_OUTPUT, `verification=${verification}\n`);
49+
JS
3650
- name: Fetch and verify the fixed framework source outside the project
3751
shell: bash
3852
run: |
@@ -45,7 +59,13 @@ jobs:
4559
test "$(git -C "$VEXT_ROOT" rev-parse HEAD)" = "$VEXT_SOURCE_COMMIT"
4660
- name: Install the framework's lockfile and build its actual CLI
4761
shell: bash
48-
run: npm ci --ignore-scripts --prefix "$VEXT_ROOT" && npm --prefix "$VEXT_ROOT" run build
62+
run: |
63+
set -euo pipefail
64+
npm ci --ignore-scripts --prefix "$VEXT_ROOT"
65+
if ! npm --prefix "$VEXT_ROOT" run build; then
66+
node scripts/validation/vextjs-file-identity.mjs "$VEXT_ROOT" > "$CG_ARTIFACTS_DIR/verification/vextjs-build-diagnostic.json"
67+
exit 1
68+
fi
4969
- name: Verify native catalog, retrieval and actual TCP Sessions
5070
shell: bash
5171
run: |
@@ -56,5 +76,5 @@ jobs:
5676
if: always()
5777
with:
5878
name: vextjs-${{ matrix.os }}-node-${{ matrix.node }}
59-
path: ${{ env.CG_ARTIFACTS_DIR }}/verification/
79+
path: ${{ steps.paths.outputs.verification }}
6080
retention-days: 7
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { lstatSync, openSync, fstatSync, closeSync, readdirSync, readFileSync, realpathSync } from 'node:fs';
2+
import { createHash } from 'node:crypto';
3+
import path from 'node:path';
4+
5+
// Read-only diagnosis for the fixed framework's lstat/fstat consistency guard.
6+
const root = realpathSync(process.argv[2]); const files = [];
7+
function visit(dir) {
8+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
9+
if (entry.isSymbolicLink()) throw new Error('Unexpected source link');
10+
const file = path.join(dir, entry.name);
11+
if (entry.isDirectory()) visit(file); else if (entry.isFile()) files.push(file);
12+
}
13+
}
14+
visit(path.join(root, 'src'));
15+
const fields = ['dev', 'ino', 'size', 'mtimeNs', 'ctimeNs']; const mismatches = [];
16+
for (const file of files.sort()) {
17+
const hash = () => createHash('sha256').update(readFileSync(file)).digest('hex');
18+
const firstHash = hash(); const before = lstatSync(file, { bigint: true }); const fd = openSync(file, 'r');
19+
try {
20+
const opened = fstatSync(fd, { bigint: true }); const after = lstatSync(file, { bigint: true });
21+
const differentFields = fields.filter((field) => before[field] !== opened[field]);
22+
if (differentFields.length) mismatches.push({ file: path.relative(root, file), differentFields,
23+
before: Object.fromEntries(fields.map((field) => [field, String(before[field])])),
24+
opened: Object.fromEntries(fields.map((field) => [field, String(opened[field])])),
25+
pathStatStable: fields.every((field) => before[field] === after[field]), contentStable: firstHash === hash() });
26+
} finally { closeSync(fd); }
27+
if (mismatches.length >= 3) break;
28+
}
29+
console.log(JSON.stringify({ node: process.version, platform: process.platform, inspectedFiles: files.length, mismatches,
30+
note: 'Diagnostic only. No source or guard was changed and no failed assertion is bypassed.' }, null, 2));

0 commit comments

Comments
 (0)