Skip to content

Commit 031498a

Browse files
author
Hanyu Wei
committed
fix(query-enhancements): nest PPL lint flag under ppl.lint.enabled
Address joshuali925's review on #12255: restructure the config path from queryEnhancements.pplLint.enabled to queryEnhancements.ppl.lint.enabled so future languages/features (ppl.autocomplete, sql.lint) extend the same shape. The wire capability stays a flat boolean queryEnhancements.pplLint, so capability consumers are unaffected; only the DynamicConfigService read in the switcher changes (config.ppl?.lint?.enabled === true). Signed-off-by: Hanyu Wei <weihanyu@amazon.com>
1 parent 4ac79ae commit 031498a

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/plugins/query_enhancements/common/config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ export const configSchema = schema.object({
3131
}),
3232
}),
3333
}),
34-
// PPL linter feature flag, read at runtime via DynamicConfigService and
35-
// surfaced as the queryEnhancements.pplLint capability. Disabled by default.
36-
pplLint: schema.object({
37-
enabled: schema.boolean({ defaultValue: false }),
34+
// PPL feature flags, read at runtime via DynamicConfigService. Nested as
35+
// ppl.lint.enabled so future languages/features (ppl.autocomplete, sql.lint)
36+
// extend the same shape. Surfaced as the flat queryEnhancements.pplLint
37+
// capability. Disabled by default.
38+
ppl: schema.object({
39+
lint: schema.object({
40+
enabled: schema.boolean({ defaultValue: false }),
41+
}),
3842
}),
3943
});
4044

src/plugins/query_enhancements/server/plugin.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('QueryEnhancementsPlugin pplLint capability', () => {
6262

6363
it('enables pplLint when the dynamic config flag is on', async () => {
6464
const { core, switcher } = setupPlugin();
65-
const startContract = stubConfig(core, { pplLint: { enabled: true } });
65+
const startContract = stubConfig(core, { ppl: { lint: { enabled: true } } });
6666

6767
const result = await switcher({} as any, baseCapabilities());
6868

@@ -80,7 +80,7 @@ describe('QueryEnhancementsPlugin pplLint capability', () => {
8080
it('passes the async local store as context when one is present', async () => {
8181
const { core, switcher } = setupPlugin();
8282
const store = new Map<string, any>([['k', 'v']]);
83-
const startContract = stubConfig(core, { pplLint: { enabled: true } }, store);
83+
const startContract = stubConfig(core, { ppl: { lint: { enabled: true } } }, store);
8484

8585
await switcher({} as any, baseCapabilities());
8686

@@ -92,7 +92,7 @@ describe('QueryEnhancementsPlugin pplLint capability', () => {
9292
const { core, switcher } = setupPlugin();
9393
// No store passed → getAsyncLocalStore() returns undefined. The switcher
9494
// must pass `undefined` rather than { asyncLocalStorageContext: undefined }.
95-
const startContract = stubConfig(core, { pplLint: { enabled: true } });
95+
const startContract = stubConfig(core, { ppl: { lint: { enabled: true } } });
9696

9797
await switcher({} as any, baseCapabilities());
9898

@@ -104,7 +104,7 @@ describe('QueryEnhancementsPlugin pplLint capability', () => {
104104
const { core, switcher } = setupPlugin();
105105
// Dynamic config writes are not schema-validated, so the store can hold a
106106
// string. Only a real boolean `true` may enable the flag.
107-
stubConfig(core, { pplLint: { enabled: 'true' } } as any);
107+
stubConfig(core, { ppl: { lint: { enabled: 'true' } } } as any);
108108

109109
const result = await switcher({} as any, baseCapabilities());
110110

@@ -113,7 +113,7 @@ describe('QueryEnhancementsPlugin pplLint capability', () => {
113113

114114
it('leaves pplLint off when the dynamic config flag is false', async () => {
115115
const { core, switcher } = setupPlugin();
116-
stubConfig(core, { pplLint: { enabled: false } });
116+
stubConfig(core, { ppl: { lint: { enabled: false } } });
117117

118118
const result = await switcher({} as any, baseCapabilities());
119119

src/plugins/query_enhancements/server/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class QueryEnhancementsPlugin
8484
return {
8585
queryEnhancements: {
8686
...(capabilities.queryEnhancements || {}),
87-
pplLint: config.pplLint?.enabled === true,
87+
pplLint: config.ppl?.lint?.enabled === true,
8888
},
8989
};
9090
} catch (error) {

0 commit comments

Comments
 (0)