317: MSSQL spike: scoring runner for both candidates #339
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!339
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-317/mssql-spike-scoring-runner-for-both-candidates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
317: MSSQL spike: scoring runner for both candidates
Implements 317.
Generated in 1m 18s.
Review findings
Now edit run.mjs.The sed ran in the wrong directory context (my heredoc consumed stdin). Retry.Odd sed (likely BSD-like alias); use a different approach.# Review Findings — 317
Summary
I fixed the three Medium findings.
run.mjsnow treats onlyERR_MODULE_NOT_FOUNDandERR_PACKAGE_PATH_NOT_EXPORTEDas load failures. Other errors are labelled "error: …".scoreGuardthrows on an empty reject or accept corpus. I added tests formain, the--jsonoutput, a missing-module candidate, a candidate with novalidateSqlexport, an unexpected load error, and empty corpora.node --test run.test.mjspasses 10/10, and a manualnode extensions/mssql/spike/run.mjsstill runs and prints STOP. The repo has no build or lint script. I left the three Low findings unresolved as optional polish for a spike.Critical
High
Medium
scoreCandidatecatches every error fromload()andscoreGuardand reports it as "not viable". A bug in the guard or in scoring, as opposed to a missing dependency, therefore looks like an unavailable candidate. Suggested fix: only treatERR_MODULE_NOT_FOUNDandERR_PACKAGE_PATH_NOT_EXPORTEDas load failures. Score outside the try block, or label other errors "error" with the message.scoreGuarddoesn't check that the corpora are non-empty. An empty reject corpus gives zero false accepts and a vacuous pass. Suggested fix: throw ifrejectCases.length === 0oracceptCases.length === 0.main, the--jsonoutput, the load-failure path (loadError), orformatResult.mainalready accepts an injectablecandidatesargument, which makes this easy to test. Suggested fix: add tests that callmain(["--json"], fakeCandidates)with a spiedconsole.log. Cover a missing-module candidate and a candidate with novalidateSqlexport, and assert that the "not viable" line and the JSON shape are right.Low
isAcceptedtreats a guard that throws as not accepted. That is correct for reject cases (fail closed). On accept cases, though, a crash is indistinguishable from a deliberate rejection in the report. Suggested fix: record thrown cases separately, for exampleerrored: [labels].--strictflag that exits 1 on STOP.import.meta.urlmain-module check is fine, butpathToFileURLdoesn't resolve symlinks. Running the script through a symlinked path would silently do nothing. Suggested fix: comparefs.realpathSyncresults, or accept this as a known limitation of a spike.