Skip to content

Add graph dump and load functionality#905

Open
purpleidea wants to merge 2 commits into
baddevfrom
graph-dump-load-13057943563418791222
Open

Add graph dump and load functionality#905
purpleidea wants to merge 2 commits into
baddevfrom
graph-dump-load-13057943563418791222

Conversation

@purpleidea
Copy link
Copy Markdown
Owner

This change adds the ability to dump a resource graph from the engine to a YAML file and load it back. This is particularly useful for debugging and for creating standalone tests that operate on complex graph structures.

The implementation includes:

  • A Dump(path string) method on the graph.Engine struct.
  • DumpGraph(g *pgraph.Graph, path string) and LoadGraph(path string) functions in the engine/graph package.
  • Intelligent parameter serialization that maps internal Go field names to their language-level equivalents (using lang struct tags) for a more "sensible" text format.
  • Robust loading logic that reconstructs resources, restores parameters via the engine's type system (types.Into), and correctly handles nested/grouped resources.
  • New tests in engine/graph/dump_test.go that verify dump/load integrity, grouping preservation, and provide a performance measurement of the autogrouping algorithm on loaded graphs.

PR created automatically by Jules for task 13057943563418791222 started by @purpleidea

purpleidea and others added 2 commits March 15, 2026 16:03
- Implement `Dump` method on `*graph.Engine` to serialize the resource graph to YAML.
- Implement `LoadGraph` and `DumpGraph` utilities in `engine/graph/dump.go`.
- Support recursive dumping and loading of grouped resources.
- Ensure proper parameter restoration using `lang` tags and `types.Into`.
- Add comprehensive tests in `engine/graph/dump_test.go` including performance measurement.

Co-authored-by: purpleidea <135091+purpleidea@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant