From 6ef0a42479a3bf70617c5fcf99e54cdf2c025cff Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 29 Sep 2026 10:12:09 +0200 Subject: [PATCH] refactor: drops the configuration schema's autosquash hide-list, the field is gone upstream `src/util/sanitizedConfigSchema.ts` deep-cloned the synced configuration schema and deleted every `autosquash` key from it before the reference tables rendered. `autosquash` has left the schema: the engine stopped accepting it on 2026-09-24, and `public/mergify-configuration-schema.json` has held zero occurrences since the 2026-09-25 sync. The list matched nothing, and the module cloned and walked the whole schema on every build to delete a key that was not there. The eight importers now read the JSON directly. None of them mutates it, so the clone bought nothing either. Rendered pages are unchanged. The same file is served verbatim at `/mergify-configuration-schema.json`, so the list never hid the field from anyone reading the schema, only from the tables. This is the configuration-schema half of what #13055 did for the API reference. Restoring a hide-list for a future field is a revert. The removal's changelog entry (2026-09-29, "`autosquash` has been removed") is published separately through the changelog pipeline. Fixes MRGFY-9851 Co-Authored-By: Claude Opus 5.5 Change-Id: I0b21b914d2d3a7f0360e8717c9c94858463446be --- src/components/Tables/ActionOptionsTable.tsx | 2 +- src/components/Tables/ConfigOptions.tsx | 2 +- src/components/Tables/OptionsTable.tsx | 2 +- .../Tables/PullRequestAttributes.tsx | 2 +- src/components/Tables/QueueDequeueReasons.tsx | 2 +- .../Tables/TemplateVariablesTable.tsx | 2 +- src/util/mdxast.tsx | 2 +- src/util/sanitizedConfigSchema.ts | 28 ------------------- src/util/schemaToMarkdown.ts | 3 +- 9 files changed, 8 insertions(+), 37 deletions(-) delete mode 100644 src/util/sanitizedConfigSchema.ts diff --git a/src/components/Tables/ActionOptionsTable.tsx b/src/components/Tables/ActionOptionsTable.tsx index e0b47d9b27..bfc204b6fb 100644 --- a/src/components/Tables/ActionOptionsTable.tsx +++ b/src/components/Tables/ActionOptionsTable.tsx @@ -1,4 +1,4 @@ -import configSchema from '../../util/sanitizedConfigSchema'; +import configSchema from '../../../public/mergify-configuration-schema.json'; import { ConfigSchema, Def } from './ConfigOptions'; import { OptionsTableBase } from './OptionsTable'; diff --git a/src/components/Tables/ConfigOptions.tsx b/src/components/Tables/ConfigOptions.tsx index 2378e16612..7f0bb61094 100644 --- a/src/components/Tables/ConfigOptions.tsx +++ b/src/components/Tables/ConfigOptions.tsx @@ -1,7 +1,7 @@ import jsonpointer from 'jsonpointer'; import React, { ReactElement } from 'react'; import { getDataTypeHref, isDataType } from '~/util/dataType'; -import configSchema from '~/util/sanitizedConfigSchema'; +import configSchema from '../../../public/mergify-configuration-schema.json'; import { renderMarkdown } from './utils'; const valueTypeLinks: { [key: string]: string } = { diff --git a/src/components/Tables/OptionsTable.tsx b/src/components/Tables/OptionsTable.tsx index 6f88b2d98b..07b48a1a9a 100644 --- a/src/components/Tables/OptionsTable.tsx +++ b/src/components/Tables/OptionsTable.tsx @@ -1,6 +1,6 @@ import * as yaml from 'js-yaml'; -import configSchema from '../../util/sanitizedConfigSchema'; +import configSchema from '../../../public/mergify-configuration-schema.json'; import { extractTemplateVariables } from '../../util/templateVariables'; import Badge from '../Badge/Badge'; import { diff --git a/src/components/Tables/PullRequestAttributes.tsx b/src/components/Tables/PullRequestAttributes.tsx index 0ba9c36cfe..eed348bfc2 100644 --- a/src/components/Tables/PullRequestAttributes.tsx +++ b/src/components/Tables/PullRequestAttributes.tsx @@ -1,5 +1,5 @@ +import configSchema from '../../../public/mergify-configuration-schema.json'; import { getAttributeDocumentationUrl, getAttributeSource } from '../../util/attributeMetadata'; -import configSchema from '../../util/sanitizedConfigSchema'; import { getValueType } from './ConfigOptions'; import { defToIdPrefix } from './OptionsTable'; // Attributes render with the OptionsTable layout (stacked entries, full-width diff --git a/src/components/Tables/QueueDequeueReasons.tsx b/src/components/Tables/QueueDequeueReasons.tsx index ca663b475b..2bf887b346 100644 --- a/src/components/Tables/QueueDequeueReasons.tsx +++ b/src/components/Tables/QueueDequeueReasons.tsx @@ -1,5 +1,5 @@ +import configSchema from '../../../public/mergify-configuration-schema.json'; import { readEnumChoices } from '../../util/enumChoices'; -import configSchema from '../../util/sanitizedConfigSchema'; import { renderMarkdown } from './utils'; diff --git a/src/components/Tables/TemplateVariablesTable.tsx b/src/components/Tables/TemplateVariablesTable.tsx index 3db0f174e5..811f56babb 100644 --- a/src/components/Tables/TemplateVariablesTable.tsx +++ b/src/components/Tables/TemplateVariablesTable.tsx @@ -1,4 +1,4 @@ -import configSchema from '../../util/sanitizedConfigSchema'; +import configSchema from '../../../public/mergify-configuration-schema.json'; import { extractTemplateVariables } from '../../util/templateVariables'; import { ConfigSchema, Def } from './ConfigOptions'; diff --git a/src/util/mdxast.tsx b/src/util/mdxast.tsx index 92051cba6f..d287ad344a 100644 --- a/src/util/mdxast.tsx +++ b/src/util/mdxast.tsx @@ -6,8 +6,8 @@ import { } from '~/components/Tables/ConfigOptions'; import { OptionsTableBase } from '~/components/Tables/OptionsTable'; import PullRequestAttributesTable from '~/components/Tables/PullRequestAttributes'; +import configSchema from '../../public/mergify-configuration-schema.json'; import { MdxNodeJsxElement } from '../@types/mdxast'; -import configSchema from './sanitizedConfigSchema'; interface TableType { node: string; diff --git a/src/util/sanitizedConfigSchema.ts b/src/util/sanitizedConfigSchema.ts deleted file mode 100644 index fd899d0a05..0000000000 --- a/src/util/sanitizedConfigSchema.ts +++ /dev/null @@ -1,28 +0,0 @@ -import rawConfigSchema from '../../public/mergify-configuration-schema.json'; - -// Fields to hide from configuration documentation -const hiddenFields = ['autosquash']; - -function deepRemoveKey(value: any, keyToRemove: string) { - if (Array.isArray(value)) { - for (const item of value) deepRemoveKey(item, keyToRemove); - return value; - } - if (value && typeof value === 'object') { - if (Object.prototype.hasOwnProperty.call(value, keyToRemove)) { - delete (value as any)[keyToRemove]; - } - for (const k of Object.keys(value)) deepRemoveKey((value as any)[k], keyToRemove); - } - return value; -} - -function sanitizeConfigSchema() { - const cloned = JSON.parse(JSON.stringify(rawConfigSchema)); - for (const field of hiddenFields) deepRemoveKey(cloned, field); - return cloned as typeof rawConfigSchema; -} - -const configSchema = sanitizeConfigSchema(); - -export default configSchema; diff --git a/src/util/schemaToMarkdown.ts b/src/util/schemaToMarkdown.ts index 7bbbb5c907..4b438ab208 100644 --- a/src/util/schemaToMarkdown.ts +++ b/src/util/schemaToMarkdown.ts @@ -1,8 +1,7 @@ import jsonpointer from 'jsonpointer'; - +import configSchema from '../../public/mergify-configuration-schema.json'; import { getAttributeDocumentationUrl, getAttributeSource } from './attributeMetadata'; import { getDataTypeHref, isDataType } from './dataType'; -import configSchema from './sanitizedConfigSchema'; type Schema = typeof configSchema;