Skip to content

Block model and dataset creation in LIT demo mode. - #2621

Merged
copybara-service[bot] merged 1 commit into
devfrom
test_989864731
Sep 29, 2026
Merged

copybara-service[bot] merged 1 commit into
devfrom
test_989864731

Conversation

@copybara-service

Copy link
Copy Markdown

Block model and dataset creation in LIT demo mode.

While LitApp disables saving and loading datapoints when demo_mode is enabled and hides model and dataset creation controls in the frontend UI, the backend /create_model and /create_dataset endpoints previously did not check self._demo_mode. Direct HTTP requests to these endpoints on a demo server could still trigger model or dataset initialization and archive downloads via file_cache.cached_path. Additionally, if archive extraction in file_cache._get_extacted_dir failed part-way through an archive, the partially populated extraction directory remained on disk and would be returned on subsequent cache lookups.

Reject /create_dataset and /create_model requests when self._demo_mode is enabled in LitApp. In file_cache._get_extacted_dir, open tar archives with a context manager and clean up the extraction directory if extraction raises an exception so partial extractions are never cached.

@google-cla

google-cla Bot commented Sep 28, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service
copybara-service Bot force-pushed the test_989864731 branch 2 times, most recently from b830363 to 53efaaa Compare September 28, 2026 22:34
While `LitApp` disables saving and loading datapoints when `demo_mode` is enabled and hides model and dataset creation controls in the frontend UI, the backend `/create_model` and `/create_dataset` endpoints previously did not check `self._demo_mode`. Direct HTTP requests to these endpoints on a demo server could still trigger model or dataset initialization and archive downloads via `file_cache.cached_path`. Additionally, if archive extraction in `file_cache._get_extacted_dir` failed part-way through an archive, the partially populated extraction directory remained on disk and would be returned on subsequent cache lookups.

Reject `/create_dataset` and `/create_model` requests when `self._demo_mode` is enabled in `LitApp`. In `file_cache._get_extacted_dir`, open tar archives with a context manager and clean up the extraction directory if extraction raises an exception so partial extractions are never cached.

PiperOrigin-RevId: 990350608
@copybara-service
copybara-service Bot merged commit 12e46be into dev Sep 29, 2026
2 of 6 checks passed
@copybara-service
copybara-service Bot deleted the test_989864731 branch September 29, 2026 16:22
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.

0 participants