Add snowflake-next preview emulator type - #464
Conversation
27d3311 to
796e607
Compare
gtsiolis
left a comment
There was a problem hiding this comment.
This wires the snowflake-next preview emulator type end to end — reachable only via --type/config (never the first-run picker), with its port remap and PostgreSQL persistence handled on the start path, plus integration tests and every non-compiler-checked map/slice touch-point updated.
- suggestion(non-blocking): on
internal/emulator/snowflake/snowflake.go/internal/container/start.go— the--persistuid-1000 caveat on Linux native Docker is well documented in code, but has no user-facing signal: when it bites, the user sees only an opaque PostgreSQL "refuses to start" surfacing as a health-check timeout. A note/warning on--persistforsnowflake-nexton Linux pointing at host-directory ownership would save a confusing debugging session. Preview-acceptable to defer. - question(non-blocking): on
cmd/status.go—snowflake-nextmaps tosnowflake.NewClient(), but per the comment you added ininternal/endpoint/target.gothe preview's health payload carries a version and noservicesmap. Doeslstk statusrender correctly against that payload, or could it under-report? I did not verify this against a running preview image (the licensed image wasn't available to me). - praise: thorough TDD — the integration tests pin the port remap, both persistence paths, the first-run picker omission, and the IaC-rejection naming, and every entry the compiler can't catch (
knownImages,emulatorHealthPaths,ContainerPort,SelfValidatesLicense,emulatorDisplayNames, thecmd/status.goclient map,tipsForType) is covered.
Automated review on behalf of @gtsiolis.
Generated by Claude Code
peter-smith-phd
left a comment
There was a problem hiding this comment.
I understand what the change is trying achieve, but could we please have some upfront discussion on how to solve it? (Please forgive me if I missed the Slack message). I want to make sure we have a clean/elegant solution to this, rather than just asking Claude to make a whole ton of changes.
Some important questions I have:
- Are customers actively using the new Snowflake emulator, or is this for internal use only? What's the timeline for making the new Snowflake emulator the default?
- This PR touches 21 files and changes 601 lines of code, which seems excessive given that we're essentially making 3 small configuration changes. When I look at the code changes, I see a lot of places where a list of 3 things becomes a list of 4 things. That implies we should be centralizing those values in a common place, not just repeating the list everywhere.
|
There was a problem hiding this comment.
This adds a snowflake-next preview emulator type, reachable only through --type/config and deliberately never offered by the first-run picker; the plumbing is careful and the genuinely tricky edge cases (uid-1000 state dir, anonymous-volume-per-start leak, remote-payload collapse) are each handled and pinned by a test. I verified CI is green on 5814071 and that discovery is centralized via KnownEmulatorTypes()/KnownImageRepos().
- suggestion(non-blocking): per-type behavior still fans out across many sites —
emulatorDisplayNames,emulatorHealthPaths,ContainerPort,SelfValidatesLicense, thecmd/status.goclient map,tipsForType, andknownImages. Discovery is now centralized, but adding a type remains a set of compiler-unchecked edits in ~7 files (echoing @peter-smith-phd); a follow-up folding per-type config into one table would make the next type a single entry. - thought(non-blocking):
prepareNextStateDirininternal/container/start.gochmods the state dir0777(world-writable) under the managed volume. The rationale is sound (the emulator runs as uid 1000 and lstk cannot chown to a uid it does not own), but on a shared host it exposes the PostgreSQL cluster dir to other local users — worth noting since it is a security-relevant widening, even if acceptable for a dev tool. - thought(non-blocking): a remote preview instance collapses to
EmulatorSnowflakeininternal/endpoint/target.go, solstk status --endpoint-urlreports "Snowflake", not "Snowflake Preview", for a preview instance. It's documented and tested (TestStatusEndpointURLSnowflakePreviewPayload) and only the display name differs — just confirming that display divergence is intended. - praise: the documentation and test coverage of the failure modes is exceptional — the anonymous-volume-per-start leak, the uid-1000 PGDATA initialization failure on native Linux Docker, and the widen-an-existing-dir upgrade path are each explained on the declaration and pinned by a dedicated test.
Automated review on behalf of @gtsiolis.
Generated by Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
… user Co-Authored-By: Claude <noreply@anthropic.com>
…leanup Co-Authored-By: Claude <noreply@anthropic.com>
localstack/snowflake-rs#2245 makes localstack/snowflake-next a container-level drop-in for localstack/snowflake: it binds from GATEWAY_LISTEN, declares /var/lib/localstack as its volume, picks its data dir from LOCALSTACK_PERSISTENCE, and chowns a bind-mounted state dir before dropping privileges. lstk's generic start path already covers all of that, so the per-emulator branches, the Next* constants, and the tests pinning them are redundant. The type stays a plain registry entry. Verified against the published image (revision 994f10d): start answers health on the configured port, --persist survives a container recreation, and volume clear still works. Co-Authored-By: Claude <noreply@anthropic.com>
5814071 to
f891599
Compare
Motivation
lstk only knows the Python Snowflake emulator:
type = "snowflake"meanslocalstack/snowflake. Running the rewritten emulator meant hand-overridingimage/tagand remapping env — a recipe that lived in a Slack thread and that every tester had to rediscover.Solution
Adds
snowflake-nextas a preview emulator type, solstk -t snowflake-nextjust works and records the choice in config like any other type. It is deliberately absent from the interactive first-run picker — a preview is reachable only by asking for it explicitly, so a fresh install's first choice stays a GA product.The type is now a plain registry entry with no per-emulator special-casing. Earlier revisions carried adaptation code — rewriting the listen address onto the gateway port, bind-mounting the image's own
VOLUME, placingPGDATA— because the image diverged from every other emulator. localstack/snowflake-rs#2245 made it a container-level drop-in forlocalstack/snowflake: it binds fromGATEWAY_LISTEN, declares/var/lib/localstackas its volume, and picks its data dir fromLOCALSTACK_PERSISTENCE. lstk's generic start path already covers all three, so that code is gone — which is why this diff is ~250 lines smaller than it was.Found and fixed along the way: the IaC proxies and the emulator list handed to extensions enumerated only the selectable types, so
lstk terraformagainst a running preview reported the misleadingLocalStack AWS Emulator is not running.Verified against the published image (revision
994f10d): start answers health on the configured host port,--persistsurvives a container recreation, andlstk volume clearstill resets state.Docs
User-facing, worth documenting:
snowflake-next, a preview of the next Snowflake emulator. Selected withlstk start --type snowflake-next/lstk -t snowflake-next, ortype = "snowflake-next"inconfig.toml. Displayed as "LocalStack Snowflake Preview Emulator". Default imagelocalstack/snowflake-next:latest.--persistkeeps state across restarts,lstk volume clearresets it,--endpoint-urlcan target a remote instance. No type-specific caveats.image/tag/SNOWFLAKE_LISTEN_ADDR/PGDATAconfig from the preview period is no longer needed — replace it withtype = "snowflake-next". A customimageremains a hard error when switching types.snowflake-nextreached over--endpoint-urlis reported under the GA Snowflake emulator's name; the two are indistinguishable from the health payload.Review
Human review advised — new user-facing emulator type, and it depends on the image contract from localstack/snowflake-rs#2245 holding.
Towards LAV-595
Co-Authored-By: Claude noreply@anthropic.com