Skip to content

Feat/zndraw cli refactor#870

Open
PythonFZ wants to merge 37 commits intomainfrom
feat/zndraw-cli-refactor
Open

Feat/zndraw cli refactor#870
PythonFZ wants to merge 37 commits intomainfrom
feat/zndraw-cli-refactor

Conversation

@PythonFZ
Copy link
Member

@PythonFZ PythonFZ commented Mar 6, 2026

No description provided.

PythonFZ and others added 30 commits March 6, 2026 11:11
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix Dockerfile env vars (ZNDRAW_HOST instead of ZNDRAW_SERVER_HOST,
  remove compose-level vars from image)
- Consolidate ethanol.xyz into docker/templates/ with symlinks
- Standalone: add dedicated taskiq-worker container, use LMDB storage
- Production: add MongoDB, dedicated taskiq-worker, composable CLI
  template loading (replaces load_template.py script)
- Delete docker/production/load_template.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace per-session ephemeral Redis settings with per-room persistent
SQL scene objects (lights, fog, pathtracing, property inspector).

Backend:
- Add LightPosition, DirectionalLight, AmbientLight, HemisphereLight
- Add Fog, PathTracing, PropertyInspector geometry models
- Initialize default scene objects in room creation
- Remove settings.py, session_settings endpoints, and Redis TTL cleanup
- Remove fog fields from Floor (now standalone Fog geometry)

Frontend:
- Add Lights.tsx, Fog.tsx scene object renderers
- Add LightPositionRenderer for Fixed/Camera toggle UI
- Wire 'i' key to toggle PropertyInspector geometry active field
- Remove useSettings, SettingsPanel, SceneLighting, room-config types
- Remove showInfoBoxes Zustand state (replaced by geometry active)
- Add overflow:auto to sidebar panel to respect progress bar height
- Register LightPositionRenderer in jsonforms custom renderers
- Replace deploy.replicas with named services (zndraw-1/2/3) using YAML
  anchors for proper nginx ip_hash sticky sessions
- Add PostgreSQL + db-init container to production compose; gate DB writes
  with ZNDRAW_INIT_DB_ON_STARTUP=false to avoid unique_job constraint
  violations when replicas start concurrently
- Call ensure_internal_jobs() in init_database() so db-init seeds Job rows
  once; replicas only register broker tasks (no DB writes)
- Bump asebytes>=0.3.0a3, zndraw-joblib>=0.1.4, add asyncpg dependency
- Centralize REDIS_URL and WORKER_ENABLED in .env template
- Add auth login to template-loader for both standalone and production

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Caddy's dynamic DNS upstream discovery resolves all replica IPs from
Docker's internal DNS on each request, allowing clean deploy.replicas: 3
instead of named services with YAML anchors. Removes 84-line nginx.conf
in favor of a 16-line Caddyfile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
22 molecular structures from ASE's S22 benchmark set instead of a
single ethanol frame.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add CircleCurve geometry — a parametric circle/ellipse path for camera
orbits. Supports percentage-based angles, 3D rotation via Euler angles,
and XY scale for elliptical shapes. Includes scipy dependency for
Rotation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change curveRefs from CatmullRomCurve3 to Curve<Vector3>
- Update resolvePosition to accept CircleCurve geometry type

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Renders parametric circle/ellipse via THREE.EllipseCurve + drei Line.
Registers custom EllipseCurve3D in store for CurveAttachment resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ve attachments

Change CircleCurve position/rotation/scale from Vec3 to list[Vec3] with
a length-1 validator so the editing system (useGeometryEditing) works
out of the box. Add Vec3Renderer for the properties panel to display
x-custom-type: "vec3" fields as 3 number inputs. Allow Curve/CircleCurve
with active=false to stay mounted so CurveAttachment resolution still
works. Update Camera geometry filter to accept CircleCurve as attachment
target.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove redundant `height` field from Floor — position Y component now
controls vertical placement. Sync camera `up` vector in
useGeometryCameraSync so R-key rotation persists to the backend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Vec3Renderer now supports both nested [[x,y,z]] (list[Vec3]) and flat
[x,y,z] (tuple) formats, writing back in the same shape it received.
Add x-custom-type vec3 to Camera.up so it renders as three inputs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make ZnDraw client REST-only by default — socket connects lazily only
when mount/jobs/wait is needed. Remove presence_sid Redis TTL keys
(heartbeat mechanism), deriving frontend presence from the camera hash
instead. Validate active-camera switches against room_cameras.

- Remove presence_sid, heartbeat handler, Heartbeat models, presence_ttl
- Rewrite VerifiedSessionDep to verify via session's own camera (SID match)
- Add hexists validation to set_active_camera (target must exist)
- Lazy socket: __post_init__ is REST-only, _ensure_socket_connected() gates
  mount/register_job/register_provider/wait/jobs property
