Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prompt before applying migration #5390

Draft
wants to merge 1 commit into
base: zl/migrate_scopes_to_required_scopes
Choose a base branch
from

Conversation

zzooeeyy
Copy link
Contributor

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

zzooeeyy commented Feb 12, 2025

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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@zzooeeyy zzooeeyy mentioned this pull request Feb 12, 2025
5 tasks
@zzooeeyy zzooeeyy force-pushed the zl/migrate_scopes_to_required_scopes branch from 54472ee to 0b02232 Compare February 12, 2025 23:52
@zzooeeyy zzooeeyy force-pushed the zl/add_prompt_before_applying_migration branch from 809e890 to fa871de Compare February 12, 2025 23:52
@zzooeeyy zzooeeyy mentioned this pull request Feb 12, 2025
5 tasks
@zzooeeyy zzooeeyy force-pushed the zl/migrate_scopes_to_required_scopes branch from 0b02232 to 3f89a13 Compare February 13, 2025 22:54
@zzooeeyy zzooeeyy force-pushed the zl/add_prompt_before_applying_migration branch from fa871de to 60fb77f Compare February 13, 2025 22:54
@zzooeeyy zzooeeyy force-pushed the zl/add_prompt_before_applying_migration branch from 60fb77f to bcfaf04 Compare February 13, 2025 23:46
Copy link
Contributor

Differences in type declarations

We 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:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/themes/api.d.ts
@@ -5,7 +5,7 @@ export type ThemeParams = Partial<Pick<Theme, 'name' | 'role' | 'processing' | '
 export type AssetParams = Pick<ThemeAsset, 'key'> & Partial<Pick<ThemeAsset, 'value' | 'attachment'>>;
 export declare function fetchTheme(id: number, session: AdminSession): Promise<Theme | undefined>;
 export declare function fetchThemes(session: AdminSession): Promise<Theme[]>;
-export declare function themeCreate(params: ThemeParams, session: AdminSession): Promise<Theme | undefined>;
+export declare function createTheme(params: ThemeParams, session: AdminSession): Promise<Theme | undefined>;
 export declare function fetchThemeAssets(id: number, filenames: Key[], session: AdminSession): Promise<ThemeAsset[]>;
 export declare function deleteThemeAssets(id: number, filenames: Key[], session: AdminSession): Promise<Result[]>;
 export declare function bulkUploadThemeAssets(id: number, assets: AssetParams[], session: AdminSession): Promise<Result[]>;

Copy link
Contributor

@MitchDickinson MitchDickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the addition of prompting, but IMO let's try to get prompting content and config transformation rules behind the same constrained interface.

@@ -73,6 +73,7 @@ export interface ExtensionSpecification<TConfiguration extends BaseConfigType =
hasExtensionPointTarget?(config: TConfiguration, target: string): boolean
appModuleFeatures: (config?: TConfiguration) => ExtensionFeature[]
migratePendingSchemaChanges?: (extension: ExtensionInstance<TConfiguration>) => Promise<void>
pendingSchemaChanges?: (extension: ExtensionInstance<TConfiguration>) => string[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a continuation of my feedback on the first PR, I suspect we can simplify this interface further.

If migratePendingSchemaChanges is updated to be a more constrained interface, we can probably leverage the same interface to do the prompting.

I originally suggested something like (config: TConfig) => TConfig as the interface, which would allow arbitrary re-mapping of configs to be defined by specifications.

This could be further abstracted in a way that would also allow you to handle prompting. For example, suppose this is the interface:

// Return an array of ConfigTransformations, which the platform can evaluate
configTransformations: () => ConfigTransformation[] 

// Define another interface for a config transformation, which can also include prompts
export interface ConfigTransformation {
  // The usual transform function suggested previously
  transformer: (config: TConfig) => TConfig
  // Not actually sure if this is right, but hopefully it conveys the idea.
  promptMessage: String
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants