Skip to content

Filter Shopify-proprietary metafields from schema dumps#27

Merged
elia merged 3 commits into
mainfrom
filter-shopify-proprietary-metafields
Feb 10, 2026
Merged

Filter Shopify-proprietary metafields from schema dumps#27
elia merged 3 commits into
mainfrom
filter-shopify-proprietary-metafields

Conversation

@elia

@elia elia commented Feb 10, 2026

Copy link
Copy Markdown
Member

Fixes the issue where Shopify-managed metafields were being included in schema dumps.

Changes

  • Added filtering logic to exclude metafields with shopify or shopify--* namespaces from schema dumps
  • These are Shopify-managed metafields that should not be recreated from migrations
  • Added tests to verify the filtering works correctly
  • Also allow selecting shop via SHOPIFY_DOMAIN env var in CLI commands

Examples of filtered metafields

  • `namespace: :shopify` (e.g., dog-age-group, pet-food-flavor)
  • `namespace: :"shopify--discovery--product_recommendation"` (e.g., related_products, complementary_products)

Co-Authored-By: GitHub Copilot noreply@github.com

@elia elia self-assigned this Feb 10, 2026
Shopify-managed metafields (namespace 'shopify' or 'shopify--*') are now
excluded from schema dumps as they are system-managed and should not be
recreated from migrations.

Also allow selecting shop via SHOPIFY_DOMAIN env var in CLI commands.

Co-Authored-By: GitHub Copilot <noreply@github.com>
@elia
elia force-pushed the filter-shopify-proprietary-metafields branch from 83752eb to b4b6553 Compare February 10, 2026 12:01
@elia
elia requested a review from Copilot February 10, 2026 12:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates ShopifyToolkit’s schema dumping and CLI behavior to avoid treating Shopify-managed metafields as portable schema/migration artifacts, while also allowing CLI commands to target a specific shop via SHOPIFY_DOMAIN.

Changes:

  • Filter metafield definitions from schema dumps when the namespace is shopify or starts with shopify--.
  • Add spec coverage to ensure Shopify-proprietary metafields are excluded from dumped schema output.
  • Update CLI commands to use a selected shop (optionally via SHOPIFY_DOMAIN) instead of always Shop.sole.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
spec/shopify_toolkit/schema_spec.rb Adds a test context verifying Shopify-proprietary namespaces are excluded from schema dumps.
lib/shopify_toolkit/schema.rb Introduces shopify_proprietary? filtering in generate_schema_content prior to sorting/dumping metafields.
lib/shopify_toolkit/command_line.rb Routes migrate/rollback/redo/schema load/dump through a shop selector supporting SHOPIFY_DOMAIN.
.gitignore Ignores .tool-versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/shopify_toolkit/command_line.rb Outdated
- Replaces find_by with find_by! to raise ActiveRecord::RecordNotFound immediately
- Uses .presence to treat blank SHOPIFY_DOMAIN env var as unset
- Prevents NoMethodError on nil shop and improves CLI error diagnostics
@elia
elia merged commit f57604c into main Feb 10, 2026
4 checks passed
@elia
elia deleted the filter-shopify-proprietary-metafields branch February 10, 2026 12:10
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