Skip to content

First pass at a web interface#163

Draft
tameware wants to merge 28 commits into
dds-bridge:developfrom
tameware:web
Draft

First pass at a web interface#163
tameware wants to merge 28 commits into
dds-bridge:developfrom
tameware:web

Conversation

@tameware
Copy link
Copy Markdown
Contributor

@tameware tameware commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

First pass at a browser-based DDS demo: a static HTML/JS UI that calls CalcDDtablePBN via an Emscripten-built WASM module embedded as base64 so the page works over both file:// and HTTP. Also restructures the existing WASM build plumbing — moves wasm_cc_binary example targets into a new //examples/wasm package, replaces the --config=wasm flow with wasm_cc_binary's platform transition, factors shared Emscripten link flags into wasm_compat.bzl, and removes the now-unused wasm_sources filegroups.

Changes:

  • New web/ package: dds_mvp.html/.css/.js UI, dds_mvp_wasm.cpp C entry point, BUILD.bazel, and Python/shell helpers (update_wasm.sh, gen_wasm_bin_js.py, patch_mvp_wasm.py, verify_wasm_js.py).
  • WASM build refactor: //:build_wasm switched to constraint_values, --config=wasm removed from .bazelrc, examples WASM rules moved to //examples/wasm, CI updated, docs rewritten.
  • system.cpp gets an Emscripten branch returning a conservative 512MB-of-KB / 1-core hardware report; examples/calc_dd_table_pbn.cpp adds __WASM__ to its threading guard.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
web/dds_mvp.html New demo page; input grid, result table, script tags.
web/dds_mvp.css Styles for the input grid.
web/dds_mvp.js UI logic; loads WASM module and calls dds_mvp_calc_table.
web/dds_mvp_wasm.cpp Emscripten entry point wrapping CalcDDtablePBN.
web/BUILD.bazel Builds dds_mvp_wasm via wasm_cc_binary.
web/update_wasm.sh Local script: build, copy artifacts, base64-embed, patch, verify.
web/gen_wasm_bin_js.py Generates base64 wasm-bytes JS file.
web/patch_mvp_wasm.py Patches isFileURI line in Emscripten output.
web/verify_wasm_js.py Sanity-checks wasm compiles under Node.
.bazelrc Removes build:wasm profile.
BUILD.bazel build_wasm config_setting now uses platform constraints.
wasm_compat.bzl Shared WASM_LINKOPTS.
wasm/BUILD.bazel Empty package marker.
examples/BUILD.bazel Drops old wasm filegroups; aliases all_examples_wasm.
examples/wasm/BUILD.bazel New home for wasm_cc_binary example targets.
examples/calc_dd_table_pbn.cpp Adds __WASM__ to threading guard.
library/src/**/BUILD.bazel Removes obsolete wasm_sources filegroups.
library/src/system/system.cpp Emscripten-specific hardware-info fallback.
library/tests/**/BUILD.bazel Whitespace-only changes.
docs/wasm_build.md Docs rewritten for the new flow.
.github/workflows/ci_wasm.yml Drops --config=wasm; new target/output paths.

Comment thread web/dds_mvp.html Outdated
Comment thread web/dds_mvp.js
Comment thread web/dds_mvp_wasm.cpp Outdated
Comment thread web/dds_mvp_wasm.cpp Outdated
Comment thread web/dds_mvp.js
Comment thread library/src/system/system.cpp Outdated
Comment thread web/patch_mvp_wasm.py Outdated
Comment thread web/gen_wasm_bin_js.py
tameware added 5 commits June 2, 2026 10:21
debug_build_windows now requires:
cpu = x64_windows
compilation_mode = dbg
That prevents Windows-native flags from applying to wasm transition builds (cpu=wasm), including //web:dds_mvp_wasm_cc.
.bazelrc had:
build:windows --cxxopt=/std:c++20
build:windows --host_cxxopt=/std:c++20
Those options are too broad and can bleed into wasm builds on Windows hosts, which is exactly why emcc saw /std:c++20.

Removed those two lines and left Windows C++ standard selection to CPPVARIABLES.bzl (//:build_windows selects), which keeps native Windows builds on C++20 without contaminating wasm transitions.
…o old for designated initializers), causing error C7555.

Fixed by:

loading DDS_CPPOPTS from CPPVARIABLES.bzl and
applying copts = DDS_CPPOPTS to both tests in that file:
solve_board_test and
analyse_play_consistency_test
library/src/init.cpp uses stringstream (and i/o manipulators like setw, left, right) in GetDDSInfo, but didn’t include the required standard headers directly.

Added

#include <sstream>
#include <iomanip>
to library/src/init.cpp.

That should resolve the CI wasm compile error:

implicit instantiation of undefined template 'std::basic_stringstream<char>'
…dows CI path.

Changed library/src/solve_board.cpp to use std::thread + explicit join() instead of std::jthread in solve_all_boards_n().

Before: std::vector<std::jthread>
After: std::vector<std::thread> and a join loop
@tameware
Copy link
Copy Markdown
Contributor Author

tameware commented Jun 2, 2026 via email

@tameware tameware marked this pull request as draft June 2, 2026 09:24
tameware added 4 commits June 2, 2026 11:42
loadDdsModule() now clears ddsModulePromise inside .catch(...) before rethrowing, so later calls can retry.
Removed the no-op .then((module) => ...) block entirely.
Now a transient createDdsModule(...) failure won’t permanently poison future attempts.
@tameware
Copy link
Copy Markdown
Contributor Author

tameware commented Jun 2, 2026

Everything builds successfully now, but I'm stlll working on implementing Copilot's suggestions. I tried to turn the PR into a draft, but I was not successful. I'll post another comment when it's ready for human review.

@tameware
Copy link
Copy Markdown
Contributor Author

tameware commented Jun 2, 2026

Aha! I see I was successful, I just didn't know it. It's a draft - perfect.

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.

2 participants