Skip to content

test(llard): cover comparator formula loading#157

Draft
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:test/llard-binary-e2e
Draft

test(llard): cover comparator formula loading#157
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:test/llard-binary-e2e

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

No description provided.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: test(llard): cover comparator formula loading

The change adds a single e2e test-data comparator formula (testdata/kodo-e2e/formulas/pnggroup/libpng/Libpng_cmp.gox). I verified it loads and executes correctly: XGo resolves the lowercase semver.compare to the exported semver.Compare (golang.org/x/mod/semver) via cl/expr.go pkgRef(), and the formula root is the one consumed by the kodo/http e2e harnesses, so the file is actually exercised. No security, performance, or correctness (build/load) issues found.

One inline note below on the misleading comment and minor style inconsistency with the two existing sibling comparator files. Non-blocking.

compareVer (a, b) => {
// Prefer released versions over libpng's non-semver beta tags. For example,
// v1.6.58 is valid semver while v1.7.0beta89 is not.
return semver.compare(a.Version, b.Version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment overstates the behavior + naming inconsistent with sibling comparators.

  1. The comment says this "prefer[s] released versions over libpng's non-semver beta tags," but the body just delegates to semver.Compare(a.Version, b.Version) — there is no beta-handling logic here. The "preference" is an incidental side effect of golang.org/x/mod/semver: an invalid semver string canonicalizes to "" and sorts below any valid version. Note v1.7.0beta89 is invalid semver (a prerelease needs a hyphen, v1.7.0-beta89), so all such non-canonical tags collapse to a single "equal, lowest" bucket — they can't be ordered relative to each other, and a newer v1.7.0beta89 sorts below an older released v1.6.58. Consider rewording to describe the actual mechanism (delegates to semver.Compare; non-canonical tags are treated as invalid and sort lowest) rather than implying deliberate release-preference logic.

  2. semver.compare (lowercase) is functionally valid — XGo resolves it to the exported semver.Compare — but both sibling comparator files use the canonical semver.Compare (internal/build/testdata/pnggroup/libpng/libpng_cmp.gox:2, internal/modules/testdata/DaveGamble/cJSON/CJSON_cmp.gox:2). Prefer semver.Compare for consistency. Those files also use 4-space indentation while this one uses tabs.

@MeteorsLiu
MeteorsLiu marked this pull request as draft July 24, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant