Repository navigation
feat(devcontainer): require id in feature parse - #960
Merged
Merged
Conversation
The devcontainer Feature schema marks `id` as a required property, but ParseDevContainerFeature silently accepted manifests with an empty/missing id. The info and generatedocs commands would therefore process malformed features without error. Add id validation to ParseDevContainerFeature so a missing or empty id returns an error referencing devcontainer-feature.json. Remove the now-redundant id-presence check in cmd/feature validatePublishTarget (the parser enforces it) and update its test to assert the parser-level message. Add unit tests covering the missing-id, empty-id, and valid-id cases.
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 9 |
| Duplication | 0 |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
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.
Spec requirement
The devcontainer Feature schema (
devContainerFeature.schema.json) marksidas a required property on a Feature manifest (devcontainer-feature.json).Gap found
ParseDevContainerFeatureinpkg/devcontainer/config/parse.gosilently accepted manifests with a missing or emptyid. Thecmd/featureinfoandgeneratedocscommands therefore processed malformed Features without error, and the onlyid-presence check lived invalidatePublishTarget(publish path) — leaving the parse/info/docs paths unenforced.Change
pkg/devcontainer/config/parse.go:ParseDevContainerFeaturenow returns"<path> is missing required property \"id\""whenidis empty/missing, so every caller (info, generatedocs, publish) enforces the spec.cmd/feature/publish.go: removed the now-redundantID == ""check invalidatePublishTarget(the parser enforces it earlier).cmd/feature/publish_test.go: updatedTestValidatePublishTarget_MissingIDto assert the parser-level message.pkg/devcontainer/config/feature_test.go: added unit tests for the missing-id / empty-id / valid-id cases plusDependsOnKeys()ordering behavior.No feature versions or lock SHAs were changed (none were stale).
Verification
task cli:format— clean (exit 0)task cli:lint:ci— 0 new issuestask cli:test— all pass except the known pre-existingpkg/gitTestRepoClone*failures on origin/main (unrelated to this change; this change does not touchpkg/git)task cli:test:e2e:suite -- "devcontainer"— not run (no docker/devcontainer CLI available in this environment)This PR was created by an AI agent as part of an automated daily devcontainer spec job.