Repository navigation
Single page viewer - #10
Merged
Merged
Conversation
The viewer as one web page that reads the model with the SysML v2 API directly from the browser, adapted to SYSMOD v5: - web/index.html + sysmod-viewer.css: the page - web/sysmod-viewer-core.js: reads the SYSMOD project from the elements of a commit (atlas, problem statement, system idea and objectives, stakeholders, needs, requirements, use cases, six context diagrams, completeness checks) - web/sysmod-viewer-api.js: SysML v2 API client (paging via Link or page[after], token, relay) - web/sysmod-viewer.js: the interface, SVG context diagrams without a CDN - web/serve.py: standard library only; serves the page and relays read-only requests to any SysML v2 server (CORS, http), localhost only - tests/test_web_serve.py: rules of the relay and real HTTP with a fake server - README: the single page is the recommended viewer; Flask stays for editing, AI, wizard and MCP The same JavaScript runs on mbse4u.com/tools/sysmod-viewer/ (with an engine for .sysml files and an allowlist relay); its tests (81 checks, Delivery Drone model) pass with these files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
…r page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
…er; README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
| def do_POST(self): | ||
| self.fail(405, "only GET") | ||
|
|
||
| def relay(self): |
| self.end_headers() | ||
| self.wfile.write(b) | ||
|
|
||
| def do_GET(self): |
| print(f"SYSMOD viewer: http://localhost:{a.port}/ (Ctrl+C to stop)") | ||
| try: | ||
| server.serve_forever() | ||
| except KeyboardInterrupt: |
Code scanning: serve.py relayed to any server when ALLOWED_SYSML_SERVER_ORIGINS was not set (server-side request forgery). Now it always uses the allowlist, with the default of the Flask server (http://localhost:9000 …), and the server part of the outgoing request is taken from the allowlist entry, never from the address the page sent. viewer-config.json lists the allowed servers. The JavaScript no longer uses regular expressions anchored at the end of remote text (/\/+$/, /\*+\/\s*$/, /\s*\n\s*/), which can run in quadratic time on long input; replaced by linear helpers with the same results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
…ility) Reliability: no single-line if followed by another statement; sort() no longer inside expressions (toSorted, or a separate statement); the promise of start() is handled (errors are shown on the page). Security: no regular expressions with backtracking on remote text; the path check of serve.py works segment by segment instead of a nested-quantifier regex; no http literal in the start message. Maintainability: every function below cognitive complexity 15 (exprText as a table of expression kinds, readContext split into contextLinks, partOfEnd, stepOf, matchRole; the API client's get() into request, answerError, readJson; the interface's render() into one function per section, the diagram into layout, systemBox, actorBox, drawLink, placeActors; serve.py's check_url and relay into small functions); no nested ternaries or nested template literals; fetchBytes and the engine loader at module level; duplicate CSS selectors merged. Behaviour unchanged: 92 checks of mbse4u.com (Delivery Drone model and tests/test_sysmod.sysml), tests/test_web_serve.py, and the pages in a browser (server with and without CORS, relay, token, JSON and .sysml files). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
- promises of event handlers are voided; nextUrl at module scope - no await in loops: pages are read recursively, JSON files with Promise.all - reduce() with an initial value; <output> instead of role=status - serve.py: except OSError (URLError and TimeoutError are OSErrors); no clear-text URL in the start message - test server: Link header from its own address, not from the Host header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
…loud (S5332) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
…OSONAR(python:S5332)) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H3jemrqbQnRXB9jiZkhv1r
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.