Skip to content

Commit 619e4ee

Browse files
test: the blocks record is not a local edit to pull
In the older layout a push that uses blocks rewrites resources/<org>/.vapi-blocks.json, and until that is committed git shows it as modified. The record is on the list migrate moves, so pull leaves it out of what it counts as a person's edits. This pins it with a pull in a fresh clone. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
1 parent 0fea4e4 commit 619e4ee

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎tests/state-records-third-round.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { fileURLToPath } from "node:url";
2626
//
2727
// resources/<org>/.vapi-org.json shown as deleted between migrate and its commit
2828
// resources/<org>/.vapi-credential-providers.json written by every pull
29+
// resources/<org>/.vapi-blocks.json written by a push that uses blocks
2930
//
3031
// If pull counted one as a local edit, the keep rule would be off and pull
3132
// would overwrite the committed change with the platform's copy.
@@ -195,6 +196,21 @@ test("older layout: a credential providers record the engine wrote, not committe
195196
assert.equal(kept, true, "pull overwrote the merged change");
196197
});
197198

199+
test("older layout: a blocks record a push rewrote, not committed yet, is not a local edit", async () => {
200+
// What a push that used a block and recorded a new UUID leaves behind: the
201+
// state file and the blocks record, both modified. (With the record as the
202+
// only changed file the keep rule happens to stay on, because the first
203+
// line of git status loses its leading space before it is parsed.)
204+
const kept = await pullKeepsMerged(
205+
freshClone("root", { ["resources/dev/.vapi-blocks.json"]: "{}\n" }),
206+
(root) => {
207+
put(root, ".vapi-state.dev.json", STATE.replace("\n}\n", "\n}\n\n"));
208+
put(root, "resources/dev/.vapi-blocks.json", '{\n "blocks": {}\n}\n');
209+
},
210+
);
211+
assert.equal(kept, true, "pull overwrote the merged change");
212+
});
213+
198214
test("unchanged: a person's own uncommitted file in that folder still switches the keep rule off", async () => {
199215
// Only the engine's files are left out. Anything else under
200216
// resources/<org>/ counts as before, .vapi-ignore included.

0 commit comments

Comments
 (0)