Skip to content

Commit 1ee003a

Browse files
fix: upgrade Fern CLI to restore SDK preview CI (#1424)
## Description SDK preview jobs install the latest Fern CLI, which now refuses noninteractive handoff to the repository's pinned 5.169.0 because it is older than 5.215.0. Recent runs fail before generating TypeScript, Python or Go previews ([failed run](https://github.com/VapiAI/docs/actions/runs/43621617269)). Fern documents the new version gate in its [CLI changelog](https://buildwithfern.com/learn/cli-api-reference/cli-reference/changelog). - Upgrade `fern/fern.config.json` and the docs setup action to Fern 5.216.0. - Keep the docs example-cache adapter compatible by updating the reviewed bundle checksum, renamed property-example function and compatibility fixtures. The property/media generator behavior and local reference handling remain compatible with the adapter; existing checksum and unique-marker guards stay enforced. - Update the adapter's local verification instructions. SDK generator versions and API definitions are unchanged. ## Testing Steps - [x] All 32 `scripts/fern/*.test.cjs` tests pass locally and in CI with the official 5.216.0 bundle installed, including CLI startup, checksum/marker guards and cache invalidation safeguards; zero skips. - [x] Official CLI and cold-cache adapter complete `check --local --log-level debug`: both exit 0 with 0 errors and 14 warnings. Diagnostic logs match after excluding durations, memory use and temporary paths. - [x] Warm-cache adapter completes `check --local --warnings --log-level debug`: exit 0, 0 errors and 14 warnings, with 2,386 cache hits, 0 misses and 0 skipped calls. Cold run had 2,386 misses. - [x] All three SDK previews pass CI, including TypeScript, Python and Go compilation/type checks ([run](https://github.com/VapiAI/docs/actions/runs/43748735932)). - [x] Fern validation and docs consent browser checks pass CI ([run](https://github.com/VapiAI/docs/actions/runs/43748736031)). - [x] `git diff --check`. - [ ] Hosted docs preview is still building ([run](https://github.com/VapiAI/docs/actions/runs/43748735969)).
1 parent e8e081b commit 1ee003a

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎.github/actions/setup-fern/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ runs:
99
- name: Install pinned Fern
1010
shell: bash
1111
run: |
12-
npm install --prefix "$RUNNER_TEMP/vapi-fern" --no-save --no-audit --no-fund fern-api@5.169.0
12+
npm install --prefix "$RUNNER_TEMP/vapi-fern" --no-save --no-audit --no-fund fern-api@5.216.0
1313
echo "FERN_CLI_PATH=$RUNNER_TEMP/vapi-fern/node_modules/fern-api/cli.cjs" >> "$GITHUB_ENV"
1414
- name: Test cache safeguards
1515
shell: bash

‎fern/fern.config.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"organization": "vapi",
3-
"version": "5.169.0"
3+
"version": "5.216.0"
44
}

‎scripts/fern/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ original Fern commands also removes this optimization.
4949
## Local verification
5050

5151
```sh
52-
npm install --prefix /tmp/vapi-fern --no-save fern-api@5.169.0
52+
npm install --prefix /tmp/vapi-fern --no-save fern-api@5.216.0
5353
export FERN_CLI_PATH=/tmp/vapi-fern/node_modules/fern-api/cli.cjs
5454
node --test scripts/fern/*.test.cjs
5555
node scripts/fern/run.cjs check --local --log-level debug
5656
node scripts/fern/run.cjs generate --docs --preview --log-level debug
5757
```
5858

5959
The CLI compatibility tests exercise the installed bundle when `FERN_CLI_PATH` is set;
60-
without it, the installed-bundle checks are skipped. The wrapper pins Fern 5.169.0
60+
without it, the installed-bundle checks are skipped. The wrapper pins Fern 5.216.0
6161
and verifies CLI SHA-256
62-
`773ec0a808a2c4d03c894c81c6159f8e3fe8db5a873c287cdce5b140eed8b809`.
62+
`acd2771ffed03658a03590ea9fa6ee764df52e52284665eb8574cd8efacb4923`.
6363
The timing measurements below predate this upgrade.
6464

6565
Preview generation publishes remotely and requires separate authorization.

