SY-4167: Refactor Go Driver so linting and tests don't need build tags#2383
Open
pjdotson wants to merge 32 commits into
Open
SY-4167: Refactor Go Driver so linting and tests don't need build tags#2383pjdotson wants to merge 32 commits into
pjdotson wants to merge 32 commits into
Conversation
…actor-go-driver-usage-so-linter-and-tests-dont-need
…actor-go-driver-usage-so-linter-and-tests-dont-need
…actor-go-driver-usage-so-linter-and-tests-dont-need
…actor-go-driver-usage-so-linter-and-tests-dont-need
…ver-usage-so-linter-and-tests-dont-need # Conflicts: # core/pkg/driver/enabled_unix.go # core/pkg/driver/enabled_windows.go # core/pkg/driver/unix.go # core/pkg/driver/windows.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## rc #2383 +/- ##
==========================================
+ Coverage 66.61% 66.74% +0.13%
==========================================
Files 2477 2476 -1
Lines 116923 117419 +496
Branches 8695 8806 +111
==========================================
+ Hits 77885 78377 +492
- Misses 32734 32753 +19
+ Partials 6304 6289 -15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Pull Request
Linear Issue
SY-4167
Description
The embedded driver package (
core/pkg/driver) previously required thedriverbuildtag — and placeholder asset binaries — to lint and test. This forced CI to inject fake
assets/driverfiles before every lint/test run, kept the bulk of the driver lifecyclelogic out of the default build, and meant the subprocess lifecycle was only exercised in
a tag-gated suite.
This refactor removes that requirement:
Config, theDriverstruct,Open/start/close/setupCmd)moves into an untagged
driver.go. Only a singledefaultFSvalue remainsbuild-tag-specific:
nilindisabled.go(!driver) and the embedded filesystem inenabled.go(driver).Config.BinaryPath stringis replaced with an injectableConfig.FS fs.FS. Thebinary is read from that filesystem and extracted before exec; when
FSisnil(non-
driverbuild),Openreturns a no-opDriver. Behavior is preserved acrossboth builds.
//go:build drivertag. They build a mock driver and inject it viaos.DirFS, so the full subprocess lifecycle now runs in the defaultgo test/ginkgopass. The suite references the package's owndriverNameconstant (viaexport_test.go) instead of re-deriving the binary name fromruntime.GOOS..golangci.yamldrops theconsole/driverbuild-tags; thereusable
test.go.yamlworkflow drops theginkgo_flagsandprepare_assetsinputs;test.core.yamlstops passing--tags driver; and thesetup_assets.shplaceholder-binary script is deleted.
Release builds are unchanged — still built with
-tags driver, with the real binarydropped into the gitignored
core/pkg/driver/assets/.Basic Readiness
Greptile Summary
This PR refactors the Go driver package (
core/pkg/driver) so that tests and linting work without thedriverbuild tag. All runtime lifecycle logic moves into an untaggeddriver.go; only thedefaultFSvariable varies between build-tagged files (nilindisabled.go, embedded FS in theenabled_*.gopair). The oldBinaryPathtesting escape-hatch is replaced with an injectableConfig.FS fs.FS, which tests satisfy by building a mock binary and injecting it viaos.DirFS.unix.go/windows.godrop thedriver &&constraint sodriverNameandconfigureSysProcAttrare always available;enabled_unix.go/enabled_windows.gointroduce the newembed-only files gated behinddriver && !windows/driver && windows..golangci.yamldropsconsole/driverbuild-tags from therunsection;test.go.yamlremoves theginkgo_flagsandprepare_assetsworkflow inputs;setup_assets.shis deleted entirely.FSis nil (disabled build) orEnabledis false,Openreturns aDriverwhoseCloseis a no-op — behaviorally identical to the old stub type.Confidence Score: 5/5
Safe to merge. The refactor is a straight code movement — no driver lifecycle logic changed, only where the logic lives in the source tree.
All lifecycle code is faithfully ported from the build-tagged enabled.go into the untagged driver.go. The enabled() guard replaces the dual-type approach with a nil-FS check, and config merging injects defaultFS as the base before user-supplied overrides. Both paths produce identical observable behaviour to before, and the test suite now exercises the full subprocess lifecycle without build tags.
No files require special attention.
Important Files Changed
Reviews (4): Last reviewed commit: "Remove unneeded context.Context" | Re-trigger Greptile