refactor(pipeline): extract pipelineschema package and shared schema cache#370
Merged
Merged
Conversation
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.
Summary
Split out of #226 to keep that PR focused on
migrate. Pulls the pipeline JSON-schema helpers out ofinternal/cmd/pipelineinto a reusableinternal/pipelineschemapackage and the on-disk schema cache intocmdutil.FetchOrCachePipelineSchema, so bothpipelineand the upcomingmigratecommand share one definition. Addsconfig.ConfigDir()as the single source for the config-dir path, and makespipeline validatefall back to the embedded schema when run unauthenticated instead of erroring.Changes
internal/pipelineschemapackage:Bytes,Compile,ValidateWithSchema,ConvertYAMLToJSON,HostedAgentNames.cmdutil.FetchOrCachePipelineSchema(24h on-disk cache, embedded fallback, corrupt-cache self-heal); removes the duplicate cache logic frompipeline/schema.go.config.ConfigDir()extracted;updatestate path and schema cache now derive from it.pipeline validatevalidates against the embedded schema when not authenticated (warns instead of failing).fus-reporting-api-go.Design Decisions
Straightforward.
Example
Test Plan
just unit)just lint)just acceptance) — N/A — no command/flag surface change.txtartest inacceptance/testdata/— N/A — no new command/flag--jsonsupport — N/A--jsonoutput: no field removals/renames (additive only) — N/Adocs/,skills/, andREADME.md— N/A — internal refactor + unauth fallback onlystatus:finalizedissue — N/A — internal change