Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🪤 test: Widen the Theme Cache Pin to Joint Fallbacks, Enum Literals and Joint Rules (#16927)
Marco Berettadcd94757f6a7
diff --git a/client/src/Providers/__tests__/themeCache.spec.ts b/client/src/Providers/__tests__/themeCache.spec.tsindex 602749f66a..8305a60593 100644--- a/client/src/Providers/__tests__/themeCache.spec.ts+++ b/client/src/Providers/__tests__/themeCache.spec.ts@@ -174,15 +174,22 @@ describe('theme cache storage', () => {* `librechat` and `clickhouse`, the definitions that can enter the cache (the boot script never* replays one under high contrast), and for generated definitions:* - every color, brand and appearance role overridden alone, theme-wide, in light only and in- * dark only (the other mode absent), plus a `none` sample for each shadow-like role;+ * dark only (the other mode absent), with each enum literal, `none` in either case and each+ * spelling of zero the role accepts as further samples;* - every role the resolver derives from others, found by diffing its resolved output against the- * bare theme, with all of its sources named together and again with the role named as well, theme-wide and per mode, so- * fallback precedence and opting out are covered without listing the chains by hand;+ * bare theme, then, for a role no single source changes, against every other role named+ * together, reduced to the smallest set that still changes it, and then, until no source joins,+ * beside each known source and beside all of them, so a source that acts only beside another+ * joins too; each is generated in every scope with all of its sources named and with every pair+ * of them, each with and without the role named as well, every named role taking its own value,+ * so fallback precedence and opting out are covered without listing the chains by hand;* - every brand set theme-wide, in light and in dark with conflicting values;+ * - every pair of candidates for roles validated together, the pairs found by validating every+ * pair of accepted candidates, theme-wide, in light only and in dark only;* - definitions with one or both mode blocks absent.* A new role, or a new fallback, joins by construction.*/-const PIN = { fingerprint: '1.4.dxwdxg', digest: 'aepelz' };+const PIN = { fingerprint: '1.4.dxwdxg', digest: '39up6s' };const digestOf = (text: string): string => {let hash = 5381;@@ -195,26 +202,49 @@ const digestOf = (text: string): string => {/** Locale-independent, so the digest does not depend on the collation Jest runs under. */const byCodePoint = (a: string, b: string): number => (a < b ? -1 : Number(a > b));-const APPEARANCE_CANDIDATES = [- '0.5rem',- '1.25rem',+/**+ * Values a role may switch on or canonicalize: every enum literal an appearance validator names,+ * `none` in either case and padded for the composable shadows, and zero written more than one way,+ * padded among them. The validators are predicates, so these are listed, not read from them.+ */+const SPECIAL_CANDIDATES = ['soft','dim','fill',+ 'transparent',+ 'inherit',+ 'ring',+ 'border',+ 'none',+ 'None',+ ' none ',+ '0',+ '.0',+ '0.0',+ ' 0 ',+];++const APPEARANCE_CANDIDATES = [+ ...SPECIAL_CANDIDATES,+ '0.5rem',+ '1rem',+ '1.25rem',+ '2rem',+ '9rem',+ '24px',+ '40px','600','0.5','150ms',- '9rem','0 1px 2px 0 rgb(0 0 0 / 0.2)','ui-sans-serif, sans-serif',+ 'Georgia, serif','1.5',- 'ring',- 'border',- 'none',-];+].sort(byCodePoint);type Scope = 'both' | 'light' | 'dark';type Mode = 'light' | 'dark';+type Kind = 'colors' | 'appearance';type Overrides = {colors?: Record<string, string>;appearance?: Record<string, string>;@@ -248,26 +278,61 @@ const define = (),}) as ThemeDefinition;-const BARE = define('bare', () => ({}), 'both');const isValid = (theme: ThemeDefinition): boolean => validateThemeDefinition(theme).length === 0;+const isValidAppearance = (appearance: Record<string, string>): boolean =>+ isValid(define('probe', () => ({ appearance }), 'both'));-/** Every candidate the validator accepts for each appearance role, pinned so a narrowing or widening shows. */+/**+ * Every candidate the validator accepts for each appearance role, keyed in code point order so+ * reordering the validators changes nothing, and pinned so a narrowing or widening shows.+ */const ACCEPTED: Record<string, string[]> = Object.fromEntries(- themeAppearanceTokens.map((token) => [- token,- APPEARANCE_CANDIDATES.filter((value) =>- isValid(define(token, () => ({ appearance: { [token]: value } }), 'both')),+ [...themeAppearanceTokens]+ .sort(byCodePoint)+ .map((token) => [+ token,+ APPEARANCE_CANDIDATES.filter((value) => isValidAppearance({ [token]: value })),+ ]),+);++/**+ * Roles the validator checks together, found by validating every pair of accepted candidates for+ * every pair of roles, so a pair can be rejected though each side is valid alone and a new joint+ * rule joins without listing it.+ */+const JOINTLY_VALIDATED: ReadonlyArray<[string, string]> = themeAppearanceTokens.flatMap(+ (first, index) =>+ themeAppearanceTokens+ .slice(index + 1)+ .filter((second) =>+ ACCEPTED[first].some((a) =>+ ACCEPTED[second].some((b) => !isValidAppearance({ [first]: a, [second]: b })),+ ),+ )+ .map((second): [string, string] => [first, second]),+);++/** Every pair of candidates the validator accepts for each jointly validated pair of roles. */+const ACCEPTED_PAIRS: Record<string, Array<[string, string]>> = Object.fromEntries(+ JOINTLY_VALIDATED.map(([first, second]) => [+ `${first}+${second}`,+ APPEARANCE_CANDIDATES.flatMap((a) =>+ APPEARANCE_CANDIDATES.filter((b) => isValidAppearance({ [first]: a, [second]: b })).map(+ (b): [string, string] => [a, b],+ ),),]),);-/** The first sample the validator accepts for an appearance role, and `none` when it takes it. */+const SPECIAL = new Set(SPECIAL_CANDIDATES);++/** The first sample the validator accepts for an appearance role, and every special one it takes. */function appearanceSamples(token: string): string[] {const accepted = ACCEPTED[token];if (accepted.length === 0) {throw new Error(`Add a valid sample for the appearance role ${token} to APPEARANCE_CANDIDATES`);}- return [...new Set([accepted[0], ...accepted.filter((value) => value === 'none')])];+ return [...new Set([accepted[0], ...accepted.filter((value) => SPECIAL.has(value))])];}const SAMPLES = Object.fromEntries(@@ -277,44 +342,134 @@ const SAMPLES = Object.fromEntries(const colorOverrides = (tokens: readonly string[], mode: Mode): Record<string, string> =>Object.fromEntries(tokens.map((token, index) => [token, COLOR_SENTINEL[mode](index)]));+/**+ * Each role takes the accepted value at its position, so roles sharing a validator, such as+ * `fontFamily` and `displayFontFamily`, carry distinct values and a role inheriting one of them+ * shows which it read.+ */const appearanceOverrides = (tokens: readonly string[]): Record<string, string> =>- Object.fromEntries(tokens.map((token) => [token, SAMPLES[token][0]]));--/** Role to the roles whose single override changes it, read from the resolver. */-function derivedRoles(): { colors: Map<string, string[]>; appearance: Map<string, string[]> } {- const base = MODES.map((mode) => resolveTheme(BARE, mode));- const found = {- colors: new Map<string, Set<string>>(),- appearance: new Map<string, Set<string>>(),- };- const note = (kind: 'colors' | 'appearance', source: string, theme: ThemeDefinition) =>- MODES.forEach((mode, index) => {- const resolved = resolveTheme(theme, mode);- const before = base[index][kind] as Record<string, unknown>;- const after = resolved[kind] as Record<string, unknown>;- Object.keys(after)- .filter((key) => key !== source && after[key] !== before[key])- .forEach((key) => found[kind].set(key, (found[kind].get(key) ?? new Set()).add(source)));- });- themeColorTokens.forEach((token) =>- note(- 'colors',- token,- define(token, (mode) => ({ colors: colorOverrides([token], mode) }), 'both'),- ),+ Object.fromEntries(+ tokens.map((token, index) => [token, ACCEPTED[token][index % ACCEPTED[token].length]]),);- themeAppearanceTokens.forEach((token) =>- note(- 'appearance',- token,- define(token, () => ({ appearance: appearanceOverrides([token]) }), 'both'),- ),++const OVERRIDES: Record<Kind, (tokens: readonly string[], mode: Mode) => Overrides> = {+ colors: (tokens, mode) => ({ colors: colorOverrides(tokens, mode) }),+ appearance: (tokens) => ({ appearance: appearanceOverrides(tokens) }),+};++const TOKENS: Record<Kind, readonly string[]> = {+ colors: themeColorTokens,+ appearance: themeAppearanceTokens,+};++/** The resolved roles of one kind in each mode, with `tokens` named. */+const resolvedRoles = (kind: Kind, tokens: readonly string[]): Array<Record<string, unknown>> =>+ MODES.map(+ (mode) =>+ resolveTheme(+ define('probe', (current) => OVERRIDES[kind](tokens, current), 'both'),+ mode,+ )[kind] as Record<string, unknown>,+ );++/** The resolved roles of one kind in each mode, with each role in `named` set to its value. */+const resolvedNamed = (+ kind: Kind,+ named: (mode: Mode) => Record<string, string>,+): Array<Record<string, unknown>> =>+ MODES.map(+ (mode) =>+ resolveTheme(+ define('probe', (current) => ({ [kind]: named(current) }), 'both'),+ mode,+ )[kind] as Record<string, unknown>,+ );++/**+ * The resolved roles with only `kept` named, each taking the value it has when all of `tokens` are,+ * so dropping a role leaves the others' values unchanged.+ */+const resolvedSubset = (kind: Kind, tokens: readonly string[], kept: readonly string[]) =>+ resolvedNamed(kind, (mode) => {+ const values = OVERRIDES[kind](tokens, mode)[kind] ?? {};+ return Object.fromEntries(kept.map((token) => [token, values[token]]));+ });++/**+ * The resolved roles with `source` named alone: a color takes its sentinel, an appearance role each+ * value the validator accepts, so a fallback that acts only on one value, or a first value equal to+ * the default, still shows.+ */+const soloProbes = (kind: Kind, source: string): Array<Array<Record<string, unknown>>> =>+ kind === 'colors'+ ? [resolvedRoles(kind, [source])]+ : ACCEPTED[source].map((value) => resolvedNamed(kind, () => ({ [source]: value })));++const differs = (+ before: Array<Record<string, unknown>>,+ after: Array<Record<string, unknown>>,+ key: string,+): boolean => before.some((roles, index) => roles[key] !== after[index][key]);++/**+ * Role to the roles that change it, read from the resolver: first each role named alone, an+ * appearance role with each value it accepts; then, for a role no single source changes but every+ * other role named together does, the smallest set of them that still changes it, which finds a+ * fallback that acts only when sources meet; then, until no source joins, each further role named+ * beside each known source and beside all of them, which finds a source that only acts jointly+ * even when another source masks it.+ */+function findDerived(kind: Kind): Map<string, string[]> {+ const base = resolvedRoles(kind, []);+ const found = new Map<string, Set<string>>();+ TOKENS[kind].forEach((source) => {+ const probes = soloProbes(kind, source);+ Object.keys(base[0])+ .filter((key) => key !== source && probes.some((after) => differs(base, after, key)))+ .forEach((key) => found.set(key, (found.get(key) ?? new Set()).add(source)));+ });+ TOKENS[kind]+ .filter((target) => !found.has(target))+ .forEach((target) => {+ const others = TOKENS[kind].filter((token) => token !== target);+ if (!differs(base, resolvedRoles(kind, others), target)) {+ return;+ }+ const needed = others.reduce((kept, token) => {+ const without = kept.filter((named) => named !== token);+ return differs(base, resolvedSubset(kind, others, without), target) ? without : kept;+ }, others);+ found.set(target, new Set(needed));+ });+ found.forEach((sources, target) => {+ let grew = true;+ while (grew) {+ const named = [...sources];+ const contexts = [named, ...(named.length > 1 ? named.map((source) => [source]) : [])].map(+ (context) => ({ context, before: resolvedRoles(kind, context) }),+ );+ const joined = TOKENS[kind]+ .filter((token) => token !== target && !sources.has(token))+ .filter((token) =>+ contexts.some(({ context, before }) =>+ differs(before, resolvedRoles(kind, [...context, token]), target),+ ),+ );+ joined.forEach((token) => sources.add(token));+ grew = joined.length > 0;+ }+ });+ return new Map(+ [...found].map(([key, sources]) => [key, [...sources].sort(byCodePoint)] as [string, string[]]),);- const sorted = (map: Map<string, Set<string>>) =>- new Map([...map].map(([key, sources]) => [key, [...sources].sort()] as [string, string[]]));- return { colors: sorted(found.colors), appearance: sorted(found.appearance) };}+let derived: Record<Kind, Map<string, string[]>> | undefined;+const derivedRoles = (): Record<Kind, Map<string, string[]>> => {+ derived ??= { colors: findDerived('colors'), appearance: findDerived('appearance') };+ return derived;+};+function roleFixtures(): Fixture[] {const colors = themeColorTokens.flatMap((token) =>SCOPES.map((scope) => ({@@ -342,9 +497,9 @@ function roleFixtures(): Fixture[] {},]);const appearance = themeAppearanceTokens.flatMap((token) =>- SAMPLES[token].flatMap((value, index) =>+ SAMPLES[token].flatMap((value) =>SCOPES.map((scope) => ({- key: `appearance:${token}:${index}:${scope}`,+ key: `appearance:${token}:${value}:${scope}`,theme: define(token, () => ({ appearance: { [token]: value } }), scope),})),),@@ -352,32 +507,54 @@ function roleFixtures(): Fixture[] {return [...colors, ...brands, ...appearance];}-/** Each derived role with all of its sources named together, then with the role named as well. */+/**+ * Each derived role with all of its sources named together and with every pair of them, each with+ * and without the role named as well.+ */function derivedFixtures(): Fixture[] {- const { colors, appearance } = derivedRoles();- const fixtures = (- kind: 'color' | 'appearance',- chains: Map<string, string[]>,- overrides: (tokens: string[], mode: Mode) => Overrides,- ) =>- [...chains].flatMap(([target, sources]) =>- SCOPES.flatMap((scope) => [- {- key: `derived:${kind}:${target}:sources:${scope}`,- theme: define(target, (mode) => overrides(sources, mode), scope),- },- {- key: `derived:${kind}:${target}:named:${scope}`,- theme: define(target, (mode) => overrides([...sources, target], mode), scope),- },- ]),- );- return [- ...fixtures('color', colors, (tokens, mode) => ({ colors: colorOverrides(tokens, mode) })),- ...fixtures('appearance', appearance, (tokens) => ({- appearance: appearanceOverrides(tokens),- })),- ];+ const roles = derivedRoles();+ return (['colors', 'appearance'] as const).flatMap((kind) =>+ [...roles[kind]].flatMap(([target, sources]) => {+ const named = (tokens: string[], scope: Scope) =>+ define(target, (mode) => OVERRIDES[kind](tokens, mode), scope);+ const pairs = sources.flatMap((first, index) =>+ sources.slice(index + 1).flatMap((second) =>+ SCOPES.flatMap((scope) => [+ {+ key: `derived:${kind}:${target}:pair:${first}+${second}:${scope}`,+ theme: named([first, second], scope),+ },+ {+ key: `derived:${kind}:${target}:pair-named:${first}+${second}:${scope}`,+ theme: named([first, second, target], scope),+ },+ ]),+ ),+ );+ return [+ ...SCOPES.flatMap((scope) => [+ { key: `derived:${kind}:${target}:sources:${scope}`, theme: named(sources, scope) },+ {+ key: `derived:${kind}:${target}:named:${scope}`,+ theme: named([...sources, target], scope),+ },+ ]),+ ...pairs,+ ];+ }),+ );+}++/** Every accepted pair of the jointly validated roles, in every scope. */+function jointFixtures(): Fixture[] {+ return JOINTLY_VALIDATED.flatMap(([first, second]) =>+ ACCEPTED_PAIRS[`${first}+${second}`].flatMap(([a, b]) =>+ SCOPES.map((scope) => ({+ key: `joint:${first}:${a}:${second}:${b}:${scope}`,+ theme: define(first, () => ({ appearance: { [first]: a, [second]: b } }), scope),+ })),+ ),+ );}/** Mode blocks that are missing or empty, on a bare theme and on a bundled one. */@@ -407,6 +584,7 @@ const persistedOutput = () => {{ key: 'a:clickhouse', theme: clickHouseTheme },...roleFixtures(),...derivedFixtures(),+ ...jointFixtures(),...modeFixtures(),].sort((a, b) => byCodePoint(a.key, b.key));return fixtures.map(({ key, theme }) => {@@ -431,7 +609,13 @@ describe('resolver output pin', () => {it('matches the persisted output of every cacheable definition and generated fixture', () => {const status = pinStatus({fingerprint: themeRoleFingerprint(),- digest: digestOf(JSON.stringify({ accepted: ACCEPTED, output: persistedOutput() })),+ digest: digestOf(+ JSON.stringify({+ accepted: ACCEPTED,+ acceptedPairs: ACCEPTED_PAIRS,+ output: persistedOutput(),+ }),+ ),});expect(status).toBe('');});@@ -443,6 +627,41 @@ describe('resolver output pin', () => {expect(appearance.get('menuShadow')).toContain('shadowLg');});+ it('finds a source that acts only beside another', () => {+ expect(derivedRoles().colors.get('rgb-series-8')).toEqual(+ expect.arrayContaining(['rgb-series-1', 'rgb-text-secondary']),+ );+ });++ it('generates derived fixtures the validator accepts, joint rules included', () => {+ const rejected = derivedFixtures()+ .filter(({ theme }) => !isValid(theme))+ .map(({ key }) => key);+ expect(rejected).toEqual([]);+ });++ it('gives roles sharing a validator distinct values', () => {+ const named = appearanceOverrides(['fontFamily', 'displayFontFamily']);+ expect(named.fontFamily).not.toBe(named.displayFontFamily);+ expect(derivedRoles().appearance.get('dialogTitleFontFamily')).toEqual(+ expect.arrayContaining(['displayFontFamily', 'fontFamily']),+ );+ });++ it('samples every enum literal, both cases of none and each spelling of zero', () => {+ expect(SAMPLES.fieldFillStyle).toEqual(expect.arrayContaining(['fill', 'transparent']));+ expect(SAMPLES.labelFontWeight).toContain('inherit');+ expect(SAMPLES.shadowLg).toEqual(expect.arrayContaining(['none', 'None']));+ expect(SAMPLES.chromeBorderAlpha).toEqual(expect.arrayContaining(['0', '.0', '0.0']));+ });++ it('pins the pairs a joint rule accepts, not only each side alone', () => {+ const pairs = ACCEPTED_PAIRS['switchWidth+switchHeight'];+ expect(pairs).toContainEqual(['1rem', '0.5rem']);+ expect(pairs).not.toContainEqual(['0.5rem', '1rem']);+ expect(ACCEPTED.switchWidth).not.toContain('1rem');+ });+it('tells a version change from an output change', () => {expect(pinStatus({ ...PIN, fingerprint: 'other' })).toMatch(/cache version changed/);expect(pinStatus({ ...PIN, digest: 'other' })).toMatch(/bump THEME_CACHE_EPOCH/);diff --git a/e2e/specs/mock/scenarios/theme-cache-pin.spec.ts b/e2e/specs/mock/scenarios/theme-cache-pin.spec.tsnew file mode 100644index 0000000000..5ea3ef98b1--- /dev/null+++ b/e2e/specs/mock/scenarios/theme-cache-pin.spec.ts@@ -0,0 +1,182 @@+import { copyFileSync, cpSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join, resolve } from 'node:path';+import { expect, test } from '@playwright/test';+import { inOneProject, repoRoot, run } from './lint.helpers';++/**+ * The theme cache replays resolved variables at boot and is retired only when its version+ * changes, so the resolver output pin in `themeCache.spec.ts` is what tells a contributor that a+ * change to what a theme resolves to needs a `THEME_CACHE_EPOCH` bump. Each scenario makes one+ * such change to a scratch copy of the built bundles, points the client's Jest at the copy, and+ * reads what the pin says. Nothing is written into the tree.+ */++const CLIENT_BUNDLE = resolve(repoRoot, 'packages/client/dist/index.cjs');+/** The provider bundle requires its own chunks, so its whole output directory is copied. */+const PROVIDER_DIST = resolve(repoRoot, 'packages/data-provider/dist');+const JEST = resolve(repoRoot, 'node_modules/.bin/jest');+const BUMP = /bump THEME_CACHE_EPOCH/;++type Edit = { bundle: 'client' | 'provider'; from: string; to: string };++/** Runs the pin against the built bundles with `edits` applied to scratch copies of them. */+function runPin(edits: Edit[]): { status: number; output: string } {+ const scratch = mkdtempSync(join(tmpdir(), 'lc-theme-pin-'));+ try {+ const bundles = {+ client: join(scratch, 'client.cjs'),+ provider: join(scratch, 'provider', 'index.js'),+ };+ copyFileSync(CLIENT_BUNDLE, bundles.client);+ cpSync(PROVIDER_DIST, join(scratch, 'provider'), { recursive: true });+ for (const { bundle, from, to } of edits) {+ const source = readFileSync(bundles[bundle], 'utf8');+ if (!source.includes(from)) {+ throw new Error(`The ${bundle} bundle no longer contains: ${from}`);+ }+ writeFileSync(bundles[bundle], source.replace(from, to));+ }+ const config = join(scratch, 'jest.config.cjs');+ writeFileSync(+ config,+ `const base = require(${JSON.stringify(resolve(repoRoot, 'client/jest.config.cjs'))});+module.exports = {+ ...base,+ rootDir: ${JSON.stringify(resolve(repoRoot, 'client'))},+ modulePaths: [${JSON.stringify(resolve(repoRoot, 'node_modules'))}],+ transformIgnorePatterns: [...base.transformIgnorePatterns, ${JSON.stringify(scratch)}],+ testResultsProcessor: undefined,+ moduleNameMapper: {+ ...base.moduleNameMapper,+ '^@librechat/client$': ${JSON.stringify(bundles.client)},+ '^librechat-data-provider$': ${JSON.stringify(bundles.provider)},+ },+};+`,+ );+ return run(+ JEST,+ [+ '--config',+ config,+ '--maxWorkers=1',+ '--ci',+ '--testNamePattern',+ 'matches the persisted output',+ 'src/Providers/__tests__/themeCache.spec.ts',+ ],+ { cwd: resolve(repoRoot, 'client') },+ );+ } finally {+ rmSync(scratch, { force: true, recursive: true });+ }+}++test.describe('the theme cache resolver output pin', () => {+ test.beforeEach(() => {+ inOneProject();+ test.setTimeout(180_000);+ });++ test('the current resolver output matches the pin @scenario:theme-pin-current-output-passes', () => {+ const result = runPin([]);+ expect(result.status, result.output).toBe(0);+ });++ test('a fallback that acts only beside another source asks for an epoch bump @scenario:theme-pin-joint-fallback', () => {+ const result = runPin([+ {+ bundle: 'client',+ from: '"rgb-series-8": customColors?.["rgb-text-secondary"] ?? baseColors["rgb-text-secondary"]',+ to: '"rgb-series-8": baseColors["rgb-text-secondary"]',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('a fallback that acts only when two sources meet asks for an epoch bump @scenario:theme-pin-conjunctive-fallback', () => {+ const result = runPin([+ {+ bundle: 'client',+ from: '...customColors,\n\t\t\t...codeSurfaceFallback,',+ to: '...customColors,\n\t\t\t...(customColors?.["rgb-status-error"] !== void 0 && customColors?.["rgb-status-warning"] !== void 0 && customColors?.["rgb-border-light"] === void 0 ? { "rgb-border-light": customColors["rgb-status-error"] } : {}),\n\t\t\t...codeSurfaceFallback,',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('swapping precedence between sources that share a validator asks for an epoch bump @scenario:theme-pin-shared-validator-precedence', () => {+ const result = runPin([+ {+ bundle: 'client',+ from: '["dialogTitleFontFamily", "displayFontFamily"],',+ to: '["dialogTitleFontFamily", "fontFamily"],\n\t["dialogTitleFontFamily", "displayFontFamily"],',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('a shadow role that stops canonicalizing None asks for an epoch bump @scenario:theme-pin-shadow-none-case', () => {+ const result = runPin([+ {+ bundle: 'client',+ from: 'result[key].trim().toLowerCase() === "none"',+ to: 'result[key] === "none"',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('a shadow role that stops trimming None asks for an epoch bump @scenario:theme-pin-shadow-none-padding', () => {+ const result = runPin([+ {+ bundle: 'client',+ from: 'result[key].trim().toLowerCase() === "none"',+ to: 'result[key].toLowerCase() === "none"',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('narrowing an enum literal asks for an epoch bump @scenario:theme-pin-enum-literal', () => {+ const result = runPin([+ {+ bundle: 'provider',+ from: 'fieldFillStyle: (value) => value === "transparent" || value === "fill"',+ to: 'fieldFillStyle: (value) => value === "fill"',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('rejecting a formerly valid switch pair asks for an epoch bump @scenario:theme-pin-joint-rule', () => {+ const result = runPin([+ {+ bundle: 'provider',+ from: 'const minimumHeight = height[1] === "px" ? 4 : .5;',+ to: 'const minimumHeight = height[1] === "px" ? 30 : .5;',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });++ test('a new rule validating two roles together asks for an epoch bump @scenario:theme-pin-new-joint-rule', () => {+ const result = runPin([+ {+ bundle: 'provider',+ from: 'function collectSwitchIssues(appearance, base) {',+ to: 'function collectSwitchIssues(appearance, base) {\n\tif (appearance.textSm !== void 0 && appearance.textSm === appearance.radiusXl) return [issue([...base, "textSm"], "textSm must differ from radiusXl")];',+ },+ ]);+ expect(result.status).not.toBe(0);+ expect(result.output).toMatch(BUMP);+ });+});