Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Dec 1, 2025

Fixes #7317

  • add file limit when displaying the workspace (1000 files)
  • show a warning when we go over the limit
  • more performant file detection by only reading the first 500b header

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Dec 1, 2025 9:44pm

@github-actions github-actions bot added the bash-focus Area to focus on during release bug bash label Dec 1, 2025
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Breaking changes detected in the OpenAPI specification!

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 enhances workspace file scanning with performance optimizations and user experience improvements. It addresses issue #7317 by implementing a file limit (1000 files), displaying a warning when the limit is exceeded, and optimizing file detection to read only the first 512 bytes of files for faster scanning.

Key Changes

  • Added MAX_FILES constant (1000) to limit workspace file scanning and prevent performance degradation in large workspaces
  • Implemented header-based file detection that reads only the first 512 bytes for most files, with full file reading only for Python files containing PEP 723 script headers
  • Added hasMore and fileCount fields to WorkspaceFilesResponse to communicate limit status to the frontend
  • Introduced async file scanning using asyncio.to_thread() to prevent blocking the server during workspace scans

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
marimo/_server/file_router.py Core changes: extracted is_marimo_app() function with optimized header-based detection, added count_files() helper, implemented MAX_FILES limit enforcement with file counting and early termination, expanded skip_dirs set with additional common directories
marimo/_server/models/home.py Added has_more and file_count fields to WorkspaceFilesResponse model with default values
marimo/_server/api/endpoints/home.py Updated workspace_files endpoint to use async file scanning, calculate file count, and populate new response fields
marimo/_utils/marimo_path.py Added read_bytes() method to MarimoPath for binary file reading
frontend/src/components/pages/home-page.tsx Added warning banner that displays when file limit is reached
packages/openapi/api.yaml Updated WorkspaceFilesResponse schema with new fileCount and hasMore fields
packages/openapi/src/api.ts Updated TypeScript interfaces to reflect API schema changes
tests/_utils/test_marimo_path.py Added test coverage for new read_bytes() method
tests/_server/test_file_router.py Added comprehensive tests for is_marimo_app() function, MAX_FILES enforcement, skip_dirs behavior, and count_files() helper
tests/_server/api/endpoints/test_home.py Added assertions to verify new response fields are present and correct
pixi.lock Version bump from 0.18.0 to 0.18.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mscolnick mscolnick changed the title improvement: add file limit, warning, and more performant file detction improvement: add file limit, warning, and more performant file detection Dec 2, 2025
@Light2Dark Light2Dark added api-change enhancement New feature or request labels Dec 3, 2025
@mscolnick mscolnick merged commit 4062b0f into main Dec 4, 2025
49 of 52 checks passed
@mscolnick mscolnick deleted the ms/home-page-file-limit branch December 4, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bash-focus Area to focus on during release bug bash enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace view - Request timed out

3 participants