mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 00:02:03 +00:00
0b959b8ec6
* fix(cli): canonical lockfile hashes + lock upgrade migration to v3 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): use __app_hash subpath in rehash missing-entry check Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): run sync pull lockfile auto-fill regardless of changes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: regenerate system prompts for new lock and rehash-only commands Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): address review feedback on lock upgrade Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): drop v3 marker; always run fallback; fail-fast on unknown lockfile version Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): drop yaml-round-trip legacy hash variant; recover via --rehash-only Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): include legacy hash in script push staleness warning check Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * revert(cli): drop canonical hash formula; keep raw-bytes hashing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * perf(cli): reuse change-tracker map for sync pull lockfile auto-fill Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): address review feedback on rehash-only Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(cli): pin lockfile hash + yaml format and cover regression cases Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(cli): byte-stable snapshot tests for flow.yaml format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test(cli): add app and script-metadata yaml snapshot fixtures Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): address claude review on rehash-only Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(cli): factorize script-path to remote-path derivation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): address claude + cubic review (dry-run mutation, rehash short-circuit) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(cli): make rehash a subcommand and factorize fs walks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): normalize line endings in yaml snapshot tests for windows ci Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cli): address review feedback on rehash + auto-fill - Flat-layout scripts now clearGlobalLock before rehash write so legacy ./-prefixed duplicates get cleaned up (matches flow/app behavior). - Add MalformedLockfileError; sync pull auto-fill re-throws it alongside UnknownLockVersionError instead of silently warning + continuing. - Document the legacy step-removal false-negative in isFlowDirectlyStale / isAppDirectlyStale and the categorizeLocalFiles ignore-filter invariant. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
61 lines
2.6 KiB
TypeScript
61 lines
2.6 KiB
TypeScript
/**
|
|
* YAML Format Snapshot Tests
|
|
*
|
|
* Asserts that representative `flow.yaml` files in
|
|
* `test/fixtures/yaml-snapshots/` round-trip through the CLI's parse +
|
|
* stringify pipeline without byte changes.
|
|
*
|
|
* What this catches:
|
|
* - yaml library upgrades that alter indent / quote / map-flow style
|
|
* (e.g. the Deno `@std/yaml` → npm `yaml` migration in #8041 silently
|
|
* changed bytes for the same logical content).
|
|
* - Edits to `yamlOptions` (sortMapEntries via `prioritizeName`,
|
|
* `singleQuote`, `aliasDuplicateObjects`) that re-order fields or
|
|
* re-quote scalars.
|
|
* - Custom-tag handler regressions for `!inline` / `!inline_fileset` —
|
|
* the parser resolves them to `"!inline X"` strings, the serializer
|
|
* then has to single-quote them because of the leading `!`.
|
|
*
|
|
* What this does NOT catch:
|
|
* - Logic regressions in the backend-Flow-JSON → on-disk-folder
|
|
* conversion (extracting inline scripts, splitting into files). That
|
|
* would need synthetic backend fixtures and is intentionally out of
|
|
* scope.
|
|
*
|
|
* **If a fixture's expected output changes**: re-run
|
|
* `bun run test/fixtures/yaml-snapshots/regenerate.ts` and review the
|
|
* diff. If intentional, commit. If not, investigate the upstream change.
|
|
*/
|
|
|
|
import { expect, test, describe } from "bun:test";
|
|
import { readdirSync, readFileSync } from "node:fs";
|
|
import * as path from "node:path";
|
|
import { stringify as yamlStringify } from "yaml";
|
|
import { yamlParseContent } from "../src/utils/yaml.ts";
|
|
import { yamlOptions } from "../src/commands/sync/sync.ts";
|
|
|
|
const FIXTURE_DIR = path.join(import.meta.dir, "fixtures", "yaml-snapshots");
|
|
|
|
describe("yaml format snapshot — flow.yaml fixtures", () => {
|
|
const fixtures = readdirSync(FIXTURE_DIR).filter((f) => f.endsWith(".yaml"));
|
|
|
|
// Sanity guard so a typo in the fixture dir path doesn't silently
|
|
// produce zero tests and a green CI.
|
|
test("fixture directory is non-empty", () => {
|
|
expect(fixtures.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
for (const filename of fixtures) {
|
|
test(`${filename}: round-trip is byte-stable`, () => {
|
|
const filePath = path.join(FIXTURE_DIR, filename);
|
|
// Normalize CRLF→LF: on Windows, git checkout may rewrite line endings
|
|
// even though .gitattributes pins these fixtures to LF. yamlStringify
|
|
// always emits LF, so we compare in LF form.
|
|
const original = readFileSync(filePath, "utf-8").replace(/\r\n/g, "\n");
|
|
const parsed = yamlParseContent(filename, original);
|
|
const reSerialized = yamlStringify(parsed, yamlOptions);
|
|
expect(reSerialized).toEqual(original);
|
|
});
|
|
}
|
|
});
|