Skip to content

Refactor lexer#1

Merged
jensneuse merged 4 commits intomasterfrom
refactor-lexer
Dec 31, 2018
Merged

Refactor lexer#1
jensneuse merged 4 commits intomasterfrom
refactor-lexer

Conversation

@jensneuse
Copy link
Copy Markdown
Member

This PR adds some cleanups to the lexer and adds additional tests.

@jensneuse jensneuse merged commit 372c589 into master Dec 31, 2018
@jensneuse jensneuse deleted the refactor-lexer branch December 31, 2018 11:57
jensneuse pushed a commit that referenced this pull request Feb 24, 2020
devsergiy added a commit that referenced this pull request Dec 19, 2023
devsergiy added a commit that referenced this pull request Jan 3, 2024
devsergiy added a commit that referenced this pull request Jan 9, 2024
ysmolski added a commit that referenced this pull request Dec 16, 2025
This produces format that is easier to read:

```
CreatePlanningPaths
===================

Found potentially missing path query.accounts.complex

Planned paths on initial run #1:
	should revisit
	has missing paths
	has fields waiting for dependency

	Missing paths:
		query.accounts.complex

	Run #1. Planner ID 0
		Parent = query
		Datasource ID = id-1, name = id-1, hash = 11987355753863978781
		Paths:
{"ds":11987355753863978781,"path":"query","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts","fieldRef":  2,"typeName":"Query","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.id","fieldRef":  0,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.__typename","fieldRef":  7,"typeName":"User","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

	Run #1. Planner ID 1
		Parent = query.accounts
		Datasource ID = id-2, name = id-2, hash = 14787246084284009732
		Depends on planner IDs: [0]
		Required fields:
			key {"type_name":"User","selection_set":"id","RemappedPaths":null}
		Paths:
{"ds":14787246084284009732,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":14787246084284009732,"path":"query.accounts.nested","fieldRef":  3,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.__typename","fieldRef":  4,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.property","fieldRef":  5,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.name","fieldRef":  6,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

Planned paths on run #2:

	Run #2. Planner ID 0
		Parent = query
		Datasource ID = id-1, name = id-1, hash = 11987355753863978781
		Paths:
{"ds":11987355753863978781,"path":"query","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts","fieldRef":  2,"typeName":"Query","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.id","fieldRef":  0,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.__typename","fieldRef":  7,"typeName":"User","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

	Run #2. Planner ID 1
		Parent = query.accounts
		Datasource ID = id-2, name = id-2, hash = 14787246084284009732
		Depends on planner IDs: [0]
		Required fields:
			key {"type_name":"User","selection_set":"id","RemappedPaths":null}
		Paths:
{"ds":14787246084284009732,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":14787246084284009732,"path":"query.accounts.nested","fieldRef":  3,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.__typename","fieldRef":  4,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.property","fieldRef":  5,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.name","fieldRef":  6,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

	Run #2. Planner ID 2
		Parent = query.accounts
		Datasource ID = id-1, name = id-1, hash = 11987355753863978781
		Depends on planner IDs: [0 1]
		Required fields:
		required by complex: {"type_name":"User","field_name":"complex","selection_set":"nested { property name }","RemappedPaths":{}}
			key {"type_name":"User","selection_set":"id","RemappedPaths":null}
		Paths:
{"ds":11987355753863978781,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts.complex","fieldRef":  1,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
```
ysmolski added a commit that referenced this pull request Dec 16, 2025
This produces format that is easier to read:

```
CreatePlanningPaths
===================

Found potentially missing path query.accounts.complex

Planned paths on initial run #1:
	should revisit
	has missing paths
	has fields waiting for dependency

	Missing paths:
		query.accounts.complex

	Run #1. Planner ID 0
		Parent = query
		Datasource ID = id-1, name = id-1, hash = 11987355753863978781
		Paths:
{"ds":11987355753863978781,"path":"query","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts","fieldRef":  2,"typeName":"Query","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.id","fieldRef":  0,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.__typename","fieldRef":  7,"typeName":"User","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

	Run #1. Planner ID 1
		Parent = query.accounts
		Datasource ID = id-2, name = id-2, hash = 14787246084284009732
		Depends on planner IDs: [0]
		Required fields:
			key {"type_name":"User","selection_set":"id","RemappedPaths":null}
		Paths:
{"ds":14787246084284009732,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":14787246084284009732,"path":"query.accounts.nested","fieldRef":  3,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.__typename","fieldRef":  4,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.property","fieldRef":  5,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.name","fieldRef":  6,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

Planned paths on run #2:

	Run #2. Planner ID 0
		Parent = query
		Datasource ID = id-1, name = id-1, hash = 11987355753863978781
		Paths:
{"ds":11987355753863978781,"path":"query","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts","fieldRef":  2,"typeName":"Query","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.id","fieldRef":  0,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.__typename","fieldRef":  7,"typeName":"User","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

	Run #2. Planner ID 1
		Parent = query.accounts
		Datasource ID = id-2, name = id-2, hash = 14787246084284009732
		Depends on planner IDs: [0]
		Required fields:
			key {"type_name":"User","selection_set":"id","RemappedPaths":null}
		Paths:
{"ds":14787246084284009732,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":14787246084284009732,"path":"query.accounts.nested","fieldRef":  3,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.__typename","fieldRef":  4,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.property","fieldRef":  5,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}
{"ds":14787246084284009732,"path":"query.accounts.nested.name","fieldRef":  6,"typeName":"Nested","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}

	Run #2. Planner ID 2
		Parent = query.accounts
		Datasource ID = id-1, name = id-1, hash = 11987355753863978781
		Depends on planner IDs: [0 1]
		Required fields:
		required by complex: {"type_name":"User","field_name":"complex","selection_set":"nested { property name }","RemappedPaths":{}}
			key {"type_name":"User","selection_set":"id","RemappedPaths":null}
		Paths:
{"ds":11987355753863978781,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts.complex","fieldRef":  1,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
```
devsergiy pushed a commit that referenced this pull request Dec 16, 2025
This produces format that is easier to read:

```
CreatePlanningPaths
===================

[pathBuilderVisitor]:  EnterSelectionSet ref: 2
[pathBuilderVisitor]:  EnterField ref: 2 fieldName: accounts typeName: Query
[pathBuilderVisitor]:  saveAddedPath {"ds":11987355753863978781,"path":"query","shouldWalkFields":true,"pathType":"parent"}
[pathBuilderVisitor]:  saveAddedPath {"ds":11987355753863978781,"path":"query.accounts","fieldRef":  2,"typeName":"Query","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
... SNIP ...
[pathBuilderVisitor]:  LeaveSelectionSet ref: 2

Planned paths on initial run #1:
  should revisit
  has missing paths
  has fields waiting for dependency

  Missing paths:
    query.accounts.full

Run #1. Planner ID 0
  ParentPath: query
  Datasource ID: id-1, name: id-1, hash: 11987355753863978781
  Paths:
{"ds":11987355753863978781,"path":"query","shouldWalkFields":true,"pathType":"parent"}
{"ds":11987355753863978781,"path":"query.accounts","fieldRef":  2,"typeName":"Query","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.id","fieldRef":  0,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}
{"ds":11987355753863978781,"path":"query.accounts.__typename","fieldRef":  4,"typeName":"User","shouldWalkFields":true,"isRootNode":false,"pathType":"field"}


Run #1. Planner ID 1
  ParentPath: query.accounts
  Datasource ID: id-2, name: id-2, hash: 14787246084284009732
  Depends on planner IDs: [0]
  Required fields:
    key: {"type_name":"User","selection_set":"id","RemappedPaths":null}
  Paths:
{"ds":14787246084284009732,"path":"query.accounts","shouldWalkFields":true,"pathType":"parent"}
{"ds":14787246084284009732,"path":"query.accounts.title","fieldRef":  3,"typeName":"User","shouldWalkFields":true,"isRootNode":true,"pathType":"field"}

[pathBuilderVisitor]:  EnterSelectionSet ref: 2
[pathBuilderVisitor]:  EnterField ref: 2 fieldName: accounts typeName: Query
[pathBuilderVisitor]:  EnterSelectionSet ref: 1
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Standardized and clarified diagnostic/log output across selection and
planning flows: run-aware headers, consistent labeling/indentation,
unified messages for node selection and path planning, improved
revisit/missing-path reporting, and deterministic handling of
potentially missing paths to improve troubleshooting.
* **Tests**
* Non-functional test change: an optional debug line added but left
commented out (no behavior change).

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

1 participant