Add "Composing Modules" tutorial: calc_aggregator core module (#63)

* Add "Composing Modules" tutorial: calc_aggregator core module

New executable tutorial (tests/tutorial-composing-modules.test.yaml) that
builds calc_aggregator, a core (universal) module depending on calc_module,
showcasing every LogosModuleContext capability end-to-end via logoscore:

- modulePath / instanceId / instancePersistencePath getters
- durable per-instance persistence (a run counter that survives a restart),
  wired up in onContextReady()
- typed sync dependency calls (computeReport composes five calc_module calls
  into one map)
- typed async dependency call (fibonacciAsync with a callback)
- typed event subscription (onVersionReady on calc_module's versionReady)

Driven entirely from the logoscore daemon (no UI), mirroring Part 1's flow.

Also:
- README: list the tutorial and the calc_aggregator example module
- run.sh: build the module into outputs/ via --workdir (reusing the chain's
  calc_module, no rebuild) and clean its calc-data/ persistence dir
- ci.yml: run the new spec and verify its markdown generation
- outputs/: rendered tutorial + cleaned module source

The typed event subscriber requires logos-cpp-sdk PR #72 (LIDL parser: accept
reserved words as identifiers in name positions) so calc_module's versionReady
event sidecar round-trips; the doctest's event step stays red against published
deps until that lands and the module builder bumps its SDK pin.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* rerun

* Address review: warn about SDK dependency, make CI non-blocking

- prerequisites + event step: explicit toolchain note that the typed event
  subscriber needs logos-cpp-sdk#72 (calc_module's `version` event param
  collides with a reserved word), with a workaround (pin a fixed
  logos-module-builder, or skip the event step — everything else works on
  the released toolchain).
- ci.yml: split the Composing Modules spec out of the blocking UI-chain run
  into its own `continue-on-error: true` step so it doesn't block merges
  until #72 lands; a comment says to fold it back in once the dep ships.
- regenerate outputs/tutorial-composing-modules.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Re-enable Composing Modules as a blocking CI tutorial

logos-cpp-sdk#72 (LIDL parser: reserved words usable as identifiers) is merged
and logos-module-builder has bumped its SDK pin, so calc_module's versionReady
event sidecar now round-trips and the typed onVersionReady subscriber builds on
the published toolchain.

- ci.yml: fold the spec back into the blocking UI-chain run (and the published
  two-column report); drop the temporary continue-on-error step.
- spec: remove the now-obsolete toolchain prerequisite note and the event-step
  heads-up.
- regenerate outputs/tutorial-composing-modules.md.

Verified end-to-end against the published toolchain: 77/77 doctest steps pass,
including the build and the full event round-trip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dario Lipicar
2026-06-05 09:46:55 -03:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 9a75e048bf
commit c84322d50c
11 changed files with 1616 additions and 8 deletions
+12 -4
View File
@@ -55,13 +55,18 @@ jobs:
# The runner is the shared `doctest` CLI, invoked directly via its flake
# (github:logos-co/logos-doctest). The flake bundles Python + PyYAML
# (+ rich), so no pip install step is needed.
- name: Test - QML UI App (includes C Library tutorial via requires)
- name: Test - UI chain + Composing Modules (C Library tutorial pulled in via requires)
run: |
# --continue-on-fail so the run walks the whole Part 1 -> 2 -> 3 chain
# and the published report is complete. The job still fails (non-zero
# exit) if any step failed; this only changes whether we stop early.
# Two leaves, run back-to-back into one report:
# - tutorial-cpp-ui-app: the Part 1 -> 2 -> 3 chain (requires:)
# - tutorial-composing-modules: the calc_aggregator core module
# (requires Part 1 only)
# --continue-on-fail so the run walks every step and the published
# report is complete. The job still fails (non-zero exit) if any step
# failed; this only changes whether we stop early.
nix run github:logos-co/logos-doctest -- run \
tests/tutorial-cpp-ui-app.test.yaml \
tests/tutorial-composing-modules.test.yaml \
--verbose \
--continue-on-fail \
--report "${{ runner.temp }}/tutorial-report.html"
@@ -94,6 +99,9 @@ jobs:
nix run github:logos-co/logos-doctest -- generate \
tests/tutorial-qml-ui-app.test.yaml \
-o /tmp/gen-part2.md
nix run github:logos-co/logos-doctest -- generate \
tests/tutorial-composing-modules.test.yaml \
-o /tmp/gen-composing.md
echo "Generated markdown successfully"
publish-report: