Skip to content

revert(formula): remove target.version - #187

Merged
luoliwoshang merged 1 commit into
mainfrom
revert-target-version
Sep 3, 2026
Merged

revert(formula): remove target.version#187
luoliwoshang merged 1 commit into
mainfrom
revert-target-version

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

This reverts the Formula-facing target.version API introduced by #178.

The implementation includes:

  • remove the selected version field and target.version getter from ModuleF
  • restore matrix-only target injection while keeping target.require and target.options unchanged
  • remove the dedicated version-injection test and Formula fixtures
  • verify the rollback with go test -ldflags=-checklinkname=0 ./...

This keeps version-dependent Formula behavior represented by explicit fromVer boundaries instead of hidden branches on raw VCS refs. Closes #186.

@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: revert target.version auto-property

Clean, coherent revert. The target.version / targetVersion / formulaTarget / .Version() surface is removed completely, with the associated test and testdata dropped and no dangling references left in code or docs.

Verified across the four review dimensions:

  • Correctness / dead code: No remaining references to any removed symbol. The version param still threaded through at() is legitimate (used by findMaxFromVer for version resolution) and correctly no longer passed to injectMatrix.
  • Documentation: No stale mentions of target.version in README/docs/.gox files; remaining .Version hits are the unrelated module.Version struct.
  • Security & performance: No implications — pure removal that doesn't touch caching/locking/cloning hot paths.

Two minor (non-blocking) polish notes inline.

Comment thread formula/classfile.go
// In formula DSL, target.require["xxx"] maps to Target().Require()["xxx"].
func (t formulaTarget) Require() map[string][]string {
return t.m.Require
func (m matrixTarget) Require() map[string][]string {

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.

Minor: the renamed matrixTarget methods use receiver name m, which collides with the *Matrix receiver m used elsewhere in this file and yields the awkward m.m.Require / m.m.Options (field is also named m). The pre-revert formulaTarget used t. Consider renaming the receiver back to t for readability and consistency with the surrounding Matrix receivers. Stylistic only — behavior is correct.

Comment thread formula/classfile.go
// It is the original version or ref selected by LLAR.
func (t formulaTarget) Version() string {
return t.version
func (p *ModuleF) Target() matrixTarget {

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.

Minor: Target() is exported and part of the DSL surface but has no doc comment, while its sibling accessors Require() and Options() each carry a comment referencing their target.* auto-property. A one-line doc comment here would keep the trio consistent now that the returned type was renamed.

@MeteorsLiu
MeteorsLiu force-pushed the revert-target-version branch from 7868d84 to b63d82b Compare September 3, 2026 02:51

@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 107a2d0 into main Sep 3, 2026
4 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.

Proposal: Remove target.version from Formula

2 participants