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

FOREIGN KEY constraint failed on Github [workaround available] #294

Open
baby-gnu opened this issue Aug 28, 2020 · 6 comments
Open

FOREIGN KEY constraint failed on Github [workaround available] #294

baby-gnu opened this issue Aug 28, 2020 · 6 comments
Labels
area: database sqlite, emacsql ... bug Something isn't working

Comments

@baby-gnu
Copy link

Hello.

I'm happily using forge since several months and found an issue today with one repository:

Pulling saltstack-formulas/openssh-formula...done
Storing saltstack-formulas/openssh-formula...
error in process filter: peculiar error: "FOREIGN KEY constraint failed" [2 times]

It's working fine with other repositories like systemd-formula.

Here are few repositories wit the same error:

@tarsius
Copy link
Member

tarsius commented Aug 29, 2020

The problem appears to be data corruption on Github's side. There appear to be two labels named bug even though bug appears to be the primary key (or at least some sort of "unique" filter is used on that column). The issue 176 has one label with the id MDU6TGFiZWwxNjA2NzQzMTU2 and name bug, but that label is not included in the list of "all" labels.

(ghub--graphql-vacuum
 '(query
   (repository
    [(owner $owner String!)
     (name  $name  String!)]
    (issue [(number 176)]
           (labels [(:edges t)
                    (:singular label id)]
                   id
                   name))
    ;; We cannot get information about the label by the id
    ;; MDU6TGFiZWwxNjA2NzQzMTU2 because the API expects the
    ;; name instead of the id. When we use its name "bug", then
    ;; we get information about another label by the same name.
    (label ;; [(id "MDU6TGFiZWwxNjA2NzQzMTU2")]
           [(name "bug")]
           id
           name)
    ;; This should but does not include the label with the
    ;; id MDU6TGFiZWwxNjA2NzQzMTU2.
    (labels [(:edges t)
             (:singular label id)]
            id
            name)))
 '((owner . "saltstack-formulas")
   (name  . "openssh-formula"))
 (lambda (data) (pp-display-expression data "*Pp*")))
(data
 (repository
  (issue
   (labels
    ((id . "MDU6TGFiZWwxNjA2NzQzMTU2")
     (name . "bug"))))
  (label
   (id . "MDU6TGFiZWw0MzI0NTg3MQ==")
   (name . "bug"))
  (labels
   ((id . "MDU6TGFiZWw0MzI0NTg3MQ==")
    (name . "bug"))
   ((id . "MDU6TGFiZWw0MzI0NTg3Mg==")
    (name . "duplicate"))
   ((id . "MDU6TGFiZWw0MzI0NTg3Mw==")
    (name . "enhancement"))
   ((id . "MDU6TGFiZWw0MzI0NTg3NA==")
    (name . "invalid"))
   ((id . "MDU6TGFiZWw0MzI0NTg3NQ==")
    (name . "question"))
   ((id . "MDU6TGFiZWw0MzI0NTg3Ng==")
    (name . "wontfix"))
   ((id . "MDU6TGFiZWwxMjMwMzg2OTE4")
    (name . "bump:major"))
   ((id . "MDU6TGFiZWwxMjMwMzg3MzA0")
    (name . "bump:minor"))
   ((id . "MDU6TGFiZWwxMjMwMzg3NjEx")
    (name . "bump:patch"))
   ((id . "MDU6TGFiZWwxNTUzNDUwMTU2")
    (name . "released"))
   ((id . "MDU6TGFiZWwyMDkwNzA1Mjk3")
    (name . "dependencies")))))

There isn't really anything we can to but to ask Github to fix the corrupted data.

@baby-gnu
Copy link
Author

Thanks a lot for the debug @tarsius.

I found that the issue saltstack-formulas/openssh-formula#176 label bug as an URL pointing to another repository https://github.com/saltstack-formulas/.github/labels/bug. I will see with the team if someone understand what's happening.

Thanks.

@baby-gnu
Copy link
Author

I found that the issue saltstack-formulas/openssh-formula#176 label bug as an URL pointing to another repository https://github.com/saltstack-formulas/.github/labels/bug. I will see with the team if someone understand what's happening.

In Github, you can group all your common labels under a .github repository like the saltstack-formulas community did but each repository can have it's own labels even with conflicting names.

As an example for openssh-formula:

Can forge take this into account?

Regards.

@tarsius
Copy link
Member

tarsius commented Aug 30, 2020

Can forge take this into account?

Well of course it will have to.

On the other hand this sounds like the Github developers didn't fully think this through and should fix this by including the inherited labels in the list of a repository's labels. Edit: i.e. it should be a list of labels that "can be used in this repository".

@tarsius tarsius added the bug Something isn't working label Aug 30, 2020
@tarsius
Copy link
Member

tarsius commented Aug 30, 2020

Dealing with this is likely to have far reaching consequences and I likely won't find the time to do anything about it any time soon. For now I have added a variable to opt out of using labels.

git config --local forge.kludge-for-issue-294 true

tarsius added a commit that referenced this issue Aug 30, 2020
@baby-gnu
Copy link
Author

Thanks, I did an update of forge and add the git config and I'm not blocked anymore.

@tarsius tarsius changed the title forge-pull error FOREIGN KEY constraint failed FOREIGN KEY constraint failed on Github [workaround available] Apr 25, 2022
@tarsius tarsius added the area: database sqlite, emacsql ... label Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: database sqlite, emacsql ... bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants