Skip to content

acc: run cmd/workspace/apps/run-local locally - #6169

Open
radakam wants to merge 4 commits into
mainfrom
acc-run-apps-run-local-locally
Open

acc: run cmd/workspace/apps/run-local locally#6169
radakam wants to merge 4 commits into
mainfrom
acc-run-apps-run-local-locally

Conversation

@radakam

@radakam radakam commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Changes

Re-enable acceptance/cmd/workspace/apps/run-local, disabled since #4765.

  • Ports are allocated per run by a new acceptance/bin/free_port.py and registered as output replacements. run-local-node uses the helper too, replacing its inline copy; that test is disabled everywhere (Badness: needs NPM registry access), so CI does not exercise the change there.
  • The app fixture is a standard-library HTTP server, started directly. /shutdown stops the serve loop from a second thread so the response is delivered before the connection closes.
  • A failing run reaps the app by port. kill $PID cannot: backgrounding trace forks a subshell, so the CLI and the app it starts are grandchildren of the script and outlive it.
  • Dropped the Timeout/TimeoutWindows overrides, so the test takes the root defaults (60s, 90s on Windows, doubled in CI) rather than 2m/10m. They existed for the package installs that are gone; the test now runs in well under a second.
  • Dropped the --debug variant: it needs debugpy from PyPI. The invocation it exercised is asserted in libs/apps/runlocal unit tests.

Why

Both reasons the test was disabled — fixed ports and slowness — came from the fixture. --prepare-environment installs the seventeen default app libraries via uv, which can no longer work now that acceptance tests run with UV_OFFLINE. Without it the test covers the same ground in under a second: valueFrom rejection, --entry-point, app.yml env vars, the proxy URL reported for --port, and the proxy's identity headers.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 7da0161

Run: 31001539052

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 291 1095 12:07
🔄​ aws windows 1 4 4 292 1093 12:31
💚​ azure linux 4 4 290 1095 12:56
🔄​ azure windows 2 4 4 290 1093 10:13
💚​ gcp linux 1 5 291 1095 10:03
💚​ gcp windows 1 5 293 1093 8:53
11 interesting tests: 4 RECOVERED, 4 SKIP, 3 flaky
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestFsCpDir ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p
🔄​ TestFsCpDir/uc-volumes_to_dbfs ✅​p ✅​p ✅​p 🔄​f ✅​p ✅​p
🔄​ TestSyncFullFileSync ✅​p 🔄​f ✅​p ✅​p ✅​p ✅​p
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 25 slowest tests (at least 2 minutes):
duration env testname
8:56 azure windows TestAccept
6:09 gcp windows TestAccept
6:06 aws windows TestAccept
4:32 azure windows TestFilerWorkspaceFilesExtensionsReadDir
4:25 aws windows TestFilerRecursiveDelete/workspace_files_extensions
3:40 gcp linux TestFilerWorkspaceFilesExtensionsReadDir
3:31 gcp windows TestFilerWorkspaceFilesExtensionsReadDir
2:56 gcp windows TestImportDirWithOverwriteFlag
2:54 gcp linux TestAccept
2:53 aws linux TestAccept
2:49 azure linux TestAccept
2:45 gcp windows TestFilerWorkspaceFilesExtensionsDelete
2:42 azure windows TestExport
2:41 aws linux TestFilerWorkspaceFilesExtensionsRead
2:27 azure linux TestFilerRecursiveDelete/workspace_files
2:19 aws windows TestFilerReadWrite/workspace_files_extensions
2:18 azure linux TestFilerWorkspaceFilesExtensionsReadDir
2:16 azure windows TestFilerWorkspaceFilesExtensionsStat
2:10 gcp linux TestLock
2:10 aws linux TestFilerWorkspaceFilesExtensionsStat
2:08 aws linux TestExportDir
2:08 azure windows TestFilerReadWrite/workspace_files
2:05 aws windows TestFilerWorkspaceFilesExtensionsReadDir
2:05 gcp windows TestSyncIncrementalFileSync
2:03 aws linux TestFilerRecursiveDelete/workspace_files_extensions

@radakam
radakam marked this pull request as ready for review August 5, 2026 11:37
radakam added 4 commits August 5, 2026 16:51
The test was disabled in #4765 for using fixed ports and being slow, so
apps run-local has had no coverage on PRs since. Both problems come from the
fixture rather than the command: the ports were hardcoded, and the test asked
for --prepare-environment, which installs the seventeen default app libraries
via uv. That install can no longer work at all, because acceptance tests now
run with UV_OFFLINE and only a handful of vendored wheels.

Ports are now allocated per run from a new acceptance/bin/free_port.py, and the
app is a standard-library HTTP server started directly instead of Flask under a
freshly built venv, so the run needs no package index. The test covers the same
ground otherwise: valueFrom rejection, --entry-point, app.yml env vars, and the
proxy's identity headers.

The --debug variant is dropped because debugpy is only reachable from PyPI. The
debugpy invocation it exercised is asserted in libs/apps/runlocal unit tests.
The fixture answered /shutdown and then called os._exit(0) from inside the
handler, so the response reached the client only because the kernel drained the
socket buffer on exit. An abortive close would surface as a curl failure, and
the script no longer tolerates one: unlike the version this test was modelled
on, it has neither "|| true" on the shutdown request nor on the final wait.
Stopping the serve loop from a second thread closes the connection cleanly and
lets the process exit on its own, which also makes "wait $PID" assert that the
CLI exited zero.

The two ports now go through add_repl.py, so the output tells the proxy port
and the app port apart instead of rendering both as $(port); that makes the
generic 127.0.0.1 replacement dead, so it goes. With a stable placeholder for
the proxy port the test can assert the "To access your app go to" line, which
the previous version only waited for. Both run-local invocations are traced so
each LOG file records the command that produced it.
The trap killed $PID, which is not the CLI: backgrounding "trace" forks a
subshell, so the CLI and the Python app it starts are grandchildren and survive
the script. A failure anywhere after the app comes up left both processes
running, reparented to init, holding the two ports and an open handle on
LOG.run. Windows reaches the same state by another route, because kill
terminates the CLI outright instead of giving it the chance to stop the app, and
there a leaked handle also blocks the temp directory cleanup.

Cleanup now falls back to kill_port.py, which is what this script used before
and what run-local-node still does. It runs only when the script failed: on
success both processes have exited through /shutdown already, and the ports are
free and may have been handed to another test by the time the trap fires.
The trap explained that $PID is a subshell whose CLI and app survive being
killed, then killed $PID anyway. Reaping by port already covers both, so the
kill goes and the comment says why the port is the handle we have.

Also reach the server through self.server in the fixture rather than the
module global declared below the handler.
@radakam
radakam force-pushed the acc-run-apps-run-local-locally branch from 7da0161 to e1cf319 Compare August 5, 2026 16:53
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.

3 participants