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

Parse introspection types separately from the provided schema #2448

Merged
merged 2 commits into from
Jan 23, 2023

Conversation

SimonSapin
Copy link
Contributor

Fixes #2269

Checklist

Complete the checklist (and note appropriate exceptions) before a final PR is raised.

  • Changes are compatible[^1]
  • Documentation[^2] completed
  • Performance impact assessed and acceptable
  • Tests added and passing[^3]
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

[^1]. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.
[^2]. Configuration is an important part of many changes. Where applicable please try to document configuration examples.
[^3]. Tick whichever testing boxes are applicable. If you are adding Manual Tests:
- please document the manual testing (extensively) in the Exceptions.
- please raise a separate issue to automate the test and label it (or ask for it to be labeled) as manual test

@SimonSapin SimonSapin self-assigned this Jan 20, 2023
Comment on lines +426 to 427
if LevelFilter::current() == LevelFilter::OFF && cfg!(not(debug_assertions)) {
return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This hack is to make tests take the potentially-panicky path

Copy link
Contributor

Choose a reason for hiding this comment

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

could you explain a bit more this change and the next on line 436? The rest of the PR looks nice but that part feels weird

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a panicky bug. I want first to reproduce the panic in a test, then fix it. There were two obstacles to reproduction:

  • LevelFilter::current() appears to be OFF while running test, so the panicky code path was not taken at all. This change causes some logging to stdout to happen even if logging is nominally disabled, when compiled with debug assertions such as for testing. In the test harness however, stdout is captured by default and only shown when a test fails. So this doesn’t normally add visible output.

    I don’t really like this weird condition, but it’ll goo away when we drop AST-based parsing. This shouldn’t print to stdout in the first place. This PR fixes the panic (and tests the fix) without waiting for that larger refactor.

  • The second obstacle is println panic suppressed by test harness stdio capture rust-lang/rust#107118 which would swallow the panic when stdout is captured by the test harness. As commented, adding format! works around that.

@SimonSapin SimonSapin requested a review from bnjjj January 20, 2023 16:54
@SimonSapin
Copy link
Contributor Author

I’d missed that document.definitions() was used in multiple places, please take a look at the fix. (New commit to be squashed)

@SimonSapin SimonSapin merged commit 6368dd0 into dev Jan 23, 2023
@SimonSapin SimonSapin deleted the simon/separate-introspection branch January 23, 2023 09:40
@abernix abernix mentioned this pull request Feb 1, 2023
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.

router panics when parsing invalid schema
3 participants