Conversation
✅ Deploy Preview for images-devsy-sh canceled.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for devsydev canceled.
|
|
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
3e78c79 to
8a1a76c
Compare
Add secret_attach/secret_detach IPC handlers driving devsy secret attach/detach, per-context inject switches on the Secrets page, and an attached field in secret list JSON mirroring env list. Covers the secrets half of #1265; attached secrets keep using the protected secret-delivery path, never --env. E2E proves a context-attached secret reaches the workspace at up and is gone after detach.
… LockConfig Add config.UpdateConfig (lock, load, mutate, save) and migrate every unlocked SaveConfig caller: context create/delete/use/set-options, ide set/use, provider add/delete/init/set/set-source/use/rename (whole transaction), workspace import, pro login/logout/update-provider, the MCP provider tools, and the up-triggered provider auto-update (reload under lock). Resolves the CodeRabbit finding from #1266.
8a1a76c to
233064e
Compare
|
@greptileai review |
|
| unlock, err := config.LockConfig() | ||
| if err != nil { | ||
| return err | ||
| } | ||
| defer unlock() |
There was a problem hiding this comment.
pro login now keeps the config lock while waiting for browser authentication. If the user leaves that flow open, unrelated commands such as secret attach and context use block on the same lock until login finishes. Limit the lock to the config changes rather than the interactive wait.
| devsyConfig, err = config.LoadConfig(devsyConfig.DefaultContext, "") | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| _, err = UpdateProvider(ctx, devsyConfig, providerName, providerSource) |
There was a problem hiding this comment.
Auto-update uses a stale decision
The code decides that a provider needs updating before it takes the lock. If another command updates that provider while this operation waits, the reloaded config contains the newer version, but this path still applies its earlier update decision and can replace it. Check the version again after reloading.
Knowledge Base Used: Configuration resolution
| try { | ||
| if (attached) await secretAttach(secret.name, secret.context) | ||
| else await secretDetach(secret.name, secret.context) | ||
| await refreshSecrets() | ||
| } catch (err) { | ||
| attachmentErrors = { ...attachmentErrors, [key]: extractErrorMessage(err) } | ||
| } finally { | ||
| updatingAttachment = { ...updatingAttachment, [key]: false } |
There was a problem hiding this comment.
Failed toggle can look successful
When attach or detach fails, this path shows an error but does not restore the switch's checked state or reload the saved state. The switch can therefore appear to say that a secret will be injected when it will not, or the reverse. Restore the displayed state on failure.
| func (s *listTestStore) List(string) ([]devsysecrets.SecretMeta, error) { return s.metas, nil } | ||
| func (s *listTestStore) Delete(string, string) error { return nil } | ||
|
|
||
| func TestListEntriesMarksAttachedSecrets(t *testing.T) { |
There was a problem hiding this comment.
New tests bypass suite convention
This test and TestListEntriesDetachedWhenContextHasNoBindings are standalone testing.T functions using require assertions. The repository's unit-testing directive prefers testify/suite; please align these new tests with that requirement before merging.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
- pro login: hold the config lock only for the config changes, not the interactive browser wait - provider auto-update: re-check the version after reloading under the lock so a concurrent newer update is never replaced - Secrets page: remount the attach switch on failure so a failed toggle cannot display the wrong state - secrets list tests: align with the testify/suite unit-test convention
Fixes #1265.
#1266 covered the environment-variable half of the issue. This PR adds the secrets half and the repo-wide config-write locking fix.
Secrets attach (desktop + CLI surface)
secret_attach/secret_detachdesktop IPC handlers drivingdevsy secret attach|detach, mirroring theenv_attachpattern.devsy secret listnow reportsattachedin JSON and plain output, mirroringenv list.upwithout--secretand is gone after detach (docker-managed-secret-attached). Attached secrets keep using the protected secret-delivery path, never--env.Config-write locking
Resolves the CodeRabbit finding from #1266: the env/secret attach paths serialized config mutation under
LockConfig, but ~20 otherSaveConfigcallers did not, so concurrent commands could lose each other's updates.config.UpdateConfig(contextOverride, providerOverride, mutate): acquireLockConfig, load, mutate, save.LockConfigfor multi-step flows whose inner saves now run under the held lock: provider add/delete/init/set/set-source, provider rename (whole transaction including rollback), workspace import, pro login/logout (logout reloads under lock after daemon shutdown), pro update-provider, MCP provider delete.Verification
go build ./...,go vet,gofmtclean.go testgreen: cmd/secrets (new attached-list tests), cmd/env, cmd/context, cmd/provider, cmd/mcp, cmd/workspace, pkg/config, pkg/workspace, pkg/provider.Commits are unsigned pending the signing pass.