Skip to content

Add type discovery under app logs-next - #9111

Open
grollest wants to merge 1 commit into
mainfrom
grollest/app-logs-types-local
Open

grollest wants to merge 1 commit into
mainfrom
grollest/app-logs-types-local

Conversation

@grollest

@grollest grollest commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Scope: This PR only shows webhook and GraphQL log types. The remaining log types in this stack will be added once those PRs have merged.

WHY are these changes introduced?

Developers and scripts need a way to discover the historical log types supported by their CLI without querying log records.

WHAT is this pull request doing?

Adds the hidden shopify app logs-next types [TYPE] command for webhook and GraphQL logs. It uses the existing retrieval catalog and bundled descriptive metadata to list types or describe one type, including applicable filters, limitations, and a retrieval example.

Supports human-readable output, --json, and --json-schema, without requiring an app project or authentication. Existing log retrieval and legacy migration behavior remain unchanged.

The command remains pre-release and hidden, so this change does not include a changeset.

How to manually test your changes?

From this checkout, with the CLI built, run:

shopify app logs-next types
Output (exit 0; stderr)
Type     Description
───────  ──────────────────────
webhook  Webhook delivery logs.
graphql  GraphQL request logs.
shopify app logs-next types webhook
Output (exit 0; stderr)
╭─ info ───────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  webhook                                                                     │
│                                                                              │
│  Webhook delivery logs.                                                      │
│                                                                              │
│  Filters                                                                     │
│  `--store` `--status` `--topic` `--status-code`                              │
│                                                                              │
│  Limitations                                                                 │
│    • Each filter accepts one exact value. Different filters combine with     │
│      AND; records without the filtered field are excluded.                   │
│    • --status accepts success or failure using the recorded result status,   │
│      not inferred from HTTP codes or response bodies.                        │
│    • --topic requires an exact slash-form topic, such as orders/create.      │
│      --status-code accepts an exact HTTP code from 100 to 599.               │
│                                                                              │
│  Example                                                                     │
│  `shopify app logs-next --type webhook --topic orders/create --since 30m`    │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
shopify app logs-next types graphql --json --no-input
Output (exit 0; stdout)
{
  "types": [
    {
      "name": "graphql",
      "description": "GraphQL request logs.",
      "filters": [
        "store",
        "status",
        "operation-type",
        "operation-name",
        "request-id"
      ],
      "limitations": [
        "Each filter accepts one exact value. Different filters combine with AND; records without the filtered field are excluded.",
        "--status accepts success or failure using the recorded result status, not inferred from HTTP codes or response bodies.",
        "--operation-name matches the client-supplied operation name, not a root API field. --operation-type matches the recorded operation kind; --request-id matches the request identifier."
      ],
      "example": "shopify app logs-next --type graphql --operation-name MyQuery --since 30m"
    }
  ]
}
shopify app logs-next types --json-schema
Output (exit 0; stdout)
{
  "anyOf": [
    {
      "$ref": "#/definitions/Result"
    },
    {
      "$ref": "#/definitions/Error"
    },
    {
      "$ref": "#/definitions/Event"
    }
  ],
  "title": "CommandOutput",
  "definitions": {
    "Result": {
      "type": "object",
      "properties": {
        "types": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "enum": [
                  "webhook",
                  "graphql"
                ]
              },
              "description": {
                "type": "string"
              },
              "filters": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "store",
                    "status",
                    "topic",
                    "status-code",
                    "operation-type",
                    "operation-name",
                    "request-id"
                  ]
                },
                "description": "Applicable filter flag names for app logs-next, without the -- prefix."
              },
              "limitations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "example": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "description",
              "filters",
              "limitations",
              "example"
            ],
            "additionalProperties": false
          },
          "description": "The complete local catalog, or one selected type. Does not check app access or log availability."
        }
      },
      "required": [
        "types"
      ],
      "additionalProperties": false
    },
    "Error": {
      "type": "object",
      "properties": {
        "error": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "abort"
                },
                "message": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "minLength": 1,
                  "description": "A stable error code, included only when known."
                },
                "tryMessage": {
                  "type": "string"
                },
                "nextSteps": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "customSections": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "body": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        ]
                      }
                    },
                    "required": [
                      "body"
                    ],
                    "additionalProperties": false
                  }
                },
                "details": {
                  "description": "Selected domain details, preserving native API payloads such as GraphQL errors, extensions, and data."
                }
              },
              "required": [
                "type",
                "message"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "bug"
                },
                "message": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/message"
                },
                "code": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/code"
                },
                "tryMessage": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/tryMessage"
                },
                "nextSteps": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/nextSteps"
                },
                "customSections": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/customSections"
                },
                "details": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/details"
                },
                "stack": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "message"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "const": "external"
                },
                "message": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/message"
                },
                "code": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/code"
                },
                "tryMessage": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/tryMessage"
                },
                "nextSteps": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/nextSteps"
                },
                "customSections": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/customSections"
                },
                "details": {
                  "$ref": "#/definitions/Error/properties/error/anyOf/0/properties/details"
                },
                "command": {
                  "type": "string"
                },
                "args": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": [
                "type",
                "message",
                "command",
                "args"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "error"
      ],
      "additionalProperties": false
    },
    "Event": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "diagnostic"
            },
            "timestamp": {
              "type": "string",
              "format": "date-time",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$",
              "description": "A UTC ISO 8601 instant with whole seconds and the Z timezone marker."
            },
            "level": {
              "type": "string",
              "enum": [
                "debug",
                "info",
                "warning",
                "error"
              ]
            },
            "message": {
              "type": "string"
            },
            "code": {
              "type": "string",
              "minLength": 1,
              "description": "A stable diagnostic code, included only when known."
            }
          },
          "required": [
            "type",
            "timestamp",
            "level",
            "message"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "progress"
            },
            "timestamp": {
              "$ref": "#/definitions/Event/anyOf/0/properties/timestamp"
            },
            "status": {
              "type": "string",
              "enum": [
                "started",
                "updated",
                "retrying",
                "completed",
                "failed"
              ]
            },
            "operation": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "current": {
              "type": "integer",
              "minimum": 0
            },
            "total": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "type",
            "timestamp",
            "status",
            "operation"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}
shopify app logs-next types not-a-type --json --no-input
Output (exit 1; stdout)
{"error":{"type":"abort","message":"Supported log types are webhook and graphql.","code":"invalid-argument"}}
  • The list shows webhook and graphql; selecting one type shows its details.
  • JSON output contains a types array, with one entry when a type is selected.
  • Schema output describes the result, error, and event formats.
  • An unknown type exits nonzero with an actionable error listing supported names.

Validation

  • 230 focused discovery, retrieval, and help tests passed.
  • App and CLI type-checks, targeted ESLint, CLI bundle, manifest generation, and command snapshot checks passed.
  • Built-command smoke tests passed with an empty project directory, isolated home, and network access blocked, including JSON, human output, schema output, and error handling.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Nov 9, 2026
@grollest
grollest force-pushed the grollest/app-logs-types-local branch from 3b95dbd to 9b53558 Compare November 9, 2026 22:18
@grollest
grollest force-pushed the grollest/app-logs-types-local branch from 9b53558 to 670d1d7 Compare November 9, 2026 22:20
@grollest grollest mentioned this pull request Nov 9, 2026
4 tasks done
@grollest
grollest marked this pull request as ready for review November 9, 2026 22:43
@grollest
grollest requested review from a team as code owners November 9, 2026 22:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant