Skip to content

fix(ixgo): export comparator classfile package - #156

Merged
luoliwoshang merged 2 commits into
xgo-dev:mainfrom
MeteorsLiu:fix/ixgo-cmp-package
Jul 29, 2026
Merged

fix(ixgo): export comparator classfile package#156
luoliwoshang merged 2 commits into
xgo-dev:mainfrom
MeteorsLiu:fix/ixgo-cmp-package

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

No description provided.

@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: fix(ixgo): export comparator classfile package

No blocking issues. The change correctly registers github.com/goplus/llar/cmp with the ixgo interpreter so .gox comparators loaded outside a Go module can resolve their imports from the in-memory registry instead of falling back to on-disk (go/build) resolution, which fails without a module context. The new TestLoadComparator_OutsideModule exercises exactly this path via t.Chdir(t.TempDir()), and I verified the assertion matches the semver-based CJSON_cmp.gox testdata.

Verified:

  • Generated export.go matches the existing formula/export.go pattern and declares all exported symbols of cmp (CmpApp, Gopt_CmpApp_Main, GopPackage). Deps correctly lists only mod/module (the sole import of cmp/cmp.go).
  • pkgs.go blank import is alphabetized within the llar group; //go:generate directive placed beside the sibling formula directive.
  • go build ./internal/ixgo/... succeeds. filepath.Abs(...) is captured before t.Chdir, so the path resolution is correct.

Not verified: go test ./internal/modules/ could not run to completion in the sandbox due to a pre-existing ixgo link error (math/rand/v2.globalRand) unrelated to this PR.

The inline comments below are minor, optional polish only.

Comment thread internal/modules/comparator_test.go
Comment thread internal/modules/comparator_test.go
Comment thread internal/modules/comparator_test.go
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MeteorsLiu
MeteorsLiu force-pushed the fix/ixgo-cmp-package branch from 5747471 to d5679c4 Compare July 29, 2026 06:23
@MeteorsLiu MeteorsLiu closed this Jul 29, 2026
@MeteorsLiu MeteorsLiu reopened this Jul 29, 2026

@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: fix(ixgo): export comparator classfile package

Non-blocking review. The change is well-scoped and correct: the generated export.go registers github.com/goplus/llar/cmp with the ixgo interpreter and is structurally consistent with the sibling formula/export.go. I built ./internal/ixgo/... and ./cmp/... (passes) and ran go test ./internal/modules/ -run TestLoadComparator (all pass, including the new TestLoadComparator_OutsideModule). No security or performance concerns from this diff — the registration runs once in init(), and the comparator loader is memoized via sync.OnceValues.

The findings below are maintainability/coverage/accuracy nits, not blockers. Note that #2#4 were raised in the prior FennoAI review on this PR and appear to still be unaddressed.

Highest-value finding — new Libpng_cmp.gox is not exercised by any test. The PR's stated point is to validate that the lowercase semver.compare mapping works through ixgo, but no comparator-loading test reads the testdata/kodo-e2e/formulas tree. The real load path (loadOrDefaultComparator globbing *_cmp.gox) is only driven from modules.Load, and the internal/build e2e tests load from internal/build/testdata/formulas (see setupTestStore / testFormulaDir), not the kodo-e2e dir. The kodo-e2e main.go harness and the internal/build/http tests that reference the kodo-e2e root never invoke the comparator path. So this fixture — and the lowercase form specifically — has no CI coverage. Consider adding a unit test that loads it through loadComparatorFS (analogous to TestLoadComparator_WithRealTestData), or folding the lowercase form into an already-exercised comparator.

Minor: in internal/ixgo/pkgs.go the new cmp //go:generate directive is placed after formula, while the blank-import block below is alphabetized (cmp before formula). Cosmetic, but placing cmp before formula in the generate list too keeps the file self-consistent.

Inline comments below cover the remaining points.

Comment thread internal/modules/comparator_test.go
Comment thread internal/modules/comparator_test.go
Comment thread internal/modules/comparator_test.go
Comment thread testdata/kodo-e2e/formulas/pnggroup/libpng/Libpng_cmp.gox

@luoliwoshang luoliwoshang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@luoliwoshang
luoliwoshang merged commit 2b2e0b7 into xgo-dev:main Jul 29, 2026
10 of 12 checks passed
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.

2 participants