project-kb icon indicating copy to clipboard operation
project-kb copied to clipboard

when mapping version to tag, ask user confirmation when mapping is low-confidence

Open copernico opened this issue 4 years ago • 3 comments

I guess we should change the "else" here: https://github.com/SAP/project-kb/blob/prospector-assuremoss/prospector/git/version_to_tag.py#L124 to produce a BIG warning instead of trying hard to offer some matching -- the user should provide the mapping manually in this case

copernico avatar Nov 08 '21 09:11 copernico

If I remove the current best effort mapping from the else branch we lose some functionality captured by a test: FAILED git/test_git.py::test_get_tag_for_version

amilankovich-slab avatar Nov 15 '21 08:11 amilankovich-slab

If I remove the current best effort mapping from the else branch we lose some functionality captured by a test: FAILED git/test_git.py::test_get_tag_for_version

I can make the test pass by running pytest with the -s flag and supplying the good solution (STRUTS_2_3_9) in interactive mode.

amilankovich-slab avatar Nov 15 '21 08:11 amilankovich-slab

We agreed to separate the code implementing the interactive part from the code computing the values (perfect matches, suggestions). Sample (pseudo-)code follows:

class ResultsWithSuggestions:
    List with "matches" (exact or high-confidence results)
    List with suggestions (potantially good suggestions)   


def compute(..., ..) -> ResultsWithSuggestions:
    return ...


def compute_2(..., ..) -> ResultsWithSuggestions:
    return ...


result = compute(a,b,c)
if not result.has_matches():
    return interactively_ask_user(result.get_suggestions())
else:
    return result.get_matches()

copernico avatar Nov 15 '21 09:11 copernico