-
Notifications
You must be signed in to change notification settings - Fork 2
fix(feature): match devcontainer CLI lockfile dependsOn format #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
24d01b1
fix(feature): match devcontainer CLI lockfile dependsOn format
skevetter 01c3a58
fix(feature): resolve cyclop and goconst lint findings
skevetter 675cd27
fix(feature): harden dependsOn ordering and lockfile back-compat
skevetter 52eb634
refactor(feature): drop lockfile back-compat and explanatory comments
skevetter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| package config | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "reflect" | ||
| "testing" | ||
| ) | ||
|
|
||
| const ( | ||
| depZeta = "ghcr.io/x/zeta:1" | ||
| depAlpha = "ghcr.io/x/alpha:1" | ||
| depMid = "ghcr.io/x/mid:1" | ||
| ) | ||
|
|
||
| func TestFeatureConfig_DependsOnKeysPreservesDeclarationOrder(t *testing.T) { | ||
| data := []byte(`{ | ||
| "id": "example", | ||
| "dependsOn": { | ||
| "ghcr.io/x/zeta:1": {}, | ||
| "ghcr.io/x/alpha:1": {}, | ||
| "ghcr.io/x/mid:1": {} | ||
| } | ||
| }`) | ||
|
|
||
| var cfg FeatureConfig | ||
| if err := json.Unmarshal(data, &cfg); err != nil { | ||
| t.Fatalf("unmarshal: %v", err) | ||
| } | ||
|
|
||
| want := []string{depZeta, depAlpha, depMid} | ||
| if got := cfg.DependsOnKeys(); !reflect.DeepEqual(got, want) { | ||
| t.Errorf("DependsOnKeys() = %v, want %v", got, want) | ||
| } | ||
| } | ||
|
|
||
| func TestFeatureConfig_DependsOnKeysFallsBackToSorted(t *testing.T) { | ||
| cfg := FeatureConfig{DependsOn: DependsOnField{ | ||
| depZeta: map[string]any{}, | ||
| depAlpha: map[string]any{}, | ||
| }} | ||
|
|
||
| want := []string{depAlpha, depZeta} | ||
| if got := cfg.DependsOnKeys(); !reflect.DeepEqual(got, want) { | ||
| t.Errorf("DependsOnKeys() = %v, want %v", got, want) | ||
| } | ||
| } | ||
|
|
||
| func TestFeatureConfig_DependsOnKeysFallsBackWhenKeyMutated(t *testing.T) { | ||
| data := []byte( | ||
| `{"id": "example", "dependsOn": {"ghcr.io/x/zeta:1": {}, "ghcr.io/x/alpha:1": {}}}`, | ||
| ) | ||
|
|
||
| var cfg FeatureConfig | ||
| if err := json.Unmarshal(data, &cfg); err != nil { | ||
| t.Fatalf("unmarshal: %v", err) | ||
| } | ||
| delete(cfg.DependsOn, depAlpha) | ||
| cfg.DependsOn[depMid] = map[string]any{} | ||
|
|
||
| want := []string{depMid, depZeta} | ||
| if got := cfg.DependsOnKeys(); !reflect.DeepEqual(got, want) { | ||
| t.Errorf("DependsOnKeys() = %v, want %v", got, want) | ||
| } | ||
| } | ||
|
|
||
| func TestFeatureConfig_DependsOnKeysEmpty(t *testing.T) { | ||
| var cfg FeatureConfig | ||
| if got := cfg.DependsOnKeys(); len(got) != 0 { | ||
| t.Errorf("DependsOnKeys() = %v, want empty", got) | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: devsy-org/devsy
Length of output: 35212
🏁 Script executed:
Repository: devsy-org/devsy
Length of output: 21450
🏁 Script executed:
Repository: devsy-org/devsy
Length of output: 11881
Normalize legacy
dependsOnon lockfile read.ReadLockfileunmarshals persisted files intoLockedFeature, whoseDependsOnis now[]string; object-shapeddependsOnentries fail to parse during fetch resolution (vianewLockfileState). Decode lockfile entries as flexible JSON first/normatively, then normalize to the array shape used for pinning and writing.🤖 Prompt for AI Agents