Skip to content

[Do Not Merge] V3 - #283

Draft
timkpaine wants to merge 17 commits into
mainfrom
v3
Draft

[Do Not Merge] V3#283
timkpaine wants to merge 17 commits into
mainfrom
v3

Conversation

@timkpaine

Copy link
Copy Markdown
Member
  • State rework
  • Stage
  • UI framework

timkpaine added 11 commits May 22, 2026 11:56
… and UI APIs

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>

# Conflicts:
#	csp_gateway/server/gateway/csp/channels.py
#	csp_gateway/server/web/app.py
#	csp_gateway/server/web/routes/state.py
- Resolve dotted attribute paths in DefaultState/DuckDBState insert so keyby can reference nested struct members (e.g. keyby='sub.id')

- Make --junitxml explicit in Makefile and switch upload-artifact/publish paths to 'junit.xml' so CI test results are reported (previously '**/junit.xml' produced 0 tests in the PR comment)

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
…_channels

- channels.py: docstring referenced old set_state(edge, alias, keyby, indexer) signature; correct it to set_state(field_or_edge, keyby, indexer=None)

- module.py: drop dynamic_state_channels() — no longer consumed by Gateway after the state rework. State on dynamic channels is now wired via channels.set_state() inside Module.connect, which is exercised by test_dynamic_channels

- test_gateway.py: drop the matching dynamic_state_channels override; suite still passes (482 server tests)

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
…pendent

The prior commit (fbf0d46) wrongly removed Module.dynamic_state_channels() under the assumption it was dead code. It actually serves a real purpose: it lets a module declare which of its dynamic_channels will have state, so that *other* modules' connect() may call get_state() on that name regardless of the order in which modules are connected.

This commit restores the API and fixes the underlying order dependence using the same DelayedEdge pattern already used for channel data:

- module.py: re-add dynamic_state_channels() -> Optional[Set[str]] on the Module ABC, with docstring describing the order-independence guarantee.

- channels.py:

  * Add _pending_state_element_types: Dict[str, type] and _delayed_state_edges: Dict[(field, indexer), DelayedEdge] private attrs.

  * Add _declare_dynamic_state(field, element_type) to pre-register a state name with its element type.

  * get_state: if the field is pre-declared but not yet wired, return a DelayedEdge of ts[State[T]] (lazily created and cached).

  * _wire_state_edge: if a DelayedEdge was previously handed out for (field, indexer), bind it to the freshly-built state node so consumers' edges resolve transparently.

  * set_state: clear the pending entry once the owning module wires the state for real.

- factory.py: in ChannelsFactory.build(), before invoking each module's connect(), walk all enabled modules and call channels._declare_dynamic_state(name, T) for every name returned by Module.dynamic_state_channels() (T is unwrapped from List[T] when applicable). This guarantees ordering independence between get_state and set_state across modules.

- test_gateway.py:

  * Re-add the dynamic_state_channels() override on MySetModuleDynamicChannels.

  * Add parametrized test_dynamic_channels_state_module_order_independence covering both [setter, getter] and [getter, setter] module orderings; both pass via DelayedEdge binding.

Server suite: 484 passed, 7 skipped, 1 xfailed (was 482; +2 for the new order test).

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
rework state to remove annoyances and inconsistensies, prep for Stage and UI APIs
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Test Results

787 tests  +41   778 ✅ +40   7m 47s ⏱️ +13s
  1 suites ± 0     9 💤 + 1 
  1 files   ± 0     0 ❌ ± 0 

Results for commit ebc60e3. ± Comparison against base commit 22a1587.

