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

RemoveEdge incorrectly throws error in specific case #1

Open
Smuzzy-waiii opened this issue Oct 15, 2024 · 13 comments
Open

RemoveEdge incorrectly throws error in specific case #1

Smuzzy-waiii opened this issue Oct 15, 2024 · 13 comments
Assignees
Labels
Bounty: 450 bug Something isn't working good first issue Good for newcomers

Comments

@Smuzzy-waiii
Copy link
Contributor

Smuzzy-waiii commented Oct 15, 2024

The RemoveEgde function throws "Key not found" error while trying to remove an edge a->b if there exist no edges with a as their source. This is happening due to the following code:

	item, err := txn.Get([]byte(from))
	if err != nil {
		return err
	}

where we are not checking if the error returned by badger is ErrKeyNotFound as is being done for the AddEdge function


Modify the RemoveEdge function to return (bool, error) instead of just a error where bool signifies whether the Remove actually removed an edge or whether it silently failed because the edge didn't exist.
Have the function return:

  • true, nil on successful removal of an edge that exists
  • false, nil if the edge doesn't exist
  • false, error if there is any error

Note that you will have to check for the edge not existing is 2 places: while getting the edgelist for the src node from badger, and then again in the edgelist before calling delete(dstNodes, to)

You are also required to add a unit test to cover this case

The above change is a breaking change to the RemoveEdge API. Make sure to edit all the calls to RemoveEdge in lib_test.go to reflect that

psst, remember to update the usage guide in the README too 👀

@Smuzzy-waiii Smuzzy-waiii added bug Something isn't working good first issue Good for newcomers labels Oct 15, 2024
@Smuzzy-waiii Smuzzy-waiii changed the title RemoveEdge incorrectly throws error in specific case RemoveEdge incorrectly throws error in specific case Oct 15, 2024
@JP-sDEV
Copy link

JP-sDEV commented Oct 16, 2024

Hi @Smuzzy-waiii, could I be assigned this bug?

@Smuzzy-waiii
Copy link
Contributor Author

@JP-sDEV This repo is being prepped for a university club event called Hacknight where participants get to solve issues on FOSS repo's to get points. You can find out more about hacknight on the ACM PESU ECC instagram here. The event is from 4PM IST on Fri, 18th Oct to 12PM IST on Sat, 19th Oct.

If this issue is still unresolved at the end of the event, I would love to assign it to you

@JP-sDEV
Copy link

JP-sDEV commented Oct 16, 2024

No worries, thanks!

@velukutty2194
Copy link

velukutty2194 commented Oct 18, 2024

could i be assigned?? @Smuzzy-waiii

@Smuzzy-waiii
Copy link
Contributor Author

!assign @velukutty2194

@Smuzzy-waiii
Copy link
Contributor Author

The bot will deassign you in 45mins. If you need more time, show your progress and I can extend the time. Please feel free to text/call me at 8618950413

@bunsamosa-bot
Copy link

bunsamosa-bot bot commented Oct 18, 2024

Hey @Smuzzy-waiii! The timer for the @velukutty2194 to work on the issue has finished, deassign and assign a new contributor or extend the current timer. Contact maintainer leads if inactive @DedLad @polarhive @achyuthcodes30

@Smuzzy-waiii
Copy link
Contributor Author

@velukutty2194 Are you still working on this?

@Smuzzy-waiii
Copy link
Contributor Author

!extend

@Smuzzy-waiii
Copy link
Contributor Author

!deassign

@Smuzzy-waiii
Copy link
Contributor Author

@JP-sDEV Are you still interested in working on this? I can assign you

@JP-sDEV
Copy link

JP-sDEV commented Oct 20, 2024

@Smuzzy-waiii Yes, I am still interested! I will start working on it on Monday, if assigned.

@Smuzzy-waiii
Copy link
Contributor Author

@JP-sDEV Yes np go for it! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bounty: 450 bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants