[PR #714] Escape generated build environment metadata #727

Open
opened 2026-10-27 21:05:40 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepEP/pull/714
Author: @Mr-Neutr0n
Created: 8/3/2026
Status: 🔄 Open

Base: main ← Head: fix/persistent-env-escaping


📝 Commits (2)

  • 91297ea Escape persistent environment build metadata
  • 76da8b2 Reuse generated environment output directory

📊 Changes

2 files changed (+50 additions, -6 deletions)

View changed files

📝 setup.py (+12 -6)
➕ tests/utils/test_setup_helpers.py (+38 -0)

📄 Description

Problem

CustomBuildPy interpolates persistent environment values directly into single-quoted Python literals when generating deep_ep/envs.py. A valid cache path containing an apostrophe produces invalid Python, while backslashes can silently change the stored value.

Fix

Extract the source renderer and use Python repr for both environment names and values. Only the existing persistent-environment allowlist is emitted.

Regression coverage

The host-only tests compile and execute the generated source, then verify exact round trips for apostrophes, backslashes, and spaces. They also verify that unrelated environment values are ignored.

Validation

  • python -m unittest tests.utils.test_setup_helpers (2 passed)
  • ruff check tests/utils/test_setup_helpers.py
  • Python compilation and git diff --check

Prepared with OpenAI Codex assistance; I reproduced the invalid generated source and reviewed the serialized output.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepEP/pull/714 **Author:** [@Mr-Neutr0n](https://github.com/Mr-Neutr0n) **Created:** 8/3/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/persistent-env-escaping` --- ### 📝 Commits (2) - [`91297ea`](https://github.com/deepseek-ai/DeepEP/commit/91297eaf76f40b0162d5d4333b2c5621de5f6366) Escape persistent environment build metadata - [`76da8b2`](https://github.com/deepseek-ai/DeepEP/commit/76da8b2118ec2dd2643563883c8034fe136d87e0) Reuse generated environment output directory ### 📊 Changes **2 files changed** (+50 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+12 -6) ➕ `tests/utils/test_setup_helpers.py` (+38 -0) </details> ### 📄 Description ## Problem `CustomBuildPy` interpolates persistent environment values directly into single-quoted Python literals when generating `deep_ep/envs.py`. A valid cache path containing an apostrophe produces invalid Python, while backslashes can silently change the stored value. ## Fix Extract the source renderer and use Python `repr` for both environment names and values. Only the existing persistent-environment allowlist is emitted. ## Regression coverage The host-only tests compile and execute the generated source, then verify exact round trips for apostrophes, backslashes, and spaces. They also verify that unrelated environment values are ignored. ## Validation - `python -m unittest tests.utils.test_setup_helpers` (2 passed) - `ruff check tests/utils/test_setup_helpers.py` - Python compilation and `git diff --check` Prepared with OpenAI Codex assistance; I reproduced the invalid generated source and reviewed the serialized output. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#727
No description provided.