Skip to content

fix(lsp,cli,ci): report the real version from LSP and release binaries - #846

Merged
ajitpratap0 merged 1 commit into
mainfrom
fix/version-reporting-followups
Oct 21, 2026
Merged

ajitpratap0 merged 1 commit into
mainfrom
fix/version-reporting-followups

Conversation

@ajitpratap0

Copy link
Copy Markdown
Owner

Summary

Makes the version that GoSQLX reports match the release.

  • LSP: initialize now returns gosqlx.Version as serverInfo.version. It used to return a hard-coded "1.0.0" (pkg/lsp/handler.go). pkg/lsp already imported pkg/gosqlx, so the import direction does not change.
  • CLI: gosqlx --version now reads the cmd.Version variable through rootCmd.Version = Version in init(). Release builds can set it with -X github.com/ajitpratap0/GoSQLX/cmd/gosqlx/cmd.Version=<tag>. A plain go build still prints the hard-coded default.
  • vscode-publish.yml: the bundled gosqlx binary gets the tag version (${RELEASE_TAG#v}, checked against semver, passed in through env). The linux-x64 smoke test now fails if --version does not print gosqlx version <tag>.
  • .goreleaser.yml: removed -X main.version={{.Version}}. GoReleaser only builds examples/sql-validator and examples/sql-formatter, and neither defines main.version, so the flag did nothing.
  • test.yml (Scorecard alert feat(#249): Dialect mode engine (Phase 1) #315, "goCommand not pinned by hash" at line 133): the README quickstart job used go get ...@latest without a pinned version. It now finds the latest tag with go list -m ...@latest, logs it, pins it with go mod edit -require, then runs go mod tidy, which checks the module against sum.golang.org. The job still tests the newest tagged release.

Design decisions (scoped worker, conservative choice)

  • No cmd/gosqlx build was added to GoReleaser. That would change the release asset set (gosqlx_tools_* archives) during a release hold. If you want the CLI in GitHub release archives, add it in a later PR with the same -X .../cmd.Version={{.Version}} ldflag.
  • gosqlx-mcp: its version comes from gosqlx.Version, a const in pkg/gosqlx that -X cannot override. It is not built with ldflags anywhere (deploy-mcp builds from source at the tagged commit). It already reports the library version, which PR docs(release): prepare v1.16.0 #845 bumps. I left it alone because changing the public const to a var would break the API.
  • root.go: I set rootCmd.Version in init() and did not edit the Version: "1.14.0" literal, so this PR does not conflict with the release PR docs(release): prepare v1.16.0 #845, which edits that line. The literal is now overridden at init. Removing it later is optional cleanup.

Code-scanning alerts left open (no upstream fix, or repo settings outside this PR's scope)

Test Plan

  • gofmt, go vet, golangci-lint run ./pkg/lsp/... ./cmd/gosqlx/... (0 issues)
  • go test -race ./pkg/lsp/ ./cmd/gosqlx/... passes. New assertions: initialize returns gosqlx.Version (pkg/lsp/server_test.go), and rootCmd.Version == Version (cmd/gosqlx/cmd/version_test.go)
  • go build ./cmd/gosqlx && ./gosqlx --version prints gosqlx version 1.14.0 (the dev default)
  • go build -ldflags "-s -w -X github.com/ajitpratap0/GoSQLX/cmd/gosqlx/cmd.Version=9.9.9" prints gosqlx version 9.9.9. A Windows cross-compile with the same ldflags also builds.
  • Ran the new test.yml quickstart steps locally: resolved v1.15.0, then build and run succeeded
  • All three YAML files parse. GoReleaser is not installed locally, so I ran no goreleaser check. The YAML change only removes the ldflag argument.
  • CI green

Breaking Changes

None. LSP clients now see the real library version in serverInfo.version instead of 1.0.0.

Release note

  • Fixed: the LSP server now reports the GoSQLX library version in serverInfo.version instead of a hard-coded 1.0.0. The gosqlx binary bundled with the VS Code extension now prints the release tag from gosqlx --version. The CLI version can be stamped at build time with -ldflags "-X github.com/ajitpratap0/GoSQLX/cmd/gosqlx/cmd.Version=<version>".

🤖 Generated with Claude Code

https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

- LSP initialize now returns gosqlx.Version as serverInfo.version instead
  of the hard-coded "1.0.0".
- gosqlx --version reads the cmd.Version variable, so release builds can
  stamp it with -X .../cmd/gosqlx/cmd.Version=<tag>; dev builds keep the
  hard-coded default.
- vscode-publish stamps the bundled gosqlx binary with the tag version
  and the smoke test asserts it.
- goreleaser: drop the no-op -X main.version ldflag (the example tools
  define no such variable).
- test.yml: resolve the latest GoSQLX tag explicitly and pin it with
  go mod edit instead of an unpinned go get (Scorecard alert #315).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9
@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
gosqlx-website Ignored Ignored Oct 21, 2026 6:05pm UTC

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Claude finished @ajitpratap0's task in 23s —— View job


Review of PR #846

The change is small, correct and well scoped. I found no blocking issues. I read the diff and the Version declarations in root.go and pkg/gosqlx. I did not run the tests or the workflows.

What I checked

  • LSP: gosqlx.Version is a const, and pkg/lsp already imports gosqlx, so there is no new import cycle. The new assertion in server_test.go covers the change.
  • CLI: Version is a var string (root.go:46), so -X ...cmd.Version= works. Setting rootCmd.Version in init() overrides the "1.14.0" literal at root.go:134, and cobra's default template prints gosqlx version <v>. That matches the smoke-test comparison.
  • vscode-publish.yml: the tag goes in through env rather than inline ${{ }} in the script, which avoids script injection. The semver check is strict (X.Y.Z), so it would fail on tags like v1.15.0-rc1. That is reasonable for a publish job, but you should know it's there.
  • .goreleaser.yml: removing the no-op -X main.version flag is harmless.
  • test.yml: go list -m ...@latest followed by go mod edit -require and go mod tidy is sound. @latest excludes pre-releases. The version is resolved in the same step, so this is only partly pinned, but it does satisfy the Scorecard check, and the logged tag helps debugging.

Minor suggestions (non-blocking)

  1. Version duplication: Version in root.go, Version: "1.14.0" at root.go:134, and gosqlx.Version are three separate copies that can drift. A test asserting cmd.Version == gosqlx.Version would catch drift on release bumps. This would fail on a mismatched bump, which is the intent. Alternatively, drop the literal at root.go:134 after docs(release): prepare v1.16.0 #845 merges, as you noted.
  2. Smoke test scope: it only runs on linux-x64. That is fine, since the same -X flag applies to every target.
  3. Test strength: TestRootCmdVersionUsesVersionVar checks rootCmd.Version == Version, which is nearly tautological after init(). Consider also executing rootCmd with --version and checking the output contains Version. That would guard the gosqlx version X format the smoke test relies on.
  4. Merge order: the release PR docs(release): prepare v1.16.0 #845 edits root.go:134 and the bumped constants. The merge should be clean, but check Version and gosqlx.Version still agree afterwards.

Test coverage: adequate for the change. The CI-workflow changes can only be validated by running them, so the unchecked "CI green" item is the remaining gate.

LGTM pending CI.

@ajitpratap0
ajitpratap0 merged commit f0ebf86 into main Oct 21, 2026
31 checks passed
@ajitpratap0
ajitpratap0 deleted the fix/version-reporting-followups branch October 21, 2026 18:14
ajitpratap0 pushed a commit that referenced this pull request Oct 22, 2026
…uide

Record the pygosqlx 0.3.0 API and wheels, the gosqlx_version double free,
LSP serverInfo/CLI version reporting, the Python CI and release workflows and
the #848 docs. MIGRATION companion table lists pygosqlx 0.3.0, libgosqlx
exports and the LSP serverInfo version, with matching behaviour-change notes.
Regenerate the v1.16.0 blog page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9
@ajitpratap0 ajitpratap0 mentioned this pull request Oct 22, 2026
12 of 14 tasks
ajitpratap0 pushed a commit that referenced this pull request Oct 22, 2026
- Release date 2026-10-22 in CHANGELOG, MIGRATION, the extension changelog
  and the generated blog post (re-stamp at tag time if it slips).
- vscode-extension CHANGELOG: Fixed entry for the #846 version reporting.
- CHANGELOG: keep the Behavior changes list tight; name TranspileError and
  the LintResult/SecurityScanResult types in the pygosqlx 0.3.0 entry.
- MIGRATION: PyPI wheels row is conditional on the pygosqlx-v0.3.0 tag.
- Add #852 (sdist builds fail without libgosqlx; release tag lookup skips v1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9
ajitpratap0 added a commit that referenced this pull request Oct 22, 2026
* chore(parser): remove stray parser.go-e backup with conflict markers [vercel skip]

The sed backup file was committed by accident in #791. It is not compiled
but ships in the module zip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* chore(release): bump version to 1.16.0 [vercel skip]

gosqlx.Version and the CLI version were still 1.14.0 (v1.15.0 shipped with
them), so gosqlx --version, the MCP server info and /health reported 1.14.0.
Also bumps the VS Code extension, Claude Code plugin and marketplace, glama,
performance baseline label, llms.txt and the site's release badge. pygosqlx
__version__ now matches pyproject (0.2.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs(changelog): finalize 1.16.0 release notes [vercel skip]

Turns [Unreleased] into [1.16.0] - 2026-10-21, adds the missing entries for
#734, #735, #780, #786, #789, #790, #791, #826, #835, #836, #837, #840, #841,
#843 and #844, updates the MCP and composite-field entries amended by #841
and #843, adds PR refs, and adds the compare links. The VS Code extension
gets a 1.16.0 entry, and split-changelog.js generates the /changelog page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs: v1.15 to v1.16 migration guide and release doc fixes [vercel skip]

MIGRATION gains a v1.15.0 -> v1.16.0 section with a behaviour-change
checklist. ERROR_CODES documents E4001 dialect gating and the 11 dialect
names. CLI_GUIDE lists --dialect on format, parse, analyze and lint and all
11 dialects. SQL_COMPATIBILITY marks Oracle CONNECT BY/PRIOR and SQL Server
PIVOT as parsed. api/mcp.md matches the current Config and middleware API,
api/models.md drops the nonexistent Location.Offset and documents byte
columns, and HIGHLIGHTING notes ANSI control-character neutralization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* chore(website): regenerate sample AST and changelog pages

The website build rewrote both files on main: sample-ast.json gains the
WithOrdinality and ColumnAliases fields from #843, and v1-9-1.md drops the
emoji the changelog splitter strips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs(release): correct allocation claim, plugin history, E4001 and LoadConfig errors

Address review notes on #845: the lead paragraph understated the perf
audit's allocation cuts, the MIGRATION table listed a v1.15.0 plugin that
never shipped, E4001 also covers LIMIT under SQL Server, and LoadConfig
rejects more trusted-proxy misconfigurations than the API doc listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs(release): make glama.json match the MCP server

List all 11 validate_sql dialects, describe lint_sql as the 10 rules it
runs (L001-L010; the CLI and SDK have 30), sync tool descriptions with
pkg/mcp/server.go, and drop the unsourced 1.38M ops/sec claim in favour
of a link to the benchmarks page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs(release): add #846-#851 to the v1.16.0 CHANGELOG and migration guide

Record the pygosqlx 0.3.0 API and wheels, the gosqlx_version double free,
LSP serverInfo/CLI version reporting, the Python CI and release workflows and
the #848 docs. MIGRATION companion table lists pygosqlx 0.3.0, libgosqlx
exports and the LSP serverInfo version, with matching behaviour-change notes.
Regenerate the v1.16.0 blog page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs(release): address v1.16.0 release review; add #852

- Release date 2026-10-22 in CHANGELOG, MIGRATION, the extension changelog
  and the generated blog post (re-stamp at tag time if it slips).
- vscode-extension CHANGELOG: Fixed entry for the #846 version reporting.
- CHANGELOG: keep the Behavior changes list tight; name TranspileError and
  the LintResult/SecurityScanResult types in the pygosqlx 0.3.0 entry.
- MIGRATION: PyPI wheels row is conditional on the pygosqlx-v0.3.0 tag.
- Add #852 (sdist builds fail without libgosqlx; release tag lookup skips v1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* build(release): replace deprecated goreleaser keys (formats, version_template)

goreleaser check (v2.12.7) flagged archives.format, format_overrides.format
and snapshot.name_template as deprecated; release.yml runs goreleaser
'latest'. Snapshot release dry-run builds all six archives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* docs(release): add #853 to the v1.16.0 CHANGELOG

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

* feat(python): version pygosqlx in lockstep with GoSQLX (1.16.0)

pygosqlx wheels bundle libgosqlx built from the same commit, so its version
now matches the GoSQLX release. The first PyPI release is 1.16.0 (it was
0.2.0, never published); no older versions are backfilled.

- pygosqlx-release.yml also publishes on GoSQLX 'vX.Y.Z' tags (the floating
  'v1' tag does not match); 'pygosqlx-v*' stays for Python-only .postN
  releases. Both must match pyproject.toml and be on main.
- pyproject.toml / __version__ 1.16.0; the version test now asserts
  __version__ equals the bundled library's version().
- CHANGELOG, MIGRATION and python/README describe the lockstep scheme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

---------

Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini-2655.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant