Skip to content

Conversation

@clarkg
Copy link
Contributor

@clarkg clarkg commented May 9, 2025

discussed in Slack with Scott - insertUnlessConflict should be Withable also

there actually weren't any previous tests explicitly testing insert is withable, but added one anyway for unlessConflict

@gel-data-cla
Copy link

gel-data-cla bot commented May 9, 2025

All commit authors signed the Contributor License Agreement.
CLA signed

@clarkg clarkg requested a review from scotttrinh May 9, 2025 23:28
@clarkg
Copy link
Contributor Author

clarkg commented May 13, 2025

@scotttrinh any chance we can get this in?

also the "Regression Tests" have been hanging this whole time with no way for me to inspect their status - do they need to complete?

@scotttrinh
Copy link
Collaborator

@clarkg Apologies for the delay here. I have to kick off the CI runs manually due to security settings on the org, which I've just done. I'll get this merged today.

@clarkg
Copy link
Contributor Author

clarkg commented May 13, 2025

@scotttrinh no worries, that makes sense.

selfishly I was being lazy and was YOLOing the test without actually setting up a test env. just attempted to fix the latest test failure, hope it works this time

@clarkg
Copy link
Contributor Author

clarkg commented May 13, 2025

@scotttrinh omg i'm so sorry - i read characters in the schema and still wrote movie_characters. fixed again

fwiw i totally acknowledge my laziness here and apologize for the thrash asking you to re-run the tests, but it is surprising and adds too much friction to contribute. i contributed to Expo last week and they just automatically kickoff tests which let me pretty easily YOLO contribute

@scotttrinh
Copy link
Collaborator

it is surprising and adds too much friction to contribute. i contributed to Expo last week and they just manually kickoff tests which let me pretty easily YOLO contribute

It's all good: the rule is that if you've never had a PR merged, we have to manually trigger them just to add a bit of trust in the PR process. Actions have pretty powerful capabilities, so our security stance has been to be a bit more careful than the default in GitHub. Once we've merged this PR, your subsequent contributions (if you ever come back! 🙈 ) will not require this manual intervention. I also acknowledge that onboarding someone to being able to run the tests themselves locally is not great at the moment, and I'll work on that, too!

@clarkg
Copy link
Contributor Author

clarkg commented May 13, 2025

@scotttrinh thanks. now finally getting to a more meaningful error, but probably still dumb Q:

FAIL ./insert.test.ts
  ● insert › with wrapping insert .unlessConflict()

    Expr or its aliases used outside of declared 'WITH' block scope

      311 |       ]) {
      312 |         if (scope === null || !validScopes.has(scope)) {
    > 313 |           throw new Error(
          |                 ^
      314 |             refData.boundScope
      315 |               ? `Expr or its aliases used outside of declared 'WITH' block scope`
      316 |               : `Cannot extract repeated or aliased expression into 'WITH' block, ` +

      at Proxy.$toEdgeQL (dbschema/edgeql-js/toEdgeQL.ts:313:17)
      at Proxy.$queryFunc (dbschema/edgeql-js/query.ts:30:22)
      at Object.<anonymous> (insert.test.ts:173:32)

what's wrong with this though - dep is inside the e.with?

    const query = e.with(
      [dep], // dependency used inside the insert expression
      e
        .insert(e.Movie, {
          title: "WithUnlessConflict – test",
          characters: e.select(dep, () => ({
            "@character_name": "Peter Quill",
          })),
        })
        .unlessConflict((movie) => ({
          on: movie.title,
        })),
    );
    ```

@clarkg
Copy link
Contributor Author

clarkg commented May 13, 2025

@scotttrinh ok this is it for sure, thanks again. last test just failed for formatting and I ran prettier

@scotttrinh
Copy link
Collaborator

@clarkg I'm going to push up a fix for a few issues, I just ran the tests locally and was able to iterate to the simplest form that works here after a few more rounds with the tests. Stand by!

- `Person` is abstract, so use a concrete type
- The `name` exclusive constraint is on the `Person` type, so cannot use
  an `else`
- Selecting a constant value like `42` means that the cardinality will
  be `One` and the type will be that constant value: `42`
@clarkg
Copy link
Contributor Author

clarkg commented May 13, 2025

@scotttrinh thanks, sorry was losing my mind because i don't understand why that assertion wasn't true . i know it's a compile time check but tried it in my env:

Screenshot 2025-05-13 at 3 55 29 PM

Copy link
Collaborator

@scotttrinh scotttrinh left a comment

Choose a reason for hiding this comment

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

I feel like we've been through a battle together @clarkg , thanks for sticking with us through that!

@scotttrinh scotttrinh merged commit 3aefb16 into geldata:master May 14, 2025
9 checks passed
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.

2 participants