- Remove auto_connect field, __len__ queries server when socket not connected
- Remove frontend heartbeat emission
- Update all affected tests (788 pass, 0 new regressions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…o ZnDraw

Extract accessor classes (Bookmarks, ChatMessages, Extensions, Figures,
Geometries, Screenshots, Selections, SelectionGroups, Sessions, Tasks)
from client.py into accessors.py implementing collections.abc interfaces.

Add APIManager methods for rooms listing, chat, screenshots, extensions,
and tasks. Add ZnDraw.token field for direct JWT auth, classmethods
(list_rooms, login), and properties (locked, chat, extensions, tasks).

Migrate all 15 CLI command modules from Connection class to ZnDraw/
get_zndraw() with cli_error_handler() for RFC 9457 error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vis.run() now accepts either a fully-qualified extension name string
(pure REST, no socket needed) or an Extension instance (existing path).
Simplify Extensions accessor to return raw dicts instead of dynamic
pydantic classes via create_model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Make url optional (str | None = None) on ZnDraw(), list_rooms(), and
  login() with PID file auto-discovery via find_running_server()
- Harden cli_error_handler() to catch KeyError, PermissionError,
  ValueError, ZnDrawError, and RoomLockedError from raise_for_status()
- Add uv run prefix to all CLI examples in SKILL.md, add molecule
  recipe to task mapping, add bare-CLI warning to common mistakes
- Add 6 CLI extension tests and 7 auto-discovery tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Slim `geometries list` to compact summary (key/type/active/owner) instead
of dumping full data blobs + schemas. Add `geometries types` and
`geometries describe <Type>` for local geometry type discovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PythonFZ PythonFZ force-pushed the feat/zndraw-cli-refactor branch from e8a426c to 0302b17 Compare March 6, 2026 10:11
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

Important

Review skipped

Too many files!

This PR contains 163 files, which is 13 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5063d75d-4a6c-4390-aa30-f96db45d0001

📥 Commits

Reviewing files that changed from the base of the PR and between 3b9f5e1 and 0dd33c5.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (163)
  • .gitignore
  • Dockerfile
  • docker/production/.env
  • docker/production/Caddyfile
  • docker/production/docker-compose.yaml
  • docker/production/ethanol.xyz
  • docker/production/load_template.py
  • docker/production/nginx.conf
  • docker/production/s22.xyz
  • docker/standalone/.env
  • docker/standalone/docker-compose.yaml
  • docker/standalone/ethanol.xyz
  • docker/standalone/s22.xyz
  • docker/templates/.env
  • docker/templates/s22.xyz
  • docs/source/python-api.rst
  • frontend/e2e/docs-screenshots.spec.ts
  • frontend/e2e/geometry-drawing.spec.ts
  • frontend/src/App.tsx
  • frontend/src/components/Canvas.tsx
  • frontend/src/components/PathTracingRenderer.tsx
  • frontend/src/components/PathtracingUpdater.tsx
  • frontend/src/components/SceneLighting.tsx
  • frontend/src/components/SettingsPanel.tsx
  • frontend/src/components/SideBar.tsx
  • frontend/src/components/jsonforms-renderers/LightPositionRenderer.tsx
  • frontend/src/components/jsonforms-renderers/Vec3Renderer.tsx
  • frontend/src/components/three/Camera.tsx
  • frontend/src/components/three/CircleCurve.tsx
  • frontend/src/components/three/Curve.tsx
  • frontend/src/components/three/Floor.tsx
  • frontend/src/components/three/Fog.tsx
  • frontend/src/components/three/HoverInfoBox.tsx
  • frontend/src/components/three/KeyboardShortcutsHandler.tsx
  • frontend/src/components/three/Lights.tsx
  • frontend/src/components/three/ScreenshotProvider.tsx
  • frontend/src/components/three/StaticInfoBox.tsx
  • frontend/src/hooks/useGeometryCameraSync.ts
  • frontend/src/hooks/usePropertyInspectorSettings.ts
  • frontend/src/hooks/useSettings.ts
  • frontend/src/hooks/useSocketManager.ts
  • frontend/src/myapi/client.ts
  • frontend/src/pages/cliLoginApprove.tsx
  • frontend/src/pages/templateSelection.tsx
  • frontend/src/stores/slices/sceneSlice.ts
  • frontend/src/stores/slices/uiSlice.ts
  • frontend/src/types/room-config.ts
  • frontend/src/utils/cameraUtils.ts
  • frontend/src/utils/jsonforms.ts
  • pyproject.toml
  • skills-lock.json
  • skills/zndraw/SKILL.md
  • src/zndraw/__init__.py
  • src/zndraw/accessors.py
  • src/zndraw/app.py
  • src/zndraw/broker.py
  • src/zndraw/cli_agent/__init__.py
  • src/zndraw/cli_agent/admin.py
  • src/zndraw/cli_agent/auth.py
  • src/zndraw/cli_agent/bookmarks.py
  • src/zndraw/cli_agent/chat.py
  • src/zndraw/cli_agent/connection.py
  • src/zndraw/cli_agent/extensions.py
  • src/zndraw/cli_agent/figures.py
  • src/zndraw/cli_agent/frames.py
  • src/zndraw/cli_agent/geometries.py
  • src/zndraw/cli_agent/gif.py
  • src/zndraw/cli_agent/jobs.py
  • src/zndraw/cli_agent/mount.py
  • src/zndraw/cli_agent/presets.py
  • src/zndraw/cli_agent/rooms.py
  • src/zndraw/cli_agent/screenshots.py
  • src/zndraw/cli_agent/selection.py
  • src/zndraw/cli_agent/selection_groups.py
  • src/zndraw/cli_agent/sessions.py
  • src/zndraw/cli_agent/step.py
  • src/zndraw/client.py
  • src/zndraw/config.py
  • src/zndraw/database.py
  • src/zndraw/dependencies.py
  • src/zndraw/enrichment.py
  • src/zndraw/exceptions.py
  • src/zndraw/extensions/__init__.py
  • src/zndraw/extensions/molecule_building.py
  • src/zndraw/geometries/__init__.py
  • src/zndraw/geometries/camera.py
  • src/zndraw/geometries/circle_curve.py
  • src/zndraw/geometries/floor.py
  • src/zndraw/geometries/fog.py
  • src/zndraw/geometries/lights.py
  • src/zndraw/geometries/pathtracing.py
  • src/zndraw/geometries/property_inspector.py
  • src/zndraw/models.py
  • src/zndraw/presets/__init__.py
  • src/zndraw/presets/flat.json
  • src/zndraw/presets/glossy.json
  • src/zndraw/presets/matt.json
  • src/zndraw/presets/pathtracing.json
  • src/zndraw/redis.py
  • src/zndraw/result_backends.py
  • src/zndraw/routes/admin.py
  • src/zndraw/routes/auth.py
  • src/zndraw/routes/frames.py
  • src/zndraw/routes/geometries.py
  • src/zndraw/routes/presets.py
  • src/zndraw/routes/rooms.py
  • src/zndraw/routes/screenshots.py
  • src/zndraw/routes/utility.py
  • src/zndraw/schemas.py
  • src/zndraw/server_manager.py
  • src/zndraw/settings.py
  • src/zndraw/socket_events.py
  • src/zndraw/socketio.py
  • src/zndraw/storage/__init__.py
  • src/zndraw/storage/asebytes_backend.py
  • src/zndraw/storage/base.py
  • src/zndraw/storage/lmdb.py
  • src/zndraw/storage/memory.py
  • src/zndraw/storage/router.py
  • tests/conftest.py
  • tests/test_accessor_presets.py
  • tests/test_circle_curve.py
  • tests/test_cli_admin.py
  • tests/test_cli_agent/conftest.py
  • tests/test_cli_agent/test_auth.py
  • tests/test_cli_agent/test_bookmarks.py
  • tests/test_cli_agent/test_bug_fixes.py
  • tests/test_cli_agent/test_chat.py
  • tests/test_cli_agent/test_extensions.py
  • tests/test_cli_agent/test_frames.py
  • tests/test_cli_agent/test_geometries.py
  • tests/test_cli_agent/test_room_envvar.py
  • tests/test_cli_agent/test_rooms.py
  • tests/test_cli_agent/test_selection.py
  • tests/test_cli_agent/test_step.py
  • tests/test_cli_auth.py
  • tests/test_client.py
  • tests/test_client_api.py
  • tests/test_client_token_discovery.py
  • tests/test_config.py
  • tests/test_constraints.py
  • tests/test_frames_provider_dispatch.py
  • tests/test_gif.py
  • tests/test_lifespan.py
  • tests/test_redis.py
  • tests/test_resolve_token.py
  • tests/test_result_backends.py
  • tests/test_routes_frames.py
  • tests/test_routes_presets.py
  • tests/test_routes_step.py
  • tests/test_screenshots.py
  • tests/test_sessions.py
  • tests/test_socket_commands.py
  • tests/test_socketio_rooms.py
  • tests/test_storage_asebytes.py
  • tests/test_storage_base.py
  • tests/test_storage_lmdb.py
  • tests/test_storage_memory.py
  • tests/test_storage_router.py
  • tests/test_template_room_isolation.py
  • tests/test_token_store.py
  • tests/test_trajectory.py
  • tests/worker/test_internal.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/zndraw-cli-refactor

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.

@codecov-commenter
Copy link

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

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.

2 participants