Skip to content

fix: single-source core lint rules, derive CLI version, fix README dialect note - #853

Merged
ajitpratap0 merged 2 commits into
mainfrom
fix/release-review-notes
Oct 22, 2026
Merged

ajitpratap0 merged 2 commits into
mainfrom
fix/release-review-notes

Conversation

@ajitpratap0

Copy link
Copy Markdown
Owner

Summary

Three low-severity review notes ahead of v1.16.0.

  1. One definition of the L001-L010 rule set. New rules.CoreRules(cfg rules.CoreConfig) []linter.Rule and rules.DefaultCoreConfig() in pkg/linter/rules (above pkg/linter, so no import cycle with the rule sub-packages). These now build from it: gosqlx lint (createLinter), gosqlx action (builtinRules), the MCP lint_sql tool (newFullLinter), the C binding's gosqlx_lint (newLinter), and the first ten rules of gosqlx.Lint (allRules). The "keep the three in sync" comments are gone.
    • Behaviour is unchanged. CoreConfig covers the settings that differ between call sites: the L003 blank-line limit, the L004 depth and indent size, and the L005 line length. lint, MCP and cbinding use the CLI defaults (1, 4/4, 100, or the caller's max length). gosqlx.Lint uses L005=120. action keeps its own lenient settings (2, 10/4, 120).
    • Violation order follows rule order, and the linter does not sort. CoreRules keeps the existing grouped order (L001-L005, L010, L006, L008, L009, L007). action used numeric order, so it sorts by ID to keep that order.
  2. The CLI version comes from the library. cmd.Version now defaults to gosqlx.Version, and -ldflags -X .../cmd.Version=<tag> can still override it (checked: a plain build prints 1.14.0, and -X ...=9.9.9-test prints 9.9.9-test). The unused Version: "1.14.0" literal in rootCmd is removed. The near-tautological version test is replaced with one that runs --version and checks the output contains gosqlx.Version. release.yml gains a step, right after checkout, that fails when the tag without its leading v differs from const Version in pkg/gosqlx/gosqlx.go.
  3. README dialect note. bigquery and redshift were described as having "keyword recognition and basic parsing only". In fact DialectKeywords returns nil for both, so they use the generic keyword set, and they only have capability-gated grammar (for example BigQuery's QUALIFY, UNNEST in FROM and (struct).field; each was checked with gosqlx validate --dialect bigquery). No other docs or website pages repeated the sentence.

Test Plan

  • task check (fmt, vet, golangci-lint, race tests)
  • task test:cbinding
  • go test ./pkg/mcp/... ./cmd/...
  • New pkg/linter/rules/core_test.go: exactly L001..L010 once each in the documented order, L005 config applied, DefaultCoreConfig values pinned, fresh instances per call
  • Built the CLI with and without -ldflags -X and ran --version
  • Ran the release guard's shell logic locally (v1.14.0 passes, v1.15.0 fails against main's const)

Breaking Changes

None. One new exported API: package github.com/ajitpratap0/GoSQLX/pkg/linter/rules (CoreRules, CoreConfig, DefaultCoreConfig). Unstamped CLI builds now report gosqlx.Version. On main both values are 1.14.0, so nothing visible changes.

Note: this conflicts with #845 in cmd/gosqlx/cmd/root.go. To resolve, keep var Version = gosqlx.Version, drop the rootCmd Version: literal, and bump only gosqlx.Version.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RkzVu3JY9Y6BRWfjesWts9

…alect note

- Add rules.CoreRules(CoreConfig) and rules.DefaultCoreConfig() in
  pkg/linter/rules as the one definition of the L001-L010 rule set. The
  gosqlx lint CLI, gosqlx action, MCP lint_sql, the C binding's
  gosqlx_lint and gosqlx.Lint's first ten rules now build from it. Each
  call site keeps its configuration and violation order (action keeps its
  lenient L003/L004/L005 settings and ID order).
- cmd.Version now defaults to gosqlx.Version (still overridable with
  -ldflags -X); remove the dead Version literal in rootCmd; the version
  test runs `--version`. The release workflow fails when the tag does not
  match the Version const in pkg/gosqlx.
- README: bigquery and redshift use the generic keyword set and only
  capability-gated grammar, not "keyword recognition and basic parsing".

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

vercel Bot commented Oct 22, 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 Preview Oct 22, 2026 11:04am UTC

@github-actions github-actions Bot added documentation Improvements or additions to documentation cli ci-cd python linter labels Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

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


Review of PR #853

I read the diff but did not run the tests (no run tooling was available). I found no blocking issues, and the refactor looks behaviour-preserving.

Lint rule consolidation

  • rules.CoreRules and CoreConfig are clean. Putting them above pkg/linter avoids the import cycle, and each call returns fresh instances.
  • The ordering is handled correctly. action sorts by ID to keep its old order, and gosqlx.Lint keeps the grouped order.
  • allRules() in pkg/gosqlx/lint.go copies DefaultCoreConfig() and then overrides L005 to 120. append(CoreRules(...), ...) is safe because the slice is freshly allocated.
  • Minor: builtinRules sorts with strings.Compare on IDs. That is lexicographic, which is fine for L001–L010 because the IDs are zero-padded. If rules past L099 are ever added there, it would still sort correctly.
  • Minor: CoreRules ignores the L006–L009 settings. That matches the doc comment, but a future call site that needs a different comma style or case rule will have to extend CoreConfig.

CLI version

  • var Version = gosqlx.Version keeps the -ldflags -X override working. -X only overrides string variables initialised with a constant, and gosqlx.Version is a const, so this works.
  • The new test runs --version through the shared rootCmd. It resets the output and args in t.Cleanup, which is good. The rootCmd.Version field is set in init(), so it is already populated when the test runs.
  • The long doc comment above Version in root.go still lists v1.14.0-era features. This is cosmetic only.

Release guard (.github/workflows/release.yml)

  • The sed pattern matches the current line, const Version = "1.14.0" at pkg/gosqlx/gosqlx.go:33. It would silently stop matching if the const were moved into a const (...) block, but the empty-string check turns that into a loud failure, which is the right outcome.
  • github.ref_name goes through env, not direct ${{ }} interpolation in the script. That avoids script injection.
  • The guard will fail any tag pushed before the const is bumped. That is the intent, and it fits the documented release flow where the docs PR merges before tagging. Make sure the release checklist says to bump gosqlx.Version.

Tests

  • core_test.go pins the rule order, the L005 config and the default values, which is good coverage. The CLI, MCP and cbinding call sites are only covered indirectly by their existing tests, and you ran those.

README: the corrected bigquery and redshift wording matches the DialectKeywords behaviour you describe.

Overall this looks good to merge. Resolve the #845 conflict as you described.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

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


Review of PR #853

I read the diff against origin/main but did not run the tests or build. I found no blocking issues. The refactor looks behaviour-preserving.

Lint rule consolidation

  • rules.CoreRules and CoreConfig in pkg/linter/rules/core.go are clean. Placing them above pkg/linter avoids the import cycle, and every call returns fresh instances.
  • Rule order is preserved. gosqlx.Lint keeps the grouped order. action sorts by ID with slices.SortFunc to keep its numeric order. The sort is lexicographic, which is correct for the zero-padded L001–L010 IDs.
  • allRules() in pkg/gosqlx/lint.go overrides L005 to 120 on a copy of the defaults. append onto the freshly allocated slice is safe.
  • Minor: CoreConfig does not cover L006–L009, as the doc comment says. A call site that needs a different comma style or keyword case would have to extend the struct.
  • Minor: actionCoreConfig is a package-level var. It is passed by value, so it cannot be mutated through CoreRules. A function or a comment saying it must not be modified would make that explicit, but this is optional.

CLI version

  • var Version = gosqlx.Version keeps the -ldflags -X override working, because -X can set a string variable initialised from a constant.
  • Dropping the rootCmd Version: literal is fine, since init() assigns rootCmd.Version = Version.
  • The long doc comment above Version in root.go still lists v1.14.0-era features. This is cosmetic.

Release guard (.github/workflows/release.yml)

  • github.ref_name goes through env, which avoids script injection.
  • The sed pattern requires const Version = "..." at the start of a line. If the const moves into a const (...) block, the empty-string check turns the mismatch into a loud failure.
  • The guard fails any tag pushed before gosqlx.Version is bumped. That matches the intent, but the release checklist in CLAUDE.md doesn't mention the bump yet. Adding that step there would help.

Tests

  • core_test.go pins the rule order, the L005 config, the default values and fresh instances per call.
  • The CLI, MCP and cbinding call sites are only covered indirectly by their existing tests, which you ran.

README: the corrected bigquery and redshift wording matches the DialectKeywords behaviour you describe.

Overall this looks good to merge. Resolve the #845 conflict in root.go as described in the PR body.

@ajitpratap0
ajitpratap0 merged commit 59ce1b6 into main Oct 22, 2026
43 checks passed
@ajitpratap0
ajitpratap0 deleted the fix/release-review-notes branch October 22, 2026 11:13
ajitpratap0 pushed a commit that referenced this pull request Oct 22, 2026
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 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>
ajitpratap0 added a commit that referenced this pull request Oct 22, 2026
…ks, Glama sync) (#855)

* docs: v1.16.0 post-tag updates; re-measure parse benchmarks [vercel skip]

- doc.go Version History gains v1.16.0.
- gen-readme-metrics: README metrics block and docs/COMPARISON.md banner now
  track the v1.16.0 tag.
- integrations/gorm and integrations/opentelemetry require v1.16.0.
- lint-sql-in-ci guide and article pin @v1.16.0.
- Parse-stage benchmarks re-measured on Apple M4 (median of 20 runs,
  2026-10-22): SELECT 349 ns, INSERT 406, CTE 644, window 631, complex 1234.
  Same machine and load: v1.16.0 SimpleSelect is 26% faster than v1.15.0
  (345 vs 469 ns, benchstat p=0.000 n=10); the absolute figure is above the
  2026-10-13 318 ns because the machine was under ambient load (~2.8).
  Updated metrics.json, README, llms.txt, website metrics.ts and
  performance_baselines.json current_performance (CI baselines unchanged).

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

* ci(release): dispatch glama-sync after GoReleaser; clarify dialect count [vercel skip]

- GoReleaser publishes the release with GITHUB_TOKEN, so glama-sync.yml's
  `release: published` trigger never fired (it did not run for v1.16.0).
  glama-sync gains a workflow_dispatch `tag` input and release.yml dispatches
  it after GoReleaser (actions: write). The build is pinned to the tag's
  commit; the Glama build image's Go goes from 1.26.1 to 1.26.10.
- llms.txt and CLAUDE.md: 8 dialects with dedicated grammar; --dialect also
  accepts generic, bigquery and redshift (matches README since #853).

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

* chore(bench): publish v1.16.0 competitor benchmark results

From the v1.16.0 tag's Competitor Benchmarks run (39771034670, commit
e9c5db9, generatedAt 2026-10-22T11:43:59Z, GitHub ubuntu-latest, go1.26.9).
results/latest.{json,txt} and website/src/data/competitor-benchmarks.json
(exact copy). gen-readme-metrics --claims (incl. About text) and the website
metrics drift check pass.

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

* fix(ci): define VERSION in the glama-sync commit step

Each step runs in its own shell, so VERSION from the bump step was empty in
the commit message. Found by claude-review on #855.

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

Labels

ci-cd cli documentation Improvements or additions to documentation linter python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant