tailcall icon indicating copy to clipboard operation
tailcall copied to clipboard

Add `Pos` to `Config`

Open tusharmath opened this issue 2 years ago • 10 comments

Currently Config type doesn't hold any position information in its fields. This makes it extremely difficult to debug and attach meaningful traces. In this issue, we want to insert tracing information in the config. That way we could see better errors:

Current

❯ tailcall check ./examples/jsonplaceholder.graphql
 INFO Env file: "/Users/tushar/Documents/Projects/tailcall/.env" loaded
 INFO File read: ./examples/jsonplaceholder.graphql ... ok
 WARN A new release of tailcall is available: v0.74.1 ➜ v0.74.12
 WARN To upgrade, run: brew upgrade tailcall
 WARN https://github.com/tailcallhq/tailcall/releases/tag/v0.74.12
ERROR Invalid Configuration
Caused by:
  • No base URL defined [at Post.user.@call.@http]
  • No base URL defined [at Query.posts.@http]
  • No base URL defined [at Query.user.@http]
  • No base URL defined [at Query.users.@http]

Expected

❯ tailcall check ./examples/jsonplaceholder.graphql
 INFO Env file: "/Users/tushar/Documents/Projects/tailcall/.env" loaded
 INFO File read: ./examples/jsonplaceholder.graphql ... ok
 WARN A new release of tailcall is available: v0.74.1 ➜ v0.74.12
 WARN To upgrade, run: brew upgrade tailcall
 WARN https://github.com/tailcallhq/tailcall/releases/tag/v0.74.12
ERROR Invalid Configuration
Caused by:
  • No base URL defined [at ./examples/jsonplaceholder.graphql#8:17]

Going forward we would be able to extract a piece of text from the source file and display it on the CLI with swiggly lines under it.

Technical Requirements

  • Add a new type called Pos for each field in Config. This field is essentially transparent to the serializer/deserializer

    struct Pos<A> {
      line: u64,
      offset: u64,
      value: A
    }
    
  • Implement merge_right on Pos in such a way that position information is correctly merged. Ensure information is stored in Pos from wherever the data is read from.

tusharmath avatar Apr 11 '24 06:04 tusharmath

/bounty 100$

tusharmath avatar Apr 11 '24 06:04 tusharmath

~~## 💎 $100 bounty • Tailcall Inc.~~

~~### Steps to solve:~~ ~~1. Start working: Comment /attempt #1698 with your implementation plan~~ ~~2. Submit work: Create a pull request including /claim #1698 in the PR body to claim the bounty~~ ~~3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts~~

~~🙏 Thank you for contributing to tailcallhq/tailcall!~~ ~~🧐 Checkout our guidelines before you get started.~~ ~~💵 More about our bounty program.~~

Attempt Started (GMT+0) Solution
🔴 @timburrows Apr 13, 2024, 3:32:38 AM WIP
🔴 @emekaokoli19 Apr 20, 2024, 3:06:55 AM WIP

algora-pbc[bot] avatar Apr 11 '24 06:04 algora-pbc[bot]

/attempt #1698

Options

timburrows avatar Apr 13 '24 03:04 timburrows

@timburrows: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏

algora-pbc[bot] avatar Apr 14 '24 03:04 algora-pbc[bot]

The bounty is up for grabs! Everyone is welcome to /attempt #1698 🙌

algora-pbc[bot] avatar Apr 15 '24 03:04 algora-pbc[bot]

I'm still looking into this but I haven't determined a good way to maintain Pos data on each of the fields without a lot of otherwise unused members on each struct. I was considering that if the only use case was for tracing, keeping a key value pair might suffice?

timburrows avatar Apr 15 '24 03:04 timburrows

/attempt #1698

Options

emekaokoli19 avatar Apr 20 '24 03:04 emekaokoli19

Action required: Issue inactive for 30 days. Status update or closure in 7 days.

github-actions[bot] avatar Jun 05 '24 20:06 github-actions[bot]

Issue closed after 7 days of inactivity.

github-actions[bot] avatar Jun 12 '24 21:06 github-actions[bot]

Action required: Issue inactive for 30 days. Status update or closure in 7 days.

github-actions[bot] avatar Aug 09 '24 20:08 github-actions[bot]

Issue closed after 7 days of inactivity.

github-actions[bot] avatar Aug 16 '24 21:08 github-actions[bot]