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

fix: Add missing delta payload #2306

Merged

Conversation

fredcarle
Copy link
Collaborator

Relevant issue(s)

Resolves #2299

Description

This PR fixes a regression bug and adds integration tests to ensure that future changes don't break the expected query results

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

make test and manual queries

Specify the platform(s) on which this was tested:

  • MacOS

@fredcarle fredcarle added bug Something isn't working area/planner Related to the planner system labels Feb 12, 2024
@fredcarle fredcarle added this to the DefraDB v0.10 milestone Feb 12, 2024
@fredcarle fredcarle requested a review from a team February 12, 2024 16:09
@fredcarle fredcarle self-assigned this Feb 12, 2024
Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (398ffbc) 74.05% compared to head (2479f2e) 74.16%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2306      +/-   ##
===========================================
+ Coverage    74.05%   74.16%   +0.12%     
===========================================
  Files          259      259              
  Lines        25808    25808              
===========================================
+ Hits         19110    19140      +30     
+ Misses        5358     5334      -24     
+ Partials      1340     1334       -6     
Flag Coverage Δ
all-tests 74.16% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
planner/commit.go 76.00% <100.00%> (ø)

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 398ffbc...2479f2e. Read the comment docs.

Copy link
Member

@nasdf nasdf left a comment

Choose a reason for hiding this comment

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

Fix looks good! Just one question about encoding.

{
"cid": "bafybeiddpjl27ulw2yo4ohup6gr2wob3pwagqw2rbeaxxodv4ljelnu7ve",
"collectionID": int64(1),
"delta": []uint8([]byte{0x16}),
Copy link
Member

Choose a reason for hiding this comment

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

question: should this be a base64 encoding instead?

Copy link
Collaborator Author

@fredcarle fredcarle Feb 12, 2024

Choose a reason for hiding this comment

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

yes. Trying to figure something out for this. It is base64 when using CLI and HTTP clients but not when using the go client.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So it's base64 with CLI and HTTP clients because that's how json.Marshal will convert []uint8 to string representation. I've added support for []uint8 result assertion when using the CLI and HTTP clients.

@@ -47,47 +47,47 @@ var (
Name: request.CommitTypeName,
Description: commitDescription,
Fields: gql.Fields{
"height": &gql.Field{
request.HeightFieldName: &gql.Field{
Copy link
Member

Choose a reason for hiding this comment

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

praise: this is much cleaner

Copy link
Contributor

@AndrewSisley AndrewSisley Feb 12, 2024

Choose a reason for hiding this comment

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

It looks nicer, but now we have lost protection against these changing. I have mixed feelings about this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

For reference, I was being slow and assumed this was a test :) This change is very welcome 😁

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

Looks good to me, and thank you for the tests :)

I am a bit uncomfortable about the use of production constants in the expected test results, but not uncomfortable enough to block it :)

@fredcarle fredcarle force-pushed the fredcarle/fix/i2299-delta-field branch from 087a404 to cd4cb94 Compare February 12, 2024 18:55
@fredcarle fredcarle force-pushed the fredcarle/fix/i2299-delta-field branch from cd4cb94 to 2479f2e Compare February 12, 2024 19:24
Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

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

Thanks for this fix! LGTM

@fredcarle fredcarle merged commit 31297f8 into sourcenetwork:develop Feb 12, 2024
31 of 32 checks passed
@fredcarle fredcarle deleted the fredcarle/fix/i2299-delta-field branch February 12, 2024 21:49
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
## Relevant issue(s)

Resolves sourcenetwork#2299

## Description

This PR fixes a regression bug and adds integration tests to ensure that
future changes don't break the expected query results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/planner Related to the planner system bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

delta field on commit/version queries returns incorrect result
4 participants