Repository navigation
fix(validate): report results, and exit 1 under -strict on a failure - #55
Merged
Merged
Conversation
The bare entries app, build_db and validate were meant for binaries built at the repository root, but they also matched the cmd/build_db and cmd/validate directories. A new file there was ignored, and `git add` on a tracked one warned. Anchoring them with a leading slash keeps the root binaries ignored and the source directories visible.
validate computed a pass or fail for every building but printed none of it: the summary and the failure listing were commented out, and the tool exited 0 whatever the results. It now prints the pass count per country, one line per failing building with its calculated and expected q_h_nd and percentage error (or the pipeline error), and the overall count. Results are ordered by row ID so two runs print the same output. A plain run exits 0. With -strict it exits 1 when any building is outside the tolerance. The default stays 0 because Spain currently fails 23 rows (#47), which would otherwise fail every run. The configuration is now loaded in main instead of at package init, which panicked without DB_PASSWORD and made the package untestable. printTestResult is removed; it was only called from the commented-out block. Closes #51
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #51.
validatenow reports what it measures. A plain run prints the results and exits 0;-strictexits 1 when any building is outside ±2.5%.Output
Against a database seeded from
data/tabula-calculator-lite.xlsxat currentmain:./bin/validate./bin/validate -strictChanges
reportprints the per-table counts, every failing building (or its pipeline error) and the total, and returns the failure count.exitCodereturns 1 only under-strictwith a failure. Results are sorted by row ID, so output is stable between runs.main. It was loaded at package init, which panicked withoutDB_PASSWORDand made the package untestable.printTestResult, which only that block called, are removed.docs/validation.mdanddocs/getting-started.mddocument-strictand the output..gitignoreanchorsapp,build_dbandvalidateto the repository root. Unanchored they matchedcmd/build_db/andcmd/validate/, so the newcmd/validate/main_test.gowas ignored.validatecompares the unrounded pipeline result;POST /api/v1/calculate/{code}rounds to two decimals. That is whyvalidatereports 49 of 72 Spanish rows passing where the API gives 48:ES.ME.TH.01.Gen.ReEx.001.003(reference 4.0) passes unrounded and lands exactly on 2.5% once rounded to 3.90. The validation docs now state this.Checks
TestReport_countsPerTableAndListsFailuresandTestExitCode_nonZeroOnlyWhenStrictAndFailingfailed to build onmain(undefined: report,undefined: exitCode) and pass here.go vet ./...andgo test ./...pass;mkdocs build --strictpasses.