open-sauced / pizza

This is an engine that sources git commits and turns them to insights
Apache License 2.0
32 stars 13 forks source link

Bug: ignore empty repos #61

Open jpmcb opened 11 months ago

jpmcb commented 11 months ago

Describe the bug

The pizza service should ignore repos that have empty git repos. For example, for repos like: https://github.com/tamagui/sponsors (which indeed is empty from a public perspective)

This repo throws the following:

{"level":"error","ts":1700591125.6592977,"caller":"server/server.go:103","msg":"Error validating repo URL https://github.com/tamagui/sponsors: could not list remote repository: remote repository is empty","stacktrace":"github.com/open-sauced/pizza/oven/pkg/server.PizzaOvenServer.handleRequest\n\t/app/pkg/server/server.go:103\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2136\nnet/http.(*ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2514\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2938\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:2009"}

This gets surfaced in the API as a 400 error

/Users/jpmcb/workspace/opensauced/api.opensauced.pizza/node_modules/axios/lib/core/settle.js:19
    reject(new AxiosError(
           ^
AxiosError: Request failed with status code 400
    at settle (/Users/jpmcb/workspace/opensauced/api.opensauced.pizza/node_modules/axios/lib/core/settle.js:19:12)
    at IncomingMessage.handleStreamEnd (/Users/jpmcb/workspace/opensauced/api.opensauced.pizza/node_modules/axios/lib/adapters/http.js:572:11)
    at IncomingMessage.emit (node:events:526:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

Steps to reproduce

  1. Run api / app / pizza service locally
  2. Attempt to add tamagui/sponsors as a repo in an insights page
  3. Notice insights page fail to load

Browsers

No response

Additional context (Is this in dev or production?)

No response

Code of Conduct

Contributing Docs

jpmcb commented 11 months ago

The devil's advocate argument here is that technically an empty GitHub repo (with zero files and no .git folder) is indeed not a valid git repo and this behavior is correct from the pizza-oven perspective.

We'll want to think about how to handle this without blocking the open-sauced API