Integrate intocps/workspace: fetch workbench links from services API, update Docker images#1484
Integrate intocps/workspace: fetch workbench links from services API, update Docker images#1484Copilot wants to merge 3 commits intofeature/distributed-demofrom
Conversation
…e Docker images Co-authored-by: prasadtalasila <9206466+prasadtalasila@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/distributed-demo #1484 +/- ##
============================================================
+ Coverage 96.33% 96.38% +0.04%
============================================================
Files 124 125 +1
Lines 3633 3677 +44
Branches 579 583 +4
============================================================
+ Hits 3500 3544 +44
Misses 131 131
Partials 2 2
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request integrates the intocps/workspace:latest Docker image to replace mltooling/ml-workspace-minimal:0.13.2 and refactors workbench tool link management from static environment variables to dynamic runtime fetching. The client now fetches workspace service information (VNC Desktop, VS Code, Jupyter Lab, Jupyter Notebook) from a {appURL}/{username}/services JSON endpoint and stores it in a new Redux slice, while preview links remain as environment variables.
Changes:
- Replaced Docker image
mltooling/ml-workspace-minimal:0.13.2withintocps/workspace:latestacross all compose files - Removed four
REACT_APP_WORKBENCHLINK_*environment variables for workspace tools from all config files - Added Redux slice for async fetching and caching of workbench services with idle/loading/succeeded/failed states
- Updated
useWorkbenchLinkValues()to construct links from Redux services data instead of environment variables
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docker/compose.dev.yml | Updated user workspace images to intocps/workspace:latest |
| deploy/docker/compose.server.yml | Updated user workspace images to intocps/workspace:latest |
| deploy/docker/compose.server.secure.yml | Updated user workspace images to intocps/workspace:latest |
| deploy/docker/compose.local.yml | Updated user workspace image to intocps/workspace:latest |
| deploy/docker/compose.local.secure.yml | Updated user workspace image to intocps/workspace:latest |
| client/test/unit/util/envUtil.test.ts | Updated tests to mock Redux services state and validate link construction from services |
| client/test/unit/store/workbenchSlice.test.ts | Added comprehensive unit tests for workbench slice reducers and async thunk states |
| client/test/unit/routes/Workbench.test.tsx | Updated unit test to mock Redux dispatch and workbench state |
| client/test/unit/page/Config.test.tsx | Updated test assertion to reflect removed env vars |
| client/test/integration/Routes/Workbench.test.tsx | Refactored integration test to pre-populate services via Redux action instead of env vars |
| client/test/mocks/global_mocks.tsx | Removed deprecated workbench environment variables |
| client/src/util/envUtil.ts | Refactored to read workspace links from Redux services, preview links from env vars |
| client/src/util/configUtil.ts | Removed deprecated workspace tool env var keys from validation |
| client/src/store/workbench.slice.ts | New Redux slice with async thunk for fetching services and state management |
| client/src/store/store.ts | Integrated workbench slice reducer and exported AppDispatch type |
| client/src/route/workbench/Workbench.tsx | Added useEffect to dispatch fetchWorkbenchServices on mount when idle |
| client/env.d.ts | Removed TypeScript declarations for deprecated workspace env vars |
| client/config/test.js | Removed deprecated workspace env vars |
| client/config/prod.js | Removed deprecated workspace env vars |
| client/config/local.js | Removed deprecated workspace env vars |
| client/config/dev.js | Removed deprecated workspace env vars |
| cli/users.server.yml | Updated user workspace image template to intocps/workspace:latest |
| cli/users.server.secure.yml | Updated user workspace image template to intocps/workspace:latest |
| cli/users.local.yml | Updated user workspace image template to intocps/workspace:latest |
| cli/tests/data/compose.users.test.yml | Updated test fixture to use intocps/workspace:latest |
| cli/tests/data/compose.users.exp.yml | Updated expected test output to use intocps/workspace:latest |
Comments suppressed due to low confidence (1)
client/src/route/workbench/Workbench.tsx:51
- The error state from fetchWorkbenchServices is not surfaced to users. When status is 'failed', the Workbench page silently shows only preview links without explanation. Consider adding error UI feedback (e.g., an alert or message) to inform users that workspace tools couldn't be loaded, similar to how other parts of the application handle failed fetches.
function WorkBenchContent() {
const linkValues = useWorkbenchLinkValues();
const dispatch = useDispatch<AppDispatch>();
const username = useSelector((state: RootState) => state.auth).userName ?? '';
const servicesStatus = useSelector(
(state: RootState) => state.workbench.status,
);
const appURL = useAppURL();
useEffect(() => {
if (servicesStatus === 'idle' && username) {
dispatch(fetchWorkbenchServices(`${appURL}/${username}/services`));
}
}, [servicesStatus, username, appURL, dispatch]);
return (
<Layout sx={{ display: 'flex' }}>
<Paper
sx={{
p: 2,
height: '100%',
display: 'flex',
flexDirection: 'column',
position: 'relative',
}}
>
<Typography variant="h4">Workbench Tools</Typography>
<Container>
<LinkButtons buttons={linkValues} size={6} marginRight={40} />
</Container>
</Paper>
</Layout>
);
| export const fetchWorkbenchServices = createAsyncThunk( | ||
| 'workbench/fetchServices', | ||
| async (url: string) => { | ||
| const response = await fetch(url); | ||
| if (!response.ok) { | ||
| throw new Error(`Failed to fetch services: ${response.statusText}`); | ||
| } | ||
| return (await response.json()) as Record<string, WorkbenchService>; | ||
| }, | ||
| ); |
There was a problem hiding this comment.
The fetch request lacks a timeout, which could cause indefinite hangs if the services endpoint is unresponsive. Following the codebase pattern (Authentication.ts uses 30000ms, configUtil.ts uses 2000ms for config checks), consider adding a timeout using AbortSignal.timeout. For a non-critical workbench feature fetch, a shorter timeout (e.g., 5000-10000ms) would improve user experience by failing faster.
client/src/store/workbench.slice.ts
Outdated
| if (!response.ok) { | ||
| throw new Error(`Failed to fetch services: ${response.statusText}`); | ||
| } | ||
| return (await response.json()) as Record<string, WorkbenchService>; |
There was a problem hiding this comment.
The response JSON is not validated before being cast to Record<string, WorkbenchService>. If the services endpoint returns malformed data (missing required fields like 'endpoint', 'name', or 'description'), it could cause runtime errors when useWorkbenchLinkValues accesses service.endpoint. Consider adding runtime validation using a schema validator like Zod (already used in configUtil.ts) to ensure data integrity.
|
@atomicgamedeveloper please review this PR. Thanks. |
Co-authored-by: prasadtalasila <9206466+prasadtalasila@users.noreply.github.com>
|
…and integrate PR #1484 changes - Add AbortSignal.timeout(8000) to fetchWorkbenchServices thunk - Create client/src/utils/services.json as fallback template - On fetch failure, load fallback and replace 'username' in VNC endpoint - Change thunk param to { url, username } for fallback username use - Fix CLI test expectations to use intocps/workspace:latest" Co-authored-by: prasadtalasila <9206466+prasadtalasila@users.noreply.github.com>



Type of Change
Description
Replaces
mltooling/ml-workspace-minimal:0.13.2withintocps/workspace:latestacross all Docker Compose files. Removes hardcodedREACT_APP_WORKBENCHLINK_*env vars for the four workspace tools (VNC Desktop, VS Code, Jupyter Lab, Jupyter Notebook) — these links are now derived at runtime by fetching{appURL}/{username}/servicesfrom the new workspace image.New Redux slice —
workbench.slice.tsfetchWorkbenchServices(url): async thunk that GETs the services endpoint, validates the response with Zod, and stores resultssetWorkbenchServices/resetWorkbench: synchronous actions for seeding/resetting state in tests{ services: Record<string, WorkbenchService>, status: 'idle' | 'loading' | 'succeeded' | 'failed' }useWorkbenchLinkValues()—envUtil.tsMaps service keys (
desktop→VNCDESKTOP,vscode→VSCODE,lab→JUPYTERLAB,notebook→JUPYTERNOTEBOOK) from Redux toKeyLinkPair[]. Preview links (LIBRARY_PREVIEW,DT_PREVIEW) remain in env vars as they point to internal client routes.Workbench.tsxDispatches
fetchWorkbenchServiceson mount whenstatus === 'idle'and a username is present, ensuring a single fetch per session.Services JSON format (from
intocps/workspace):{ "desktop": { "name": "Desktop", "description": "...", "endpoint": "tools/vnc?path=..." }, "vscode": { "name": "VS Code", "description": "...", "endpoint": "tools/vscode" }, "lab": { "name": "Jupyter Lab", "description": "...", "endpoint": "lab" }, "notebook": { "name": "Jupyter Notebook", "description": "...", "endpoint": "" } }Config / type declaration cleanup
Removed
REACT_APP_WORKBENCHLINK_VNCDESKTOP/VSCODE/JUPYTERLAB/JUPYTERNOTEBOOKfrom all config files (dev.js,test.js,local.js,prod.js),env.d.ts, andconfigUtil.tspath keys. AddedAppDispatchexport tostore.ts.Testing
workbenchSlice.test.ts: reducer cases (pending/fulfilled/rejected, set, reset) plus thunk-level tests for valid JSON (fulfilled), invalid JSON rejected by Zod (failed), and non-ok HTTP response (failed)envUtil.test.ts: mocks Redux state with a services object; tests link construction from services and empty-services fallbackWorkbench.test.tsx(integration): pre-loads the store viasetWorkbenchServicesinstead of setting env varsConfig.test.tsxandglobal_mocks.tsxto reflect removed env varsImpact
Breaking config change: existing
env.jsdeployments must drop the fourREACT_APP_WORKBENCHLINK_*workspace entries. Workbench tool buttons will only render after the/servicesendpoint responds; a fetch failure sets status to'failed'with no workspace buttons shown (no crash).REACT_APP_WORKBENCHLINK_LIBRARY_PREVIEWandREACT_APP_WORKBENCHLINK_DT_PREVIEWare intentionally retained — they are internal client-side routes, not workspace endpoints.Additional Information
No new npm dependencies. Zod (already a project dependency) is used for response validation in the new slice.
Checklist
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.