Skip to content

fix(shim): preserve configuration created while waiting for the lock - #63

Merged
zongqichen merged 2 commits into
mainfrom
fix/seed-state-under-lock
Nov 2, 2026
Merged

zongqichen merged 2 commits into
mainfrom
fix/seed-state-under-lock

Conversation

@zongqichen

Copy link
Copy Markdown
Owner

Why

The shim could overwrite workspace configuration created by another command while it waited for the context lock. Inspect the configuration after acquiring that lock.

What changed

  • Preserve configuration created during the lock wait, including configuration without an API target.
  • Release the context lock if configuration inspection fails.
  • Update the login inheritance documentation and changelog.

Scope

This change covers automatic login copying into the default workspace context. Explicit imports keep their existing behavior.

Blast Radius

The ordinary managed shim checks configuration later in its existing lock lifecycle. The Linux concurrency regression uses an inotify event to synchronize the two commands.

Verification

  • The concurrency regression failed before the fix and passed afterward. Application tests and focused race-detector tests passed.
  • A controlled official CF CLI probe reproduced the overwrite on main and preserved the workspace API, organization, and space after the fix.
  • make check, make release-check, make security, and make smoke passed.

Closes #62.

@zongqichen

Copy link
Copy Markdown
Owner Author

PASS+NOTES for exact head 7b91b7cc1f40a57faf0e778976ce1c27092b1163. No blocking finding.

Independent official CLI evidence reproduced the race on the baseline in 10 of
10 runs and passed on the head in 10 of 10 runs. The head preserved the normalized
workspace configuration, emitted no seed notice, left the synthetic global source
unchanged, and returned 0. The original sparse-JSON probe still reports false on
the head because cf version adds default fields. A direct official CLI control
confirmed that the API target, organization name, and space name remain unchanged.

The focused behavior set passed 20 repetitions. Both new tests passed 10
repetitions under the race detector. The full internal/app package and the
isolated race-enabled end-to-end suite passed. The new error path returned
exitError and released the context lock for immediate reacquisition. Named,
external, existing no-target, and fresh-seed behavior remained intact.

Notes only. The deterministic race test is Linux-only, and Windows received
compile-only coverage. The Linux test releases its held lock on failure but does
not join its goroutine on every abnormal exit. Neither note blocks this fix. Root
artifacts show make check, make release-check, make security, and make smoke passed.

@zongqichen
zongqichen merged commit ec98e32 into main Nov 2, 2026
16 of 18 checks passed
@zongqichen
zongqichen deleted the fix/seed-state-under-lock branch November 2, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(shim): preserve state created while waiting for the context lock

1 participant