Skip to content

feat(coord): step-based workflow primitive over zbus#43

Open
VicAlexandre wants to merge 3 commits into
mainfrom
feat/coordinator
Open

feat(coord): step-based workflow primitive over zbus#43
VicAlexandre wants to merge 3 commits into
mainfrom
feat/coordinator

Conversation

@VicAlexandre
Copy link
Copy Markdown
Collaborator

@VicAlexandre VicAlexandre commented May 25, 2026

Adds the zephlet_coord framework — kick/next/await/done/resolve on a shared workqueue with bounded zbus-event awaits. Gated by CONFIG_ZEPHLETS_COORD.

  • Tests: 9 ZTEST cases (tests/shared/coord/), green on native_sim.
  • Docs: README section with usage sample and public surface table.
  • Coveragezephlet_coord.c: 83% lines (75/90 covered). Uncovered lines are all error-handling paths the suite doesn't synthesize (zbus_chan_add_obs / zbus_chan_rm_obs failure logs, k_work_schedule_for_queue rollback in _await, get_chan_name fallback when CONFIG_ZBUS_CHANNEL_NAME=n). zephlet_coord.h exposes no inline functions, so nothing to instrument.

@VicAlexandre VicAlexandre requested a review from rodrigopex May 25, 2026 19:04
@VicAlexandre VicAlexandre self-assigned this May 25, 2026
struct test_ctx {
char trace[16];
int trace_len;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have one line here?

Comment thread zephlet_coord.c Outdated
async->match = match;
async->chan = chan;

zbus_chan_add_obs(chan, async->obs, K_NO_WAIT);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could not be interesting, a small timeout just to increase the reliability of the operation. You are not checking if that worked. I suggest adding the verification and adding a timeout.

Comment thread zephlet_coord.c Outdated
}

k_work_cancel_delayable(&async->timer);
zbus_chan_rm_obs(chan, async->obs, K_NO_WAIT);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Comment thread zephlet_coord.c Outdated
return;
}

zbus_chan_rm_obs(chan, async->obs, K_NO_WAIT);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Comment thread README.md Outdated
}

/* trigger source — typically a zbus listener on a flow-local channel */
if (provisioning->current == NULL) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (provisioning->current == NULL) {
if(!zephlet_coord_is_running(provisioning)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an idea of the coverage for the tests?

@rodrigopex rodrigopex added the enhancement New feature or request label May 26, 2026
@wkhadgar wkhadgar force-pushed the feat/coordinator branch from 5d83dde to 53ee33f Compare May 26, 2026 20:25
@VicAlexandre VicAlexandre requested a review from rodrigopex May 26, 2026 21:04
Adds zephlet_coord.{h,c} skeleton, Kconfig (CONFIG_ZEPHLETS_COORD), and
CMake wiring. Step + await + timeout chain, ported from loc8-catfish.
Tests and docs follow.

Signed-off-by: Victor Miranda <varm@ic.ufal.br>
Nine partition-derived cases cover kick + -EBUSY, await match, timeout,
predicate filter, dst memcpy, resolve idempotency.

Signed-off-by: Victor Miranda <varm@ic.ufal.br>
Sample, public surface table, and a one-line bullet under Architecture
at a glance.

Signed-off-by: Victor Miranda <varm@ic.ufal.br>
@VicAlexandre
Copy link
Copy Markdown
Collaborator Author

Pushed fixes and updated description with code coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants