Skip to content

campaigns preview panics while resolving repositories #382

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

Closed
evanweible-wf opened this issue Nov 17, 2020 · 2 comments · Fixed by #385
Closed

campaigns preview panics while resolving repositories #382

evanweible-wf opened this issue Nov 17, 2020 · 2 comments · Fixed by #385
Assignees
Labels
bug Something isn't working

Comments

@evanweible-wf
Copy link

evanweible-wf commented Nov 17, 2020

src-cli version: 3.22.0
recommended version by our deployment: 3.20.0

repositoriesMatchingQuery: dart_functional_test_image or dart_unit_test_image

I hit this while trying to preview a campaign spec, although I'm not actually sure if this is a valid query, as I was under the impression that file-contents searches didn't work for campaigns. So maybe that's the issue Read through the most recent docs and see a similar query in the examples, so I guess it is a valid query. Either way, a panic is probably not the expected result.

Output:

✅ Parsing campaign spec
✅ Resolving namespace
✅ Preparing container images  ███████████████████████████████████████████████████████████████████████████████████████████████████████
⠹  Resolving repositories
panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/sourcegraph/src-cli/internal/campaigns.(*Service).resolveRepositorySearch(0xc000209640, 0x1748da0, 0xc0000b7ec0, 0xc0003df080, 0x32, 0xc000210001, 0xc0003ab410, 0xc000529198, 0x100ea8d, 0x1651fa0)
        /home/runner/work/src-cli/src-cli/internal/campaigns/service.go:490 +0x26b
github.com/sourcegraph/src-cli/internal/campaigns.(*Service).ResolveRepositoriesOn(0xc000209640, 0x1748da0, 0xc0000b7ec0, 0xc000529280, 0x147a5e5, 0x8, 0x16b8ac8, 0xc0001ff3e0, 0x1)
        /home/runner/work/src-cli/src-cli/internal/campaigns/service.go:407 +0x192
github.com/sourcegraph/src-cli/internal/campaigns.(*Service).ResolveRepositories(0xc000209640, 0x1748da0, 0xc0000b7ec0, 0xc0003058f0, 0xc0001ff3e0, 0x0, 0x0, 0xc0003ffce0, 0x1)
        /home/runner/work/src-cli/src-cli/internal/campaigns/service.go:373 +0x45b
main.campaignsExecute(0x1748da0, 0xc0000b7ec0, 0xc0000b7e80, 0xc000209640, 0xc00020e180, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/work/src-cli/src-cli/cmd/src/campaigns_common.go:218 +0xdd0
main.init.4.func1(0xc0000b8040, 0x8, 0x8, 0x0, 0x0)
        /home/runner/work/src-cli/src-cli/cmd/src/campaigns_preview.go:49 +0x3f7
main.commander.run(0xc000212fc0, 0x5, 0x8, 0xc000200240, 0x16844bc, 0xd, 0x16a85a5, 0x251, 0xc0000b8030, 0x9, ...)
        /home/runner/work/src-cli/src-cli/cmd/src/cmd.go:94 +0x3aa
main.init.1.func1(0xc0000b8030, 0x9, 0x9, 0x9, 0x0)
        /home/runner/work/src-cli/src-cli/cmd/src/campaigns.go:32 +0x97
main.commander.run(0xc00020e200, 0x10, 0x10, 0xc0000b4120, 0x167c7f2, 0x3, 0x16ab01a, 0x46e, 0xc0000b8010, 0xb, ...)
        /home/runner/work/src-cli/src-cli/cmd/src/cmd.go:94 +0x3aa
main.main()
        /home/runner/work/src-cli/src-cli/cmd/src/main.go:68 +0xf7
@mrnugget mrnugget self-assigned this Nov 17, 2020
@mrnugget mrnugget added the bug Something isn't working label Nov 17, 2020
@mrnugget
Copy link
Contributor

Thanks @evanweible-wf! I'll take a look. Thanks for the stacktrace!

mrnugget added a commit that referenced this issue Nov 17, 2020
This fixes #382 by fixing a regression that was introduced by #361.

When the search queries defined in a campaign spec yielded a repository
match result and file match results in the same repository, in that
order, the code would crash because of an uninitialized map.

The code here fixes it by always initializing the map.

I also added a test that reproduces the behaviour and documents how we
turn multiple search results into a list of repositories.
@mrnugget
Copy link
Contributor

I could reproduce this. Fix is here: #385 As soon as it's merged, I'll cut a new patch release.

mrnugget added a commit that referenced this issue Nov 17, 2020
This fixes #382 by fixing a regression that was introduced by #361.

When the search queries defined in a campaign spec yielded a repository
match result and file match results in the same repository, in that
order, the code would crash because of an uninitialized map.

The code here fixes it by always initializing the map.

I also added a test that reproduces the behaviour and documents how we
turn multiple search results into a list of repositories.
scjohns pushed a commit that referenced this issue Apr 24, 2023
This fixes #382 by fixing a regression that was introduced by #361.

When the search queries defined in a campaign spec yielded a repository
match result and file match results in the same repository, in that
order, the code would crash because of an uninitialized map.

The code here fixes it by always initializing the map.

I also added a test that reproduces the behaviour and documents how we
turn multiple search results into a list of repositories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants