Skip to content

docs: add sandboxing API proposal#1171

Open
tiran wants to merge 1 commit into
python-wheel-build:mainfrom
tiran:proposal-sandbox-api
Open

docs: add sandboxing API proposal#1171
tiran wants to merge 1 commit into
python-wheel-build:mainfrom
tiran:proposal-sandbox-api

Conversation

@tiran
Copy link
Copy Markdown
Collaborator

@tiran tiran commented May 27, 2026

Pull Request Description

What

Proposal for a pluggable sandboxing API that lets users configure custom sandboxing solutions for build process confinement.

Why

#1019

@tiran tiran requested a review from a team as a code owner May 27, 2026 09:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a design proposal for a pluggable sandboxing API (docs/proposals/sandboxing-api.md), a typed Python API contract module with sandbox lifecycle and execution hooks (docs/proposals/sandboxing_api.py), and updates the spelling wordlist with sandboxing-related terms.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a sandboxing API proposal document.
Description check ✅ Passed The description clearly relates to the changeset, explaining the purpose of the sandboxing API proposal and referencing the associated issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tiran
Copy link
Copy Markdown
Collaborator Author

tiran commented May 27, 2026

@pavank63 Here is is my proposal. I have listed you as a co-author. Part of the document are based on your previous proposal and research.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/proposals/sandboxing_api.py (1)

12-73: ⚡ Quick win

Add Sphinx version directives to the new public hook docstrings.

These are user-facing API additions, so include .. versionadded:: (or .. versionchanged:: where applicable) in each public function docstring.

Suggested pattern
 def setup_sandbox(
@@
 ) -> None:
     """Set up sandboxing
+
+    .. versionadded:: <release>
 
     Executed after `prepare_source` hook. Can be used to set up sandbox or chown/chmod the sdist_root_dir.
     """

As per coding guidelines **/*.{rst,py}: Use Sphinx versionadded, versionremoved, versionchanged directives for user-facing changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/proposals/sandboxing_api.py` around lines 12 - 73, Add Sphinx version
directive lines to each public hook docstring: update setup_sandbox,
teardown_sandbox, run_sandboxed, and run_unconfined to include a "..
versionadded:: <release>" (or ".. versionchanged:: <release>" if appropriate)
entry immediately after the short description/summary in each docstring; use the
correct release version token for this change and keep the directive formatting
consistent with other public API docstrings in the repo.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/proposals/sandboxing_api.py`:
- Line 47: The cwd parameter in run_sandboxed and run_unconfined is currently
typed as os.PathLike[str] | os.PathLike[bytes] | None which excludes plain str
and bytes accepted by subprocess.run; update the type annotation for cwd in both
functions to include str and bytes (e.g., os.PathLike[str] | os.PathLike[bytes]
| str | bytes | None) so it matches subprocess.run’s signature and adjust any
imports/typing as needed.

---

Nitpick comments:
In `@docs/proposals/sandboxing_api.py`:
- Around line 12-73: Add Sphinx version directive lines to each public hook
docstring: update setup_sandbox, teardown_sandbox, run_sandboxed, and
run_unconfined to include a ".. versionadded:: <release>" (or "..
versionchanged:: <release>" if appropriate) entry immediately after the short
description/summary in each docstring; use the correct release version token for
this change and keep the directive formatting consistent with other public API
docstrings in the repo.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fc037f41-cfbf-4ae6-a79b-9cba905dc67b

📥 Commits

Reviewing files that changed from the base of the PR and between b10d2e4 and cf3fcdb.

📒 Files selected for processing (3)
  • docs/proposals/sandboxing-api.md
  • docs/proposals/sandboxing_api.py
  • docs/spelling_wordlist.txt

Comment thread docs/proposals/sandboxing_api.py Outdated
Proposal for a pluggable sandboxing API that lets users configure
custom sandboxing solutions for build process confinement.

Co-Authored-By: Pavan Kalyan Reddy Cherupally <pcherupa@redhat.com>
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran force-pushed the proposal-sandbox-api branch from cf3fcdb to 159b672 Compare May 28, 2026 08:18
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/proposals/sandboxing-api.md`:
- Around line 58-60: The proposal currently contradicts itself about the
run_unconfined hook by describing it for monitoring/policy but only adding
WorkContext.run_unconfined and omitting BuildEnvironment.run_unconfined; clarify
the API contract by either (A) adding run_unconfined to BuildEnvironment as well
(or documenting a clear delegation from BuildEnvironment to WorkContext) so
build-step code has a defined call path, or (B) explicitly state that unconfined
execution is only permitted via WorkContext.run_unconfined (and remove any
mentions implying BuildEnvironment exposure); update the rationale text and any
instances around the run_unconfined mentions (including the other affected
paragraphs) to match the chosen design and ensure there is a single unambiguous
call-site for unconfined execution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 45703514-441f-438b-8c55-b868dd5f9d7e

📥 Commits

Reviewing files that changed from the base of the PR and between cf3fcdb and 159b672.

📒 Files selected for processing (3)
  • docs/proposals/sandboxing-api.md
  • docs/proposals/sandboxing_api.py
  • docs/spelling_wordlist.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/proposals/sandboxing_api.py

Comment on lines +58 to +60
The `run_unconfined` hook is included so users can monitor and police
unconfined calls.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Clarify the run_unconfined access path to avoid an API contract contradiction.

The proposal says run_unconfined is included for policy/monitoring, but later omits BuildEnvironment.run_unconfined while adding WorkContext.run_unconfined. That leaves an ambiguous call path for build-step code and weakens the stated rationale. Please explicitly define whether unconfined execution is allowed only at WorkContext level (and never in BuildEnvironment) or defer the hook entirely until a concrete call site exists.

Also applies to: 101-109

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/proposals/sandboxing-api.md` around lines 58 - 60, The proposal
currently contradicts itself about the run_unconfined hook by describing it for
monitoring/policy but only adding WorkContext.run_unconfined and omitting
BuildEnvironment.run_unconfined; clarify the API contract by either (A) adding
run_unconfined to BuildEnvironment as well (or documenting a clear delegation
from BuildEnvironment to WorkContext) so build-step code has a defined call
path, or (B) explicitly state that unconfined execution is only permitted via
WorkContext.run_unconfined (and remove any mentions implying BuildEnvironment
exposure); update the rationale text and any instances around the run_unconfined
mentions (including the other affected paragraphs) to match the chosen design
and ensure there is a single unambiguous call-site for unconfined execution.

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.

1 participant