Remove dead defaultAppConfigReverseTransform and add round-trip fidelity tests#6953
Draft
ryancbahan wants to merge 1 commit intorcb/extract-webhook-transformfrom
Draft
Remove dead defaultAppConfigReverseTransform and add round-trip fidelity tests#6953ryancbahan wants to merge 1 commit intorcb/extract-webhook-transformfrom
ryancbahan wants to merge 1 commit intorcb/extract-webhook-transformfrom
Conversation
This was referenced Mar 8, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
Contributor
Coverage report
Test suite run success3832 tests passing in 1467 suites. Report generated by 🧪jest coverage report action from 4aee85b |
714a3d8 to
8a8e57d
Compare
34aab98 to
2d9c5ca
Compare
8a8e57d to
00322a4
Compare
2d9c5ca to
9d40417
Compare
00322a4 to
65adeee
Compare
9d40417 to
bb7208c
Compare
65adeee to
4aee85b
Compare
Contributor
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationspackages/cli-kit/dist/public/node/toml/codec.d.tsimport { JsonMap } from '../../../private/common/json.js';
export type JsonMapType = JsonMap;
/**
* Given a TOML string, it returns a JSON object.
*
* @param input - TOML string.
* @returns JSON object.
*/
export declare function decodeToml(input: string): JsonMapType;
/**
* Given a JSON object, it returns a TOML string.
*
* @param content - JSON object.
* @returns TOML string.
*/
export declare function encodeToml(content: JsonMap | object): string;
packages/cli-kit/dist/public/node/toml/index.d.tsexport type { JsonMapType } from './codec.js';
packages/cli-kit/dist/public/node/toml/toml-file.d.tsimport { JsonMapType } from './codec.js';
/**
* Thrown when a TOML file cannot be parsed. Includes the file path for context.
*/
export declare class TomlParseError extends Error {
readonly path: string;
constructor(path: string, cause: Error);
}
/**
* General-purpose TOML file abstraction.
*
* Provides a unified interface for reading, patching, removing keys from, and replacing
* the content of TOML files on disk.
*
* - `read` populates content from disk
* - `patch` does surgical WASM-based edits (preserves comments and formatting)
* - `remove` deletes a key by dotted path (preserves comments and formatting)
* - `replace` does a full re-serialization (comments and formatting are NOT preserved).
* - `transformRaw` applies a function to the raw TOML string on disk.
*/
export declare class TomlFile {
/**
* Read and parse a TOML file from disk. Throws if the file doesn't exist or contains invalid TOML.
* Parse errors are wrapped in {@link TomlParseError} with the file path for context.
*
* @param path - Absolute path to the TOML file.
* @returns A TomlFile instance with parsed content.
*/
static read(path: string): Promise<TomlFile>;
readonly path: string;
content: JsonMapType;
constructor(path: string, content: JsonMapType);
/**
* Surgically patch values in the TOML file, preserving comments and formatting.
*
* Accepts a nested object whose leaf values are set in the TOML. Intermediate tables are
* created automatically. Setting a leaf to `undefined` removes it (use `remove()` for a
* clearer API when deleting keys).
*
* @example
* ```ts
* await file.patch({build: {dev_store_url: 'my-store.myshopify.com'}})
* await file.patch({application_url: 'https://example.com', auth: {redirect_urls: ['...']}})
* ```
*/
patch(changes: {
[key: string]: unknown;
}): Promise<void>;
/**
* Remove a key from the TOML file by dotted path, preserving comments and formatting.
*
* @param keyPath - Dotted key path to remove (e.g. 'build.include_config_on_deploy').
* @example
* ```ts
* await file.remove('build.include_config_on_deploy')
* ```
*/
remove(keyPath: string): Promise<void>;
/**
* Replace the entire file content. The file is fully re-serialized — comments and formatting
* are NOT preserved.
*
* @param content - The new content to write.
* @example
* ```ts
* await file.replace({client_id: 'abc', name: 'My App'})
* ```
*/
replace(content: JsonMapType): Promise<void>;
/**
* Transform the raw TOML string on disk. Reads the file, applies the transform function
* to the raw text, writes back, and re-parses to keep `content` in sync.
*
* Use this for text-level operations that can't be expressed as structured edits —
* e.g. Injecting comments or positional insertion of keys in arrays-of-tables.
* Subsequent `patch()` calls will preserve any comments added this way.
*
* @param transform - A function that receives the raw TOML string and returns the modified string.
* @example
* ```ts
* await file.transformRaw((raw) => `# Header comment\n${raw}`)
* ```
*/
transformRaw(transform: (raw: string) => string): Promise<void>;
private decode;
}
Existing type declarationsWe found no diffs with existing type declarations |
4aee85b to
742abef
Compare
bb7208c to
0dbbbb9
Compare
5 tasks
…ity tests Delete unreachable defaultAppConfigReverseTransform and its dead code path in resolveReverseAppConfigTransform. Add round-trip tests for all 9 config specs documenting forward/reverse transform behavior and known asymmetries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0dbbbb9 to
fddb50d
Compare
742abef to
5d2f349
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
Two cleanup items after completing Phase 2 (Zod transform extraction):
defaultAppConfigReverseTransforminspecification.tsis dead code. Every spec that usescreateConfigExtensionSpecificationprovides atransformConfig, so the!transformConfigfallback branch is unreachable. The function also relies on Zod internal APIs (schema._def.shape()) which are undocumented and fragile.With all three Zod transforms now extracted (extension_directories, scopes, webhooks), there's no systematic documentation of which spec transforms round-trip cleanly and which have known asymmetries. This makes it hard to reason about config fidelity during deploy/pull cycles.
WHAT is this pull request doing?
Dead code removal:
defaultAppConfigReverseTransformand its 25 lines of Zod-internals-based nesting logicresolveReverseAppConfigTransform— removes theschemaparameter since the unreachable branch that used it is goneRound-trip fidelity tests for all 9 config specs:
branding— exact round-tripapp_home— exact round-tripapp_access— exact round-trippoint_of_sale— exact round-tripapp_proxy— known asymmetry: relative URLs become absolute (forward prependsapplication_url, reverse doesn't strip it back)webhooks— subscriptions intentionally dropped (handled bywebhook_subscriptionspec)webhook_subscription— forward produces flat form, reverse wraps in{webhooks: {subscriptions: [...]}}structureprivacy_compliance_webhooks— reverse reconstructs subscriptions from flat URLs, sorted by URIevents— reverse strips server-managedidentifierfieldEach known asymmetry is documented inline in the test with an explanation of why it exists.
How to test your changes?
Measuring impact
Checklist