Skip to content

Migrate Worker memory ownership to Strata - #2

Merged
zekageri merged 20 commits into
mainfrom
strata-migration
Sep 2, 2026
Merged

Migrate Worker memory ownership to Strata#2
zekageri merged 20 commits into
mainfrom
strata-migration

Conversation

@zekageri

@zekageri zekageri commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • bump Worker to v0.2.0 and require Strata v0.1.1
  • replace WorkerStackType with the shared Strata::MemoryPolicy / Strata::Placement vocabulary
  • add optional per-job and cleanup-task stack placement overrides with std::nullopt inheritance
  • replace Worker-specific task allocation, PSRAM capability handling, queue creation, and recursive mutex allocation with Strata FreeRTOS ownership primitives
  • route job records, registry/completion container backing, cleanup queue storage, Worker implementation ownership, and event callback ownership through Strata
  • keep Worker’s external cleanup lifecycle and add task publication/deletion handoff guards around Strata task owners
  • change result messages from owning std::string to static const char *
  • report requested placement separately from observed Strata region in job and cleanup diagnostics
  • add CI audits that prevent direct allocation / FreeRTOS creation paths from returning
  • update examples and docs, including migration mapping from Worker v0.1.0

Compatibility

This intentionally establishes a clean v0.2.0 API rather than carrying Worker-specific compatibility aliases:

  • WorkerStackType::Auto -> Strata::Placement::PreferExternal
  • WorkerStackType::Internal -> Strata::Placement::Internal
  • WorkerStackType::Psram -> Strata::Placement::RequireExternal
  • defaultStackType -> memory.taskStack
  • stackType -> optional stackPlacement
  • WorkerResult::message is now const char *

Worker remains responsible for jobs, callbacks, cooperative cancellation, sleep/wait behavior, concurrency, and cleanup orchestration. Strata now owns allocation placement and low-level task/queue/mutex storage.

Validation

Validated on PR head 28b93811524f5ff9491137931af04f28f2fb6728:

  • advisory lint: passed
  • allocation/source audit: passed
  • Arduino CLI examples: ESP32, ESP32-S3, ESP32-C3, ESP32-P4 all passed
  • PIOArduino examples: ESP32, ESP32-S3, ESP32-C3, ESP32-P4 all passed

The TaskCleanupSentinel example now compiles under PreferExternal general allocation and task-stack policies. Source audits reject direct ESP-IDF heap capabilities, raw new/delete, and direct dynamic task/queue/semaphore creation from production Worker sources.

@zekageri
zekageri merged commit 52b8447 into main Sep 2, 2026
22 checks passed
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