You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add S3 file download support to evaluation pipeline
Implements `params["files"]` feature to allow downloading S3 objects into a per-request working directory. Updates `evaluation.py` and security logic to enable read-only file access. Introduces `s3_files.py` for managing S3 interactions and accompanying unit tests in `s3_files_test.py`. Expands documentation in `CLAUDE.md` and adds integration tests to verify functionality.
|`s3_files.py`| Downloads `params["files"]` objects from S3 into the per-request working directory |
14
15
|`dev.py`| CLI wrapper for local manual testing |
15
16
16
17
### Evaluation pipeline (`evaluation.py`)
17
18
18
19
1. Run AST security check on student code
19
-
2. Dispatch by `params["mode"]` (required):
20
+
2. If `params["files"]` is set, download the listed S3 objects once into a per-request working directory (see `s3_files.py`), used as the subprocess `cwd` for every run in this request
21
+
3. Dispatch by `params["mode"]` (required):
20
22
-**`demo`**: execute code with no stdin; return stdout/plots as `output` feedback (no pass/fail)
21
23
-**`io_test`**: for each test in `params["tests"]`, execute with `test["input"]` as stdin and compare stdout against `test["expected_output"]`; upload matplotlib plots on pass or fail
-**Dunder attribute access**: any `__attr__` style attribute
102
119
120
+
`open`/`pathlib` are intentionally **not** blocked here — they're needed to read files loaded via `params["files"]` (see above). **Important caveat**: `preview_function` (this check) and `evaluation_function` (actual grading) are registered as two independent RPC methods in `main.py`; `evaluation.py` never calls `preview.py`. This check only powers editor-time linting feedback — it does not gate what code can do at grading time. The real, load-bearing control for file access is a runtime-injected restricted `open`/`io.open` in `evaluation.py`'s subprocess preamble (`_safe_open`), which blocks *write* access to anything inside the per-run files directory. It is not a hard sandbox boundary — since `os`/`subprocess` remain fully importable and runnable at grading time regardless of this feature, a student can bypass file restrictions entirely via `os`. Treat this as scoping the intended file-access path, not as isolation.
121
+
103
122
## Key commands
104
123
105
124
```bash
@@ -148,7 +167,8 @@ CI runs on Python 3.12 and uploads JUnit XML results (`.github/workflows/test-li
0 commit comments