‎scripts/fern/run.cjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const os = require('node:os');
44
const { spawnSync } = require('node:child_process');
55
const { digest } = require('./example-cache.cjs');
66

7-
const VERSION = '5.169.0';
8-
const CLI_SHA256 = '773ec0a808a2c4d03c894c81c6159f8e3fe8db5a873c287cdce5b140eed8b809';
9-
const MARKER = 'function KOm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})';
7+
const VERSION = '5.216.0';
8+
const CLI_SHA256 = 'acd2771ffed03658a03590ea9fa6ee764df52e52284665eb8574cd8efacb4923';
9+
const MARKER = 'function HQm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})';
1010
const MEDIA_MARKER = 'generateOrValidateExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i})';
1111

1212
function inputDigest(root) {
@@ -27,7 +27,7 @@ function main() {
2727
if (digest(source) !== CLI_SHA256 || source.split(MARKER).length !== 2 || source.split(MEDIA_MARKER).length !== 2) throw new Error('Unexpected Fern CLI contents. Refusing to apply the cache adapter.');
2828
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'vapi-fern-'));
2929
const patched = source
30-
.replace(MARKER, 'function KOm(args){return globalThis.__vapiFernExamples(args,()=>vapiOriginalExamples(args))}function vapiOriginalExamples({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})')
30+
.replace(MARKER, 'function HQm(args){return globalThis.__vapiFernExamples(args,()=>vapiOriginalExamples(args))}function vapiOriginalExamples({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})')
3131
.replace(MEDIA_MARKER, 'generateOrValidateExample(args){return globalThis.__vapiFernExamples({context:this.context,breadcrumbs:this.breadcrumbs,mediaExampleArgs:args},()=>this.vapiOriginalMediaExample(args))}vapiOriginalMediaExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i})');
3232
try {
3333
const cli = path.join(temporary, 'fern.cjs');

‎scripts/fern/run.test.cjs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const vm = require('node:vm');
77
const { spawnSync } = require('node:child_process');
88
const { digest } = require('./example-cache.cjs');
99

10-
const version = '5.169.0';
11-
const checksum = '773ec0a808a2c4d03c894c81c6159f8e3fe8db5a873c287cdce5b140eed8b809';
12-
const marker = 'function KOm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})';
10+
const version = '5.216.0';
11+
const checksum = 'acd2771ffed03658a03590ea9fa6ee764df52e52284665eb8574cd8efacb4923';
12+
const marker = 'function HQm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})';
1313
const mediaMarker = 'generateOrValidateExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i})';
1414
const fixture = `${marker}{return e}class Media{${mediaMarker}{return t}}`;
1515
const wrapper = fs.readFileSync(path.join(__dirname, 'run.cjs'), 'utf8');
@@ -80,7 +80,7 @@ test('both emitted wrappers call the cache and preserve original generation', ()
8080
const patched = h.calls.writes[0][1];
8181
const calls = [];
8282
const context = { __vapiFernExamples(args, generate) { calls.push(args); return generate(); } };
83-
const result = vm.runInNewContext(`${patched};[KOm({propertySchema:'property'}),new Media().generateOrValidateExample({schema:'media'})]`, context);
83+
const result = vm.runInNewContext(`${patched};[HQm({propertySchema:'property'}),new Media().generateOrValidateExample({schema:'media'})]`, context);
8484
assert.deepEqual(Array.from(result), ['property', 'media']);
8585
assert.equal(calls.length, 2);
8686
assert.equal(calls[0].propertySchema, 'property');
@@ -134,7 +134,7 @@ for (const args of [['--version'], ['--help'], ['check', '--help'], ['generate',
134134
assert.equal(result.status, 0, result.stderr);
135135
assert.match(result.stderr, /\[fern-example-cache\]/);
136136
assert.ok(result.stdout.trim());
137-
if (args[0] === '--version') assert.match(result.stdout, /5\.169\.0/);
137+
if (args[0] === '--version') assert.match(result.stdout, /5\.216\.0/);
138138
assert.deepEqual(fs.readdirSync(temporary), []);
139139
});
140140
}

0 commit comments

Comments
 (0)