Skip to content

Define devenv cli behavior when shared devenvyaml is absent#32

Open
spapa013 wants to merge 9 commits intonauticalab:mainfrom
spapa013:spapadop/plt-855-define-devenv-cli-behavior-when-shared-devenvyaml-is-absent
Open

Define devenv cli behavior when shared devenvyaml is absent#32
spapa013 wants to merge 9 commits intonauticalab:mainfrom
spapa013:spapadop/plt-855-define-devenv-cli-behavior-when-shared-devenvyaml-is-absent

Conversation

@spapa013
Copy link
Collaborator

@spapa013 spapa013 commented Mar 17, 2026

Summary

  • Makes devenv.yaml (shared config) mandatory: LoadGlobalConfig now returns a clear, actionable error when the file is absent rather than silently falling back to system defaults
  • Removes os.Stat + os.ReadFile pattern across all three config load functions, replacing with a single os.ReadFile call and os.IsNotExist error inspection

Tests

  • go test ./... passes
  • Running devenv generate without a devenv.yaml present prints an actionable error naming the missing file and what to create
  • Running devenv generate with a valid devenv.yaml behaves as before

Dependencies

⚠️ This PR is stacked on #31 . Rebase onto main after that PR is merged before merging this one.

Closes PLT-855

Align config validation with the ingress manifests that generation can produce.

The original validation path did not fully enforce the conditions needed
to render ingress safely. This change centralizes HTTP/hostname checks,
tightens auth validation, and updates tests and fixtures to reflect the
actual supported config combinations.

- add helpers for HTTP exposure and hostname presence
- require hostName when httpPort is set
- reject enableAuth combined with skipAuth
- require authURL and authSignIn when auth is enabled
- expand validation tests for ingress and auth dependencies
- update the ingress golden fixture to use a valid hostname
Extract template selection and ownership into an explicit RenderPlan.

The original renderer implicitly owned the template sets for dev and
system generation. This change moves that planning logic into a separate
module so template selection is explicit, testable, and reusable by the
rest of the generation pipeline.

- add RenderPlan with TemplateNames and ManagedTemplates
- add BuildDevRenderPlan and BuildSystemRenderPlan
- define dev/system base and optional template sets outside the renderer
- add contract tests for dev and system plans
- add invariants to ensure all planned templates are managed
- cover ingress inclusion and exclusion through plan tests
Introduce an explicit post-render phase for manifest output handling.

This change adds a dedicated post-render step that manages generated
outputs after a successful render, including cleanup of stale managed
files from previous runs that are no longer planned.

- add RunPostRender for post-render output handling
- add cleanup behavior for managed outputs that are no longer planned
- add post-render tests for managed, planned, and unmanaged outputs
- keep renderer tests focused on rendering behavior and failure paths
- make the invalid output directory test deterministic
- document the dev/system renderer wrappers as convenience helpers
Refactor manifest generation around an explicit GenerationSpec.

The original generate command assembled rendering inputs directly inside
the system and developer generation paths. This change packages the
generation contract into a typed spec, adds a shared generateManifests
pipeline, and introduces a no-cleanup flag for post-render behavior.

- add GenerationSpec with dev and system builders
- add NewPostRenderOptions for explicit post-render policy creation
- add --no-cleanup and map it into post-render behavior
- standardize the CLI flow on spec -> render -> post-render
- add a shared generateManifests helper for dev and system generation
- switch the command path to the generic NewRenderer constructor
- keep RenderPlan focused on TemplateNames only
- build dev plans by filtering the full dev template set
- add explicit cleanup-scope helpers for dev and system templates
- make BuildDevRenderPlan return an error for nil config
- update renderer/tests to use the new plan contract
- move cleanup to a pre-render step gated by --no-cleanup
- scope cleanup to known template outputs
- restore explicit generateSystemManifests / generateDeveloperManifests flows
use NewSystemRenderer and NewDevRenderer again instead of hardcoding generic render flow
- keep post-render invocation as an explicit pipeline stage
… no-op hook

- remove GenerationSpec and its builders
- simplify post-render to a no-op extension point for future work
- keep PostRenderOptions minimal
- reduce tests to cover the current no-op post-render contract
LoadGlobalConfig now returns an error when devenv.yaml is absent, rather than silently falling back to system defaults. The error message names the missing file and tells the user what to create and where.

Tests updated to reflect the new contract; the two test cases that asserted the silent-default behavior have been replaced with error assertions.

Refs: PLT-855
Replace the two-step os.Stat + os.ReadFile pattern in all three config load functions with a single os.ReadFile call, inspecting the error for os.IsNotExist. Eliminates a redundant syscall and the race window between the existence check and the read.

Refs: PLT-855
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 58.75000% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/devenv/generate.go 0.00% 26 Missing ⚠️
internal/templates/renderer.go 70.00% 2 Missing and 1 partial ⚠️
internal/config/parser.go 71.42% 2 Missing ⚠️
internal/config/types.go 71.42% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@spapa013 spapa013 requested a review from eywalker March 17, 2026 22:29
@spapa013 spapa013 marked this pull request as ready for review March 17, 2026 22:46
@spapa013 spapa013 force-pushed the spapadop/plt-855-define-devenv-cli-behavior-when-shared-devenvyaml-is-absent branch from 280c303 to c0226fa Compare March 18, 2026 00:54
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