Skip to content
This repository was archived by the owner on Nov 15, 2026. It is now read-only.

fix: hold only writable properties, unblock management and build off the loop (SIM-06) - #33

Merged
gavinying merged 4 commits into
v2from
sim-06-held-writable-only
Nov 12, 2026
Merged

gavinying merged 4 commits into
v2from
sim-06-held-writable-only

Conversation

@gavinying

Copy link
Copy Markdown
Collaborator

First batch of SIM-06, from a verified review of modsim 2.0.0a8.

  • Held generators. A client write re-decodes every property sharing the written cells, and all of them were recorded in held, which froze the generators of read-only aliases the client never wrote (contradicting hold stops a generator for a property after a valid client write). Only writable properties are held now. Regression test included.
  • Management lock. The control socket took the manager lock before reading the request line, so an idle connection blocked every other command (including down) for up to 5 seconds. The request is read first and the lock covers only the action.
  • Build off the event loop. RuntimeManager.apply built devices (schema validation and behavior script execution) on the event loop, stalling Modbus service for all devices. It uses asyncio.to_thread, as load_deployment already did.
  • TLS and debug. A missing certificates/pymodbus.* now reports which files are needed instead of a bare [Errno 2]; asyncio debug mode is enabled only with --log debug instead of always.
  • Docs and example. The README Compose update command used /app/examples/deployment.yaml, which the control socket rejects; it now uses /app/deployment.yaml. The Compose example no longer passes --allow-scripts (its deployment uses no scripts).

Deliberately not changed: bind: 0.0.0.0 in examples/deployment.yaml is required inside the container (Compose publishes the port to host 127.0.0.1 only), and a non-root USER needs a plan for the bind-mounted ./td export directory first.

Verification: uv run pytest passes (117 passed, 3 skipped), uv run mypy and black 24.4.2 are clean. The held, lock and thread tests fail without their fixes.

🤖 Generated with Claude Code

gavinying and others added 4 commits November 12, 2026 14:40
A write re-decodes every property sharing the written cells. Recording all of
them in held froze the generators of read-only aliases the client never wrote.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e event loop (SIM-06)

An idle control connection held the manager lock for up to 5 seconds while it
waited for a request line, delaying every other command including down. Build
validates schemas and executes behavior scripts, which stalled Modbus service
for all devices while it ran on the event loop.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…log debug (SIM-06)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…SIM-06)

The control socket only accepts the path the deployment started with, so the
README command with /app/examples/deployment.yaml was rejected. The Compose
example also no longer passes --allow-scripts: its deployment uses no scripts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gavinying
gavinying merged commit 1015b58 into v2 Nov 12, 2026
10 checks passed
@gavinying
gavinying deleted the sim-06-held-writable-only branch November 12, 2026 06:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant