cli: replace lua-var codegen with //go:embed#1301
Open
bigbes wants to merge 6 commits into
Open
Conversation
CreateDataCollector is rewritten on top of NewStorageConnection + NewRemoteStorage so that callers no longer need to know about etcd/TCS client primitives. Integration tests are updated to drop the removed YamlCollectorDecorator wrapper and to take a pkgstorage.Storage instead of a raw etcd client. Part of TNTP-7390
These files implemented the in-tree ClusterConfig hierarchy, the Collector/CollectorFactory layer, and the YAML decorator that consumers have all moved off of. Closes TNTP-7390
Collapse the twin DataCollectorFactory and DataPublisherFactory into a
single Factory type. RawStorage already implements both DataCollector and
DataPublisher, so the two factories were mechanically duplicating each
other; their only real difference was which integrity options
(verifiers vs signer/verifiers) the caller wired up.
Along the way drop a handful of redundant shims now subsumed by the
unified factory and RawStorage:
- CSConnection / ConnectCStorage: a duplicate codec wrapper around
RawStorage. The two failover callers now build a RawStorage
directly via NewStorage with an empty objectLocation.
- IRawStorage: declared but never used as a type.
- CreateDataCollector: a three-line wiring helper with a single
caller; inlined.
- NewConfigStorage: a one-line default-argument helper folded into
Factory.NewRemoteStorage.
Rename FileDataPublisher -> FilePublisher for symmetry with
FileCollector. Helpers in cli/cmd that constructed the two factories
are consolidated into createCollectorFactory /
createPublisherFactory / createCollectorAndPublisherFactories. The
cli/cluster/cmd nil-checking createPublisherAndCollector splits into
openRemoteCollector (show) and openCollectorAndPublisher (publish).
Part of TNTP-7390
Drop redundant indirection across lib/cluster and lib/integrity and wire the cleaned-up API through cli/cmd: - Merge datacollector.go, datapublisher.go, errors.go into types.go; remove unused CollectEmptyError and errWrongRevision. - Inline defaultFileReadFunc and the newFileCollector wrapper. - Collapse RawStorage's collectByKey/publishByKey/collectByRange/ publishByRange into Get/Put/Collect/Publish; inline applyIntegrityBuilderOptions into NewStorage. - Wire optional cleanup into RawStorage.Close via SetCleanup so callers don't need a wrapper; drop failoverStorage. - Expose NewCollectorFactory/NewPublisherFactory in cli/cluster as a single source of truth, inline the cli/cmd/common.go delegation wrappers at the 13 call sites in cli/cmd, and wrap pass-through errors crossing the cli/cluster boundary. - Merge dummy_repository.go into lib/integrity/integrity.go; drop unused AddHash/Add stubs; shrink redundant flag-registrar tests; wrap os.Open's error in dummyRepository.Read with the path. - Annotate three RawStorage internal pass-throughs with //nolint:wrapcheck — the callee already wraps with the storage type. Part of TNTP-7390
Lua scripts were serialized into *_gen.go files by a custom jennifer-based generator that ran on every build. Replace it with //go:embed declarations in dedicated lua_embed.go files in each package — cli/running, cli/connector, cli/checkpoint — and drop the generateLuaCodeVar pass from cli/codegen/generate_code.go. While here, remove cli/connector/lua/call_func_template.lua and its companion callFuncTmpl var — dead since the cartridge-cli removal. The filemode generator stays (embed.FS strips unix mode bits, so the side-channel map is still necessary for the create-app templates).
The filemode codegen pipeline existed to record per-file Unix mode bits that embed.FS strips. In practice every entry across all four built-in templates was 0o644, so the generator, the four gitignored *_gen.go maps, and the side-channel lookup were storing a single constant. Drop the whole subsystem: - Delete cli/codegen/generate_code.go and the cli/codegen/ directory. - Delete cli/create/builtin_templates/static/ (4 gitignored gen files plus the .gitkeep — the package only existed to hold the generated maps). - Drop builtin_templates.FileModes; copyEmbedFs no longer takes a fileModes map and hard-codes 0o755 for directories, 0o644 for files. Drop the getFileMode helper. - Drop GenerateGoCode and its mg.Deps(...) hooks from magefile.go; nothing remains to generate. - Drop **/*_gen.go from .gitignore — no generated files to ignore. Update the copy_app_template test to match the new constant-mode contract (the old test asserted per-file exec bits that production never produced). jennifer is left in go.mod intentionally — running `go mod tidy` risks unrelated dep churn that's better handled separately.
Mockird31
approved these changes
May 28, 2026
sssciel
approved these changes
May 28, 2026
471754d to
d336530
Compare
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.
Lua scripts were serialized into
*_gen.gofiles by a custom jennifer-based generator that ran on every build. Replace it with//go:embeddeclarations in dedicatedlua_embed.gofiles in each package —cli/running,cli/connector,cli/checkpoint— and drop thegenerateLuaCodeVarpass fromcli/codegen/generate_code.go.While here, remove
cli/connector/lua/call_func_template.luaand its companioncallFuncTmplvar — dead since the cartridge-cli removal.The filemode generator stays (
embed.FSstrips unix mode bits, so the side-channel map is still necessary for the create-app templates).jenniferis left ingo.modintentionally - runninggo mod tidyrisks unrelated dep churn that's better handled separately.