feat(DEBT-67): add opt-in single-line error display - #2055
Draft
RuellePaul wants to merge 2 commits into
Draft
Conversation
When KILI_SDK_SIMPLIFY_ERROR_LOGS=true (or "simplify_error_logs": true in kili-sdk-config.json), SDK errors are displayed as a single concise line instead of a full traceback: - GraphQL errors keep only the actual cause: error codes, boilerplate and backend stack traces are stripped - authentication failures become e.g. "Invalid API key `**gerg`" - SDK warnings are displayed on one line - works in plain scripts (sys.excepthook) and IPython/Jupyter (custom exc) Default behavior is unchanged when the flag is not set.
…ly warning The domain client emits its work-in-progress warning before building the legacy client, i.e. before the configuration file had a chance to enable the simplified display. Enable it from the configuration at the very start of the domain client init.
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.
What
Opt-in simplified error display: SDK errors become a single concise line instead of a full Python traceback + raw GraphQL payload.
Enable it with the
KILI_SDK_SIMPLIFY_ERROR_LOGSenvironment variable (true/1/yes), or with"simplify_error_logs": trueinkili-sdk-config.json. Default behavior is unchanged when the flag is not set.After (flag enabled)
How
kili/core/simplified_errors.py:simplify_graphql_error_message()strips[errorCode]prefixes, the "This can be due to:" boilerplate and backend stack-trace linessys.excepthookrenders uncaughtkili.*exceptions as a single line — non-Kili exceptions keep their full tracebackGraphQLError/AuthenticationFailedbuild short messages when the flag is enabled (e.g.Invalid API key `**gerg`); also fixes an unbalanced quote in the batched-error messagekiliimport time (env var) and at client init (config file), including the domain client before its early warningdocs/configuration.md, env var reference table,kili-sdk-config.example.jsonTests
tests/unit/core/test_simplified_errors.py; full unit suite green; ruff / pylint 10.00 / pyright cleanDEBT-67 — companion of the label-backend-v2 MR
Draft: fix(DEBT-67): remove stack traces from client-facing GraphQL error messages(kili-technology/kili!14274).