This pull request removes 1 and adds 42 tests. Note that renamed tests count towards both.
csp_gateway.tests.server.gateway.csp.test_state ‑ test_get_keyby_value_paths
csp_gateway.tests.config.test_load ‑ test_spaday_demo_configs_load
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_none_empty_list_creates_empty
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_none_none_creates_empty
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_none_with_ids_errors
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_nonexistent_id_errors
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_struct_empty_list_adds_to_all
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_struct_none_creates_or_appends
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_add_struct_specific_ids
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_list
csp_gateway.tests.server.gateway.csp.test_stage.TestStageManager ‑ test_stage_list_specific
…

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.81971% with 596 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.98%. Comparing base (22a1587) to head (ebc60e3).

Files with missing lines Patch % Lines
csp_gateway/server/web/spaday_ui.py 0.00% 238 Missing ⚠️
csp_gateway/tests/server/web/test_spaday_ui.py 6.92% 121 Missing ⚠️
csp_gateway/client/client.py 24.13% 88 Missing ⚠️
csp_gateway/server/gateway/csp/channels.py 79.69% 40 Missing ⚠️
csp_gateway/server/modules/web/send_form.py 22.91% 37 Missing ⚠️
csp_gateway/server/web/routes/stage.py 78.82% 18 Missing ⚠️
csp_gateway/server/gateway/csp/stage.py 91.09% 13 Missing ⚠️
csp_gateway/server/web/app.py 68.57% 11 Missing ⚠️
csp_gateway/tests/server/gateway/csp/test_stage.py 97.36% 9 Missing ⚠️
csp_gateway/server/modules/web/perspective.py 12.50% 7 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #283      +/-   ##
==========================================
- Coverage   88.35%   85.98%   -2.38%     
==========================================
  Files         144      151       +7     
  Lines       15658    17094    +1436     
  Branches     1475     1649     +174     
==========================================
+ Hits        13835    14698     +863     
- Misses       1823     2396     +573     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

timkpaine added 6 commits June 2, 2026 18:19
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>

# Conflicts:
#	csp_gateway/client/client.py
#	csp_gateway/server/gateway/csp/channels.py
#	csp_gateway/server/gateway/csp/factory.py
#	csp_gateway/server/gateway/csp/module.py
#	csp_gateway/server/gateway/csp/state.py
#	csp_gateway/server/gateway/gateway.py
#	csp_gateway/server/modules/web/mount.py
#	csp_gateway/server/web/routes/state.py
#	csp_gateway/testing/shared_helpful_classes.py
#	csp_gateway/tests/server/gateway/csp/test_channels.py
#	csp_gateway/tests/server/gateway/test_gateway.py
#	csp_gateway/tests/server/modules/io/test_json.py
#	csp_gateway/tests/server/modules/logging/test_printing.py
#	csp_gateway/tests/server/web/test_webserver.py
#	docs/wiki/API.md
Adds an optional spaday-based frontend alongside the built-in Perspective/React
UI, selected per gateway via Settings.UI_PROVIDER == "spaday" (default stays
"default"); nothing changes unless opted in.

- New ui(self, app: GatewayUI) module hook (mirrors rest()), invoked during web
  build only when the spaday provider is active.
- GatewayUI collects module contributions into named shell regions and mounts a
  single spaday page onto the FastAPI app via spaday's AppShell; spaday is
  imported lazily (new `spaday` extra).
- Modules contribute UI: perspective (workspace + layout selector), channels_graph
  and outputs (drawer links), controls (shutdown confirm), and a presentation-only
  MountSendForm (a schema-driven send panel via spaday form() + declarative
  CallEndpoint).
- demo_spaday / omnibus_spaday configs extend the demos with the provider.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Add optional spaday-based frontend provider for the gateway UI
Brings in the GatewayStruct validator registry (#315) along with the two copier
update rounds and the state API work.

Resolved a conflict in .github/workflows/build.yaml: took main's re-indented test
job, which corrects steps that sat at four spaces while their neighbours used
six, then re-applied v3's junit upload fix from f757918 so the test job keeps
path/files at junit.xml rather than reverting to the '**/junit.xml' glob. The
build job's junit steps are new from main and are left as main has them.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
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