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

relay-compiler diagnostic errors logging improvements #4574

Closed
wants to merge 1 commit into from

Commits on Jan 10, 2024

  1. relay-compiler diagnostic errors logging improvements

    1. Update diagnostic.print_without_source() to no longer include character ranges since the formatting of startchar:endchar doesnt match the standard expectation of linenumber:character (and thus editors will interpret it wrong)
    2. Updated the ValidationErrors to no longer enumerate all errors, and instead show the count (since the actual errors are shown above anyway)
    
    # Test Plan
    
    Confirmed the new formatting of .print_without_source() is correct with no character ranges (tested via ValidationError since I'm not sure how to generate a DiagnosticsError, but this will no longer be triggered due to the summarization change):
    ```
    [INFO] Querying files to compile...
    [INFO] [default] compiling...
    [ERROR] Error: ✖︎ The type `CustomMetric` has no field `test`.
    See https://relay.dev/docs/error-reference/unknown-field/
    
      client/components/console/metrics_catalog/MetricDefinitionDebugDialog.tsx:20:7
       19 │       configuration_json
       20 │       test
          │       ^^^^
       21 │     }
    
    [ERROR] Compilation failed.
    [ERROR] Unable to run relay compiler. Error details:
    Failed to build:
     - Validation errors:
     - The type `CustomMetric` has no field `test`.
    See https://relay.dev/docs/error-reference/unknown-field/: client/components/console/metrics_catalog/MetricDefinitionDebugDialog.tsx
    ```
    
    Confirmed the count shows instead of the individual errors now:
    ```
    [INFO] Querying files to compile...
    [INFO] [default] compiling...
    [ERROR] Error: ✖︎ The type `CustomMetric` has no field `test`.
    See https://relay.dev/docs/error-reference/unknown-field/
    
      client/components/console/metrics_catalog/MetricDefinitionDebugDialog.tsx:20:7
       19 │       configuration_json
       20 │       test
          │       ^^^^
       21 │     }
    
    [ERROR] Compilation failed.
    [ERROR] Unable to run relay compiler. Error details:
    Failed to build:
     - Validation errors: 1 error(s) encountered above.
    
    ```
    
    Also confirmed that config errors still showed up correctly:
    ```
    [ERROR] Config `/Users/alex/dev/statsig/console/relay.config.js` is invalid:
     - The `schema` configured for project `default` does not exist at `./server/lib/graphql/schedma.graphql`.
    alex-statsig committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    4ab3234 View commit details
    Browse the repository at this point in the history