You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6348a6f
Browse filesBrowse the repository at this point in the historyBrowse files
fix: keep the test suite out of the repository it runs in, and engine files out of pull's local edits
Running the test suite in a repository with a state file at its root removed
the repository: two tests cleaned up two folders above the engine's
baselines folder, and in the older layout that is the repository root.
The engine's directory now comes from one place, src/base-dir.ts. The test
preload points it at a temporary directory, makes every node:fs change
inside the repository throw, and the engine refuses a test started without
the preload. A new test runs the whole suite inside a copy of a
customer-shaped repository in the older layout, in state/, and with no
state, and compares every tracked, untracked and ignored file before and
after. That run found one more writer, tests/org-connection.test.ts, which
created tmp/ in the repository.
Pull's keep rule for a file with no baseline is off whenever git shows a
change under resources/<org>/. The engine's own files there (the org pin in
the older layout, also shown as deleted between migrate and its commit) are
no longer counted.
A repository with no state whose commit step can't be read still gets its
first state file at the root, and the command now says where the file goes,
why, and what has to stage it.
The upgrade guide gains one line: on a machine with no baselines, the first
pull after upgrading can bring a dashboard edit down one pull late.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/guides/commands.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -313,19 +313,45 @@ writing command stops before it changes anything and names the two files. If
313
313
they hold the same content, the engine reads the one in `state/`, keeps the
314
314
old copy identical, and says that `npm run migrate` removes it.
315
315
316
+
### A repository with no state yet
317
+
318
+
A new repository starts in `state/` when a workflow in `.github/workflows/`
319
+
is seen to stage it, as upstream's `promotion.yml` does, or when
320
+
`state/commit-step.json` says your commit step does. Otherwise the first state
321
+
file is written at the root, as `.vapi-state.<org>.json`, where every older
322
+
commit step looks for it, and the command says so in one line:
323
+
324
+
```
325
+
ℹ️ No engine state in this repository yet: it goes to .vapi-state.<org>.json at the repository root, because … Whatever commits state after a run has to stage .vapi-state.*.json. …
326
+
```
327
+
328
+
If your commit step stages only `state/` and the engine can't read it (a
329
+
script, a commit action, another CI system), that file would never be
330
+
committed. Before the first `pull`, either make the step stage
331
+
`.vapi-state.*.json` as well, or tell the engine the step stages `state/` and
332
+
commit the file it writes:
333
+
334
+
```bash
335
+
npm run migrate -- --commit-step-stages-state
336
+
git add state/commit-step.json
337
+
```
338
+
316
339
### What you'll see after upgrading
317
340
318
341
-**`ℹ️ Engine state here is in the older layout …`**, one line per writing
319
342
command, until you run `npm run migrate`. Nothing else changes.
343
+
-**A dashboard edit can arrive one pull late, once.** On a machine with no
344
+
baselines yet, the first `pull` after upgrading keeps every local file, and
345
+
an edit made in the dashboard comes down on the next `pull`. Nothing is
346
+
lost.
320
347
321
348
After `npm run migrate`:
322
349
323
350
-**`📦 Moved … into state/<org>/`**, once per org, from `migrate` itself.
324
-
-**`📦 1 locally modified file(s) will be preserved`** on a `pull` before you
325
-
commit the move. The file is the old org pin,
326
-
`resources/<org>/.vapi-org.json`. It moved to `state/<org>/org.json`, so git
327
-
shows it as deleted until you commit. Pull does nothing differently because
328
-
of it.
351
+
-**Nothing new from `pull` before you commit the move.** Git shows the old
352
+
org pin, `resources/<org>/.vapi-org.json`, as deleted until you commit. Pull
353
+
doesn't count that, or any other file the engine writes, as an edit of
354
+
yours, so it does nothing differently because of it.
329
355
-**`📦 Moved .vapi-state-hash/<org>/ … into state/<org>/local/`**, once, on
330
356
each teammate's machine after they pull your commit. Those are that
331
357
machine's own baselines and snapshots, which are not in git.
// Node's test runner sets this for every test file it runs. Without the
18
+
// sandbox a test would read and write the real repository: refuse.
19
+
if(process.env.NODE_TEST_CONTEXT)
20
+
thrownewError(
21
+
"The engine was loaded by a test without tests/no-vapi-api.ts, so it would work in this repository instead of a temporary directory. Run tests with `npm test` or `node --import tsx --import ./tests/no-vapi-api.ts --test <file>`.",
0 commit comments