Repository navigation
Conversation
The model plugin's Generate ran eval.RunDSL a second time and deleted gen/structurizr/model.json before returning the file. goa gen evaluates the design before it calls plugins, so the second run executed every DSL function again: the generated workspace listed each view twice, and in larger designs (big_bank_plc) repeated 25 model relationships and recorded view animations that included the repeats. Rendering the returned file already replaces any previous one, so deleting it first was unnecessary and made planning files touch the file system. Generate now reads the evaluated model only. On every example design the new output equals the old output with its repeated entries removed. A test checks that big_bank_plc lists every view and identified element once; it fails on the previous code.
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.
The
modelGoa plugin (goa.design/model/plugins/model) generatesgen/structurizr/model.json, the Structurizr C4 workspace JSON for a Goa design that importsgoa.design/model/dsl. Today, runninggoa genon any design with a C4 model writes every view twice intogen/structurizr/model.json, and in designs with explicit element relationships it also duplicates model relationships and view animation steps.goa genalready runseval.RunDSL()once before invoking registered codegen plugins.plugin.Generateinplugins/model/generate.gocalledeval.RunDSL()a second time, re-executing every top-level DSL closure and appending a second copy of every view and relationship ontoexpr.Root. For example,examples/basicemitted twoSystemContextviews and twoContainer Viewviews, andexamples/big_bank_plcemitted 25 duplicate relationships and repeated animation steps.Generatealso deleted any pre-existinggen/structurizr/model.jsonon disk before returning itscodegen.File, even though Goa's renderer already overwrites generated files when writing output.plugin.Generatenow reads the already-evaluatedexpr.Rootdirectly without callingeval.RunDSL()again or removing files from disk prior to rendering.TestGenerateDescribesTheEvaluatedDesignOnceruns a singleeval.RunDSL()pass followed byGenerateonexamples/big_bank_plcand verifies that every view key and every identified model element appears once in the renderedmodel.json(which failed previously with duplicateSystemLandscapeviews and duplicate relationship IDs). Regenerating all ten repository examples produces identicalmodel.jsonoutput with the duplicate views, relationships, and animation steps removed.