mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-01 08:10:13 +00:00
Clients matched folder default_permissioned_as globs with minimatch, where `*` stops at `/`; the server uses globset defaults, where it does not. Now that clients send the rule they preview, a disagreement stored the wrong identity, so the frontend and CLI match with the server's semantics. Compare & Deploy and Deploy workspaces preselect the target folder's rule for an item new there. A group rule is sent by principal alone, since the address it falls back to contradicts the principal. A new script or flow keeps its seeded identity once its first deploy ends creation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
818 B
TypeScript
24 lines
818 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { folderRuleGlobMatches } from './folderRuleGlob'
|
|
|
|
// Expected matches are what `globset::Glob::new(glob).compile_matcher()` answers on the server.
|
|
const PATHS = ['x', 'jobs/a', 'jobs/a/b', 'a/b', 'a/x/b', 'a/c', 'abc', 'foo/z', 'bar/z/q', 'baz/z']
|
|
const CASES: [string, string[]][] = [
|
|
['**', PATHS],
|
|
['*', PATHS],
|
|
['**/', PATHS],
|
|
['jobs/*', ['jobs/a', 'jobs/a/b']],
|
|
['a/**/b', ['a/b', 'a/x/b']],
|
|
['**/x', ['x']],
|
|
['a?c', ['a/c', 'abc']],
|
|
['[!ab]*', ['x', 'jobs/a', 'jobs/a/b', 'foo/z']],
|
|
['{foo,bar}/*', ['foo/z', 'bar/z/q']],
|
|
['[unclosed', []]
|
|
]
|
|
|
|
describe('folderRuleGlobMatches', () => {
|
|
it.each(CASES)('%s matches what the server matches', (glob, expected) => {
|
|
expect(PATHS.filter((p) => folderRuleGlobMatches(glob, p))).toEqual(expected)
|
|
})
|
|
})
|