Skip to content

Clean up the spaday UI modules and re-record the demo gif - #349

Merged
timkpaine merged 6 commits into
mainfrom
tkp/spaday-cleanup
Sep 3, 2026
Merged

Clean up the spaday UI modules and re-record the demo gif#349
timkpaine merged 6 commits into
mainfrom
tkp/spaday-cleanup

Conversation

@timkpaine

Copy link
Copy Markdown
Member

No description provided.

Copy each `server_views` entry before popping `table` off it. The dict is user
configuration and is read again at the top of `_connect_all_tables`, so a second
`connect()` raised `KeyError: 'table'`.

Move the lazy `Region` import to the top of the `ui()` hooks that had it in the
middle of the body or buried in a branch. They still have to be deferred, since
they belong to the optional spaday provider, but there is no reason to scatter
them.

Say what the eight `# separate to avoid circular` comments actually guard. The
`csp_gateway.server` package re-exports `.modules` before `.web`, so the package
is only partially initialized while these modules are imported and only the leaf
module works. Verified by merging one of them: five of six import entry points
then fail with `cannot import name 'GatewayWebApp' from partially initialized
module`.

Import `Wire` with the rest of spaday rather than inside `mount()`, and point
the spaday `ImportError` at `csp-gateway[server]`, which is the extra those
packages actually live in.

Collapse four copies of the `_bare_ui` test helper into one, and assert that
choosing a layout clears `graph_focus` to the empty string rather than merely
mentioning the field somewhere in the serialized tree.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Client-only installs legitimately omit the server dependency group, but the
broad ImportError handlers also hid failures raised inside modules that were
present. A circular import introduced in `channels_graph.py` left
`import csp_gateway` reporting success, and only surfaced later as an unrelated
`cannot import name 'MountChannelsGraph' from 'csp_gateway'`.

Suppress an ImportError only when it names a dependency of the extra being
guarded, or when it names one of our own modules that an earlier suppressed
failure left half-populated -- and that second case only while a dependency is
genuinely absent. Asking merely whether *any* optional dependency is missing
would keep swallowing real errors on every partial install, which is the case
this guard exists to make visible.

The import names are listed separately from `pyproject.toml` because several
distributions import under a different name than they are published under.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
`perspective_thread` and `get_schema_from_field` have no callers anywhere in the
package, tests, or docs. Both predate the current table setup: schemas are now
derived in `_connect_all_tables`, and the Perspective event loop is started by
`run_perspective`.

They are public names, so this is a breaking change for anyone who imported them
or overrode `get_schema_from_field` in a subclass, which is why it goes in with
the 3.0 major.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
The spaday send form reached through Channels registration state and
GatewayWebApp type helpers, coupling presentation code to two private
implementations.

Keep send-channel registration order, form model normalization, and basket
keys behind one Channels accessor so UI builders consume a documented seam
without exposing the underlying adapter mapping.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Two things made the component tree differ on every boot. Tables are registered
from a set, so `get_hosted_table_names()` came back in hash order and the
generated layout put panels in a different order each time; `_get_tables` now
sorts. And `confirm_button` derived its dialog id from `hash((label, url))`,
which is salted per process, so the id changed on every restart; it now uses a
digest.

Neither was visible as a bug, but both defeat caching and made it impossible to
diff two renders to check a change was inert. Two runs of the demo now produce
byte-identical `/tree.json`.

Lift the main region's tab assembly out of `build_page` into `_main_content`
while that check is available to prove nothing moved. `build_page` was 172 lines
covering config, chrome, drawers, tabs and layout state at once.

Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
The old recording predates the spaday frontend entirely: it shows the React UI,
the standalone dagre page, and a layout that no longer exists.

The new one walks the same ground the README claims -- workspace, Perspective's
config sidebar, the channels graph, the REST docs -- plus the two things that
are new: clicking a channel node to focus its table, and the light/dark toggle.

It is 1.8 MB rather than 7.3 MB, since identical beats collapse to one frame
with a longer duration instead of repeating.

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

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Test Results

880 tests  +3   870 ✅ +3   7m 1s ⏱️ -30s
  1 suites ±0    10 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit ccbc1d0. ± Comparison against base commit 7132067.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.46154% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.87%. Comparing base (7132067) to head (ccbc1d0).

Files with missing lines Patch % Lines
csp_gateway/_optional_dependencies.py 31.25% 11 Missing ⚠️
csp_gateway/__init__.py 14.28% 6 Missing ⚠️
csp_gateway/server/web/spaday_ui.py 82.14% 5 Missing ⚠️
csp_gateway/utils/__init__.py 25.00% 3 Missing ⚠️
csp_gateway/server/gateway/csp/channels.py 92.59% 2 Missing ⚠️
csp_gateway/server/modules/web/perspective.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #349      +/-   ##
==========================================
+ Coverage   86.84%   86.87%   +0.02%     
==========================================
  Files         156      158       +2     
  Lines       18697    18714      +17     
  Branches     1762     1768       +6     
==========================================
+ Hits        16238    16257      +19     
+ Misses       2459     2457       -2     

☔ 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
timkpaine merged commit 434b353 into main Sep 3, 2026
9 of 10 checks passed
@timkpaine
timkpaine deleted the tkp/spaday-cleanup branch September 3, 2026 02:11
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