Repository navigation
prepare_hf_deployment.sh: make a Space public with --public, skip no-op visibility updates - #1512
Conversation
…nges `hf repo settings` fails with "At least one setting must be updated" when the Space already has the requested visibility, so redeploying a public Space with --public (or a private one with --private) uploaded fine but was reported as a failed deployment. Read the current visibility first and only call `hf repo settings` when it differs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Alignment Review Report
Automated Checks
- Lint: PASS —
.claude/hooks/lint.shneedsuv, which wasn't available in this sandbox, so I ran the equivalent tools directly:ruff format --check,ruff check, andusort checkontests/scripts/test_prepare_hf_deployment.py(the only Python file touched) all pass.prepare_hf_deployment.shisn't inlint.sh's scope (src/,tests/,envs/only) and the sandbox has noshellcheck, so the shell diff wasn't linted automatically — I reviewed it manually instead (see below). - Debug code: CLEAN —
check-debug.shonly scanssrc/; no files touched by this PR fall in that scope, and manual inspection of the diff found no prints/breakpoints/TODOs.
Open RFCs Context
All nine open RFCs (000, 001, 002, 003, 004, 005, 006, 008 — In Review; 010, 011 — Draft) are scoped to env abstractions, MCP, rewards, rubrics, harness interception, auto-validation, and catalog discovery. None reference prepare_hf_deployment.sh, hf repo settings, or Space visibility handling, and this change doesn't touch any of those areas (no Environment/EnvClient API, no MCP, no reward/transform code, no agent-facing surface).
Verification performed
- Installed
huggingface_hublocally and confirmedhf spaces info --expand=private --format jsonis a real, documented subcommand/flag combo, and that its live output format ({"id": "...", "private": false}) matches exactly what the newgrep -q '"private": *true'check and the test's fake-hfmock assume. - Ran
tests/scripts/test_prepare_hf_deployment.pydirectly: all 4 new parametrized cases (already public,already private,private→public,public→private) pass. One pre-existing, unrelated test (test_prepare_hf_deployment_keeps_the_env_description_first) fails in this sandbox only becausePYTHONPATHdoesn't includesrc//envs/— not caused by this diff. - Confirmed
$PRIVATEand the new$current_privateare both plaintrue/falsestrings compared consistently with the rest of the file's existing convention (e.g. line 775's[ "$PRIVATE" = true ]). - Confirmed the grep-based JSON parsing matches the repo's existing style: no file in this script (or elsewhere in the repo) currently uses
jqfor parsinghfoutput, so this doesn't introduce a new dependency pattern. Per thehf-cli/Hub-parity guidance inAGENTS.md/CLAUDE.md, the new call reads visibility withhf spaces info --expand=privaterather than inventing custom behavior — consistent with followinghuggingface_hub's own CLI surface.
Tier 1: Fixes Required
None identified.
Tier 2: Alignment Discussion
Principle Conflicts
None identified. This is a deployment-tooling bug fix (scripts/, not src/openenv core) and doesn't touch the Gym-like API, MCP boundary, reward computation, container isolation, or client/server separation invariants in INVARIANTS.md.
RFC Conflicts
None identified. No open RFC covers HF Space deployment/visibility handling.
Summary
- 0 mechanical issues to fix
- 0 alignment points for human review
- 0 RFC conflicts to discuss
This is a well-scoped, well-tested bug fix: it correctly diagnoses that hf repo settings rejects no-op visibility updates, fixes it by checking current state first via a real hf spaces info call (verified against live CLI output), and backs it with a parametrized regression test covering all four visibility transitions. No concerns.
Sent by Cursor Automation: Pre-review
`hf repos settings` ignores `--no-private`, so the script never made a Space public.


Found while redeploying the
openenv/*Spaces for #1296.The script sets visibility after every upload with
hf repo settings --no-private(or--private). With the currenthfCLI this has two problems:--no-privateis ignored byhf repos settings(the flag to make a repo public is--public), so the script never made a Space public. The call failed withError: Invalid value. At least one setting must be updated.and the env was reported as failed, even though the upload had gone through. This is what happened withopenenv/terminus_env, which stayed private until I ranhf repos settings --publicby hand.The script now reads the current visibility with
hf spaces info --expand=private, only callshf repos settingswhen it differs, and uses--publicto make a Space public.A new test puts a fake
hfonPATHand covers the four cases (already public, already private, private to public, public to private).PYTHONPATH=src:envs pytest tests/scripts/test_prepare_hf_deployment.pypasses (11 tests).This PR was prepared with AI assistance.
Note
Low Risk
Deployment-script-only change with new tests; no runtime app or auth logic affected.
Overview
Fixes Hugging Face Space visibility updates in
prepare_hf_deployment.shso redeploys stop failing and--publicactually works with the currenthfCLI.After upload, the script now reads the Space’s current private flag via
hf spaces info, and only runshf repos settingswhen that state differs from--public/--private. Making a Space public uses--publicinstead of the ignored--no-private, avoiding the “at least one setting must be updated” error on no-op redeploys.Adds a parametrized test with a fake
hfonPATHthat asserts settings are skipped when visibility already matches and that--public/--privateare passed only when a change is needed.Reviewed by Cursor Bugbot for commit 7991452. Bugbot is set up for automated code reviews on this repo. Configure here.