Skip to content

Integrate intocps/workspace: fetch workbench links from services API, update Docker images#1484

Closed
Copilot wants to merge 3 commits intofeature/distributed-demofrom
copilot/update-build-and-test-commands
Closed

Integrate intocps/workspace: fetch workbench links from services API, update Docker images#1484
Copilot wants to merge 3 commits intofeature/distributed-demofrom
copilot/update-build-and-test-commands

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Security patch
  • UI/UX improvement

Description

Replaces mltooling/ml-workspace-minimal:0.13.2 with intocps/workspace:latest across all Docker Compose files. Removes hardcoded REACT_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}/services from the new workspace image.

New Redux slice — workbench.slice.ts

  • fetchWorkbenchServices(url): async thunk that GETs the services endpoint, validates the response with Zod, and stores results
  • setWorkbenchServices / resetWorkbench: synchronous actions for seeding/resetting state in tests
  • State: { services: Record<string, WorkbenchService>, status: 'idle' | 'loading' | 'succeeded' | 'failed' }

useWorkbenchLinkValues()envUtil.ts

Maps service keys (desktop→VNCDESKTOP, vscode→VSCODE, lab→JUPYTERLAB, notebook→JUPYTERNOTEBOOK) from Redux to KeyLinkPair[]. Preview links (LIBRARY_PREVIEW, DT_PREVIEW) remain in env vars as they point to internal client routes.

Workbench.tsx

Dispatches fetchWorkbenchServices on mount when status === '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/JUPYTERNOTEBOOK from all config files (dev.js, test.js, local.js, prod.js), env.d.ts, and configUtil.ts path keys. Added AppDispatch export to store.ts.

Testing

  • New 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)
  • Updated envUtil.test.ts: mocks Redux state with a services object; tests link construction from services and empty-services fallback
  • Updated Workbench.test.tsx (integration): pre-loads the store via setWorkbenchServices instead of setting env vars
  • Updated Config.test.tsx and global_mocks.tsx to reflect removed env vars

Impact

Breaking config change: existing env.js deployments must drop the four REACT_APP_WORKBENCHLINK_* workspace entries. Workbench tool buttons will only render after the /services endpoint responds; a fetch failure sets status to 'failed' with no workspace buttons shown (no crash).

REACT_APP_WORKBENCHLINK_LIBRARY_PREVIEW and REACT_APP_WORKBENCHLINK_DT_PREVIEW are 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

  • My code adheres to the coding and style guidelines of the project.
  • I have added tests for all the new code and any changes made to existing code.
  • I have made corresponding changes to the documentation.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…e Docker images

Co-authored-by: prasadtalasila <9206466+prasadtalasila@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build and test command issues in project Integrate intocps/workspace: fetch workbench links from services API, update Docker images Feb 22, 2026
Copilot AI requested a review from prasadtalasila February 22, 2026 12:20
@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.38%. Comparing base (c37d7eb) to head (7ba2901).

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              
Files with missing lines Coverage Δ
client/src/route/workbench/Workbench.tsx 100.00% <100.00%> (ø)
client/src/store/workbench.slice.ts 100.00% <100.00%> (ø)
client/src/util/configUtil.ts 93.65% <ø> (ø)
client/src/util/envUtil.ts 98.18% <100.00%> (+0.18%) ⬆️
Components Coverage Δ
Website 96.38% <100.00%> (+0.04%) ⬆️
Lib Microservice ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@prasadtalasila prasadtalasila marked this pull request as ready for review February 22, 2026 15:55
Copilot AI review requested due to automatic review settings February 22, 2026 15:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.2 with intocps/workspace:latest across 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>
  );

Comment on lines +19 to +28
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>;
},
);
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
if (!response.ok) {
throw new Error(`Failed to fetch services: ${response.statusText}`);
}
return (await response.json()) as Record<string, WorkbenchService>;
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@prasadtalasila
Copy link
Contributor

@atomicgamedeveloper please review this PR. Thanks.

Co-authored-by: prasadtalasila <9206466+prasadtalasila@users.noreply.github.com>
@sonarqubecloud
Copy link

Copilot AI added a commit that referenced this pull request Feb 27, 2026
…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>
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