corral
corral copied to clipboard
Corral allows bad locators and doesn't error
I did an add with an incorrect locator and got:
{ "deps": [ { "locator": "github.com/ponylang/peg", "version": "0.1.0" } ], "info": {} }
when I run corral fetch I get:
fetch: fetching from /home/sean/code/ponylang/changelog-tool
fetch: fetching dep: github.com/ponylang/peg @ 0.1.0
No dep bundle for: github.com/ponylang/peg
Which is horribly misleading given that the locator doesn't exist at all.
I propose this is addressed in two parts. Fix the bug of it not indicating the error on fetch. Enhance to validate a locator on addition.
So the problem here is that the way that Corral determines the VCS to use work like this.
There's a primitive called VCSType that has the following to pick a VCS:
primitive VCSForType
"""
This factory returns a VCS instance for any given VCS by name.
"""
fun apply(env: Env, kind: String): VCS val ? =>
match kind
| "git" => GitVCS(env)?
| "hg" => HgVCS
| "bzr" => BzrVCS
| "svn" => SvnVCS
else
NoneVCS
end
So if the VCS is unknown, you get the NoneVCS which NoOps everything. Thus it appearing to "work" in example I gave when opening this.
The match on string comes from vcs on the Deps class:
fun vcs(): String => locator.vcs_suffix.trim(1)
So a locator without a suffix will give you the NoneVCS and NoOps everything.
This seems like a design flaw in how Corral is determining the VCS to use and how the factory works. Reasonably, there should be no NoneVCS outside of perhaps testing. It's existence is a smell.
At this point, I'm adding the "needs discussion" label to this issue. We need to rework how the VCS is determined and that requires some discussion.