Skip to content

refactor: rename sandbox_iframe directory to mcp_apps_inner_iframe#988

Merged
sugoi-yuzuru merged 1 commit intomainfrom
sandbox
Mar 26, 2026
Merged

refactor: rename sandbox_iframe directory to mcp_apps_inner_iframe#988
sugoi-yuzuru merged 1 commit intomainfrom
sandbox

Conversation

@sugoi-yuzuru
Copy link
Copy Markdown
Collaborator

@sugoi-yuzuru sugoi-yuzuru commented Mar 26, 2026

Description

Rename sandbox_iframe to mcp_apps_inner_iframe

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request renames the sandbox_iframe directory and all associated file paths and references to mcp_apps_inner_iframe across the Angular and Lit client applications. The changes include updates to .gitignore, package.json build scripts, URL construction in mcp-app.ts, shared constants in shared-constants.ts, and an alias in vite.config.ts. Feedback suggests improving URL construction in mcp-app.ts for robustness and readability, addressing naming inconsistencies by fully refactoring constants and filenames to align with the new directory name, and making the node_modules path in vite.config.ts more robust by avoiding hardcoding.

Comment on lines +152 to 155
let sandboxUrl = `${currentOrigin}/mcp_apps_inner_iframe/sandbox.html`;
if (disableSecuritySelfTest) {
sandboxUrl += '?disable_security_self_test=true';
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To make the URL construction more robust and readable, you could use the URL and URLSearchParams APIs. This avoids manual string concatenation for query parameters and handles encoding correctly.

    const url = new URL(`${currentOrigin}/mcp_apps_inner_iframe/sandbox.html`);
    if (disableSecuritySelfTest) {
      url.searchParams.set('disable_security_self_test', 'true');
    }
    const sandboxUrl = url.toString();

Comment on lines +17 to 19
export const SANDBOX_BASE_PATH = "shared/mcp_apps_inner_iframe/";
export const SANDBOX_ENTRY_NAME = `${SANDBOX_BASE_PATH}sandbox`;
export const SANDBOX_IFRAME_PATH = `/${SANDBOX_ENTRY_NAME}.html`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While the directory has been renamed to mcp_apps_inner_iframe, these constants and the files they point to (sandbox.ts, sandbox.html) still use the SANDBOX name. This creates some inconsistency. For a more complete refactoring, consider renaming the files and these constants to align with the new directory name. For example, SANDBOX_BASE_PATH could become MCP_APPS_INNER_IFRAME_BASE_PATH. This would improve clarity and consistency across the codebase. Note that this would require updating all usages of these constants and filenames.

alias: {
"@a2ui/markdown-it": resolve(__dirname, "../../../../renderers/markdown/markdown-it/dist/src/markdown.js"),
"sandbox.js": resolve(__dirname, "../../" + SANDBOX_ENTRY_NAME + ".ts"),
"@modelcontextprotocol/ext-apps/app-bridge": resolve(__dirname, "../node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This hardcoded relative path to node_modules can be brittle. If dependencies are hoisted to a root node_modules directory (common in monorepos) or the project structure changes, this path will break. A more robust approach would be to use a resolution algorithm to find the package path programmatically. For example, you could use a library like resolve for this purpose.

@sugoi-yuzuru sugoi-yuzuru merged commit bd90158 into main Mar 26, 2026
10 checks passed
@sugoi-yuzuru sugoi-yuzuru deleted the sandbox branch March 26, 2026 15:37
@github-project-automation github-project-automation bot moved this from Todo to Done in A2UI Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants