Skip to content

cppa-cursor-browser: Export script — fix os.environ workspace path bypass #107

Description

@clean6378-max-it

Calendar Day

Monday, June 22, 2026 (PR 2 of 2)

Planned Effort

3 story points — sprint item #4 (Medium)

Depends on: Monday PR 1 (export consolidation #3) — pass --base-dir through the shared engine rather than the soon-to-be-deleted inline orchestration.

Problem

In scripts/export.py, when --base-dir is provided the script mutates the process environment via os.environ["WORKSPACE_PATH"] and then calls resolve_workspace_path(), which reads that variable. This bypasses the thread-safety lock the web server uses to protect WORKSPACE_PATH reads. The workspace path should be passed as an explicit argument, not through global environment mutation.

Goal

One merged PR that replaces the os.environ mutation with an explicit override parameter threaded through resolve_workspace_path(), eliminating the thread-safety bypass with no change to CLI behavior.

Scope

Touch points

  • utils/workspace_path.py — add override: str | None = None to resolve_workspace_path()
  • scripts/export.py — pass --base-dir explicitly (via the shared engine) instead of mutating os.environ

Out of scope

Acceptance Criteria

  • scripts/export.py passes --base-dir as an explicit parameter to resolve_workspace_path() instead of mutating os.environ
  • The os.environ["WORKSPACE_PATH"] mutation line is removed
  • resolve_workspace_path() accepts an optional override parameter
  • Existing tests pass with the new parameter-passing mechanism
  • Thread-safety tests are not affected
  • PR approved by at least 1 reviewer

Verification

cd C:\Users\Jasen\CppAliance\cppa-cursor-browser
.\.venv\Scripts\Activate.ps1
pytest -k "workspace_path or export or thread"
python scripts/export.py --base-dir <some-workspace>

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions