Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
226caa6
fix(provider): prepare updates before publishing
skevetter Oct 11, 2026
efb67cf
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 11, 2026
c0886a0
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 13, 2026
7b93484
fix(provider): preserve prepared binary families during updates
skevetter Oct 13, 2026
9342c26
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 13, 2026
5d3003f
test(provider): require Windows update preservation coverage
skevetter Oct 13, 2026
bcff13c
fix(provider): handle confined Windows parent symlinks
skevetter Oct 13, 2026
2e737f6
test(provider): classify unavailable Windows symlink privileges
skevetter Oct 13, 2026
4be8541
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 13, 2026
37df5eb
fix(provider): retain successful updates after staging cleanup errors
skevetter Oct 13, 2026
a9b8d08
fix(provider): normalize archive symlink separators on Windows
skevetter Oct 13, 2026
e7a22ed
chore: integrate shared MicroSandbox test foundation
skevetter Oct 13, 2026
e47c360
fix(ci): avoid Windows Go cache post-job timeouts
skevetter Oct 13, 2026
b983124
fix(provider): validate staged aliases and restore directory modes
skevetter Oct 13, 2026
6f1a04e
chore(runtime): integrate MicroSandbox compatibility coverage
skevetter Oct 13, 2026
0d86035
fix(ci): report all Windows provider coverage failures
skevetter Oct 13, 2026
6f54850
test(provider): check symlink capability for staged alias coverage
skevetter Oct 13, 2026
3ebbcf5
fix(ci): retain Windows Go caching with cold-run headroom
skevetter Oct 13, 2026
5edb781
fix(provider): preserve valid staged update inputs
skevetter Oct 13, 2026
339604e
test(ssh): observe owned reverse-forward listener closure
skevetter Oct 14, 2026
dc539e0
test(runtime): prepare existing-workspace source migration coverage
skevetter Oct 14, 2026
bda9c99
chore(runtime): integrate migration with validated CI foundation
skevetter Oct 14, 2026
0aeea93
chore: integrate reviewed remote-agent foundation
skevetter Oct 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ jobs:
- label: up-provider-microsandbox-remote-agent-binaries
expected-spec-count: 1
provider-mode: external
- label: up-provider-microsandbox-source-migration
expected-spec-count: 2
provider-mode: external
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
Expand Down
122 changes: 122 additions & 0 deletions cmd/provider/set_source_init_failure_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package provider

import (
"context"
"os"
"path/filepath"
"testing"
"time"

"github.com/devsy-org/devsy/cmd/flags"
"github.com/devsy-org/devsy/pkg/config"
provider2 "github.com/devsy-org/devsy/pkg/provider"
"github.com/devsy-org/devsy/pkg/types"
"github.com/devsy-org/devsy/pkg/workspace"
"github.com/stretchr/testify/require"
"sigs.k8s.io/yaml"
)

func TestSetSourceInitFailureKeepsCommittedReplacementAndWorkspace(t *testing.T) {
initial, userOption := setupInitializedSourceProvider(t)

associated := &provider2.Workspace{
ID: "existing", UID: "existing-generation", Context: initial.DefaultContext,
Provider: provider2.WorkspaceProviderConfig{Name: testProviderFoo},
}
require.NoError(t, provider2.SaveWorkspaceConfig(associated))
workspaceDir, err := provider2.GetWorkspaceDir(initial.DefaultContext, associated.ID)
require.NoError(t, err)
recordPath := filepath.Join(workspaceDir, provider2.WorkspaceConfigFile)
// #nosec G304 -- recordPath is the isolated fixture workspace record.
recordBefore, err := os.ReadFile(recordPath)
require.NoError(t, err)
markerPath := filepath.Join(workspaceDir, "retained-content")
require.NoError(t, os.WriteFile(markerPath, []byte("existing-workspace-content"), 0o600))

missingInit := filepath.Join(t.TempDir(), "missing-init-executable")
replacement, err := provider2.LoadProviderConfig(initial.DefaultContext, testProviderFoo)
require.NoError(t, err)
replacement.Version = "2.0.0"
replacement.Exec.Init = []string{missingInit}
replacementSource := filepath.Join(t.TempDir(), "replacement.yaml")
replacement.Source = provider2.ProviderSource{File: replacementSource, Raw: replacementSource}
replacementBytes, err := yaml.Marshal(replacement)
require.NoError(t, err)
require.NoError(t, os.WriteFile(replacementSource, replacementBytes, 0o600))
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
cmd := &SetSourceCmd{GlobalFlags: &flags.GlobalFlags{}, Use: true}
err = cmd.Run(ctx, initial, []string{testProviderFoo, replacementSource})
require.ErrorContains(t, err, "init:")
require.ErrorContains(t, err, "missing-init-executable")

assertFailedSourceReplacement(
t,
initial.DefaultContext,
replacement,
userOption,
)
// #nosec G304 -- recordPath is the same isolated fixture workspace record.
recordAfter, err := os.ReadFile(recordPath)
require.NoError(t, err)
require.Equal(t, recordBefore, recordAfter)
// #nosec G304 -- markerPath is created in this fixture workspace directory.
markerAfter, err := os.ReadFile(markerPath)
require.NoError(t, err)
require.Equal(t, "existing-workspace-content", string(markerAfter))
}

func setupInitializedSourceProvider(t *testing.T) (*config.Config, config.OptionValue) {
t.Helper()
t.Setenv("DEVSY_HOME", t.TempDir())
initial := setupProviderOperationTest(t)
oldSource := filepath.Join(t.TempDir(), "old.yaml")
old := &provider2.ProviderConfig{
Name: testProviderFoo, Version: "1.0.0",
Options: map[string]*types.Option{"REGION": {Default: "default-region"}},
Exec: provider2.ProviderCommands{Command: []string{"unused-command"}},
}
oldBytes, err := yaml.Marshal(old)
require.NoError(t, err)
require.NoError(t, os.WriteFile(oldSource, oldBytes, 0o600))
_, err = workspace.AddProvider(context.Background(), initial, testProviderFoo, oldSource)
require.NoError(t, err)
userOption := config.OptionValue{Value: "user-region", UserProvided: true}
require.NoError(
t,
config.UpdateConfig(initial.DefaultContext, "", func(c *config.Config) error {
c.Current().DefaultProvider = testProviderFoo
c.Current().Providers[testProviderFoo].Initialized = true
c.Current().Providers[testProviderFoo].Options = map[string]config.OptionValue{
"REGION": userOption,
}
return nil
}),
)

return initial, userOption
}

func assertFailedSourceReplacement(
t *testing.T,
contextName string,
expected *provider2.ProviderConfig,
userOption config.OptionValue,
) {
t.Helper()
installed, err := provider2.LoadProviderConfig(contextName, testProviderFoo)
require.NoError(t, err)
require.Equal(t, expected.Version, installed.Version)
require.Equal(t, expected.Source.Raw, installed.Source.Raw)
require.Equal(t, expected.Exec.Init, installed.Exec.Init)
stored, err := config.LoadConfig(contextName, "")
require.NoError(t, err)
state := stored.Current().Providers[testProviderFoo]
require.NotNil(t, state)
require.False(t, state.Initialized)
require.True(t, state.InitAttempted)
require.Contains(t, state.InitError, "missing-init-executable")
require.Equal(t, userOption.Value, state.Options["REGION"].Value)
require.True(t, state.Options["REGION"].UserProvided)
require.Equal(t, testProviderFoo, stored.Current().DefaultProvider)
}
28 changes: 27 additions & 1 deletion e2e/tests/up/MICROSANDBOX.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,37 @@ Devsy agent endpoint stays available; this is workspace-runtime reuse, not an
offline-agent executable guarantee. Workspace, container and server cleanup
have independent bounded attempts.

This external-only row brings the configured catalogue to 15 suites/78 cases
The remote-agent acceptance expanded the catalogue to 15 suites/78 cases
(37 built-in, 41 external). Earlier 77-case consumer reports do not prove the
remote-agent case. Its native Linux/amd64 KVM report must pass once without
selected skips; source checks, fixture unit tests and dry runs cannot prove it.

## Existing-workspace source migration

The `up-provider-microsandbox-source-migration` external-only row covers explicit
`provider set-source` migration from the built-in MicroSandbox descriptor to the
published external provider, for both running and stopped workspaces. Each case
starts with a unique provider/workspace/volume and user-provided options. It
checks stored source and driver identity, successful activation, preserved
provider name/default/options, workspace and SSH records, VM creation time,
root data, named-volume data and a host bind marker.

The running case requires the same guest boot ID through migration and a later
`up`. The stopped case checks that migration leaves the VM stopped before any
command resumes it; subsequent `up` must start that same VM with its data intact.
Deletion must remove the migrated workspace record and the exact owned sandbox.
Independent cleanup attempts cover the workspace, sandbox fallback and volume.
The command-package unit test separately covers activation failure after a
committed replacement: it retains the replacement source and workspace data,
records the initialization error and preserves user options and default choice.

This row brings the configured catalogue to 16 suites/80 cases (37 built-in,
43 external). It requires two actual native cases, each passed once
without selected skips. Compilation and dry-run registration are not migration
proof. Stored internal descriptors refresh executable blocks; they do not
implicitly migrate driver or binaries. A future bundled-default transition must
retain a literal legacy built-in fixture for these starting workspaces.

## Runtime startup measurements

The existing two-case lifecycle label optionally captures its ordinary fresh
Expand Down
Loading
Loading