Repository navigation
Implement durable iot-digital-twin simulator runtime - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the durable AWS integration defined by iot-digital-twin PR #22, which is merged and has passing CI. This is executable runtime code, not a reference-store/planning-only PR.
DynamoStore makes real SDK get/conditional put/transaction/update calls: consistent state reads, session/model revision validation, fenced leases/ticks, atomic epoch reset plus durable command receipt, duplicate command identity handling, and a bounded ACK claim before IoT publication. Failed or unknown reset commit cannot reach publication. Existing simulator and immutable trace rules are packaged from an exact reviewed Git revision, with all replayed trace epochs relabeled consistently.
Lambda handlers provide supervised initialization/bounded runner and trusted IoT reset processing. The runner can initialize with operation=start; reset processing validates exact session/topic/principal. No public mutation endpoint or duplicated modeling rules. Model/schema mismatch fails closed. Runtime SDK clients are lazy; unit tests inject mocked clients.
Verification: 17 existing ingestion tests and nine new runtime tests passed; nine runtime tests also passed importing the built ZIP. Ruff 0.11.13 format/lint and Bandit runtime scan passed. Repeated builds produced identical ZIP SHA-256 70c95cde1b448c6daf405ff680da06c971b30ad625270524d7752e9df7168cab. New CI fetches the exact public simulator commit, tests source/package and uploads the artifact.
scripts/test_demo_integration.py is a runnable operator-only integration against an EXISTING sandbox PK/SK table. It verifies artifact digest/provenance, STS account, sandbox tag and schema before isolated session writes. It tests actual DynamoDB conditions/transactions and records the generated ACK locally, without MQTT. Without the separate execution flag it exited 2 before SDK import or AWS calls. It was NOT executed against real AWS: exact target and write approval remain prerequisites. Session rows are retained for approved cleanup.
Companion Terraform code is prepared in aws-iac branch feature/iot-demo-runtime-wiring. aws-config declaration/artifact/principal/session/account bindings remain unresolved; no publication or apply is authorized by this PR. Read the runtime README for invocation contract and limits.
Remaining: no AWS-hosted dashboard adapter, device subscription/ACK/LED execution, automatic restart, or runner pending-ACK dispatcher. Reset retries/supervised same-command redelivery handle ACK recovery within the durable budget; live SDK timing/clock margins require integration verification. No claim of production readiness or successful 60-second cloud demonstration.
Refs usekarma/iot-digital-twin#17. No cloud resources, IAM/device policy changes, artifact upload, MQTT operation, flash, deployment or merge performed. Original sibling workspaces and their untracked work are preserved.
Companion Terraform implementation: usekarma/aws-iac#16
Coordinated naming update
Naming revision verified: deployment component/source directory and ZIP basename are
iot-digital-twin-simulator; Project=iot-digital-twin, Experiment=atom-lite-simulator. Runtime and existing tests are byte-for-byte unchanged. All 26 source tests, nine packaged-ZIP tests, Ruff lint/format and Bandit passed. ZIP SHA-256 remains70c95cde1b448c6daf405ff680da06c971b30ad625270524d7752e9df7168cab. No live DynamoDB test or AWS/device operation. Matching configuration declaration is a separate aws-config PR; unresolved sandbox/table/operator approval and binding values remain blockers.