Audit morphir live workspace and IR delivery contracts
- Dominant language
- Rust
- Stars
- 209
- Forks
- 65
- Avg merge
- 8h 55m
- Merged PRs (30d)
- 126
Description
## Parent
#792
## What to review
Run one deliberate, read-only audit of the Rust CLI and loopback server behind `morphir live` and its current `morphir ui` command path. Review the current contract as a whole, not only the commits in #790.
Trace startup, workspace discovery, project selection, confined artifact access, JSON-RPC request handling, watch behavior, model delivery, session authentication, static assets, browser launch, shutdown, and diagnostics. Check the native and installed-extension workspace providers where their contracts differ.
Use the same input profiles as #792 so the UI and Rust reports join at one boundary:
- V3 single-file JSON and YAML
- V4 single-file JSON and YAML
- V4 JSON and YAML document trees/VFS
For each profile, state whether the Rust provider discovers it, represents it accurately in workspace snapshots, opens it without changing semantics, and delivers enough typed metadata and content for the UI to select the right decoder. The current implementation names `morphir-ir.json` and reports `single-file`; record missing YAML or document-tree behavior as an explicit capability result rather than assuming support.
Keep this audit at MVP delivery scope. Do not turn it into deployment, remote-hosting, multi-user, or general production-hardening work.
## Review history that must remain in scope
Re-prove the complete bot-review ledger from finos/morphir PR #756:
- Review `5070335994`, inline comments `3897655133` and `3897655137`: watches stopped after the initial snapshot and concurrent loopback hosts overwrote one cookie. The fixes were commits `e34705e6`, `71c1ffed`, and `554a1e7a`.
- Review `5071129394`, inline comments `3898316588`, `3898316603`, and `3898316612`: extension polling restarted runtimes too often, refresh failures left stale data without a disconnect event, and the inbound size limit was incorrectly applied to generated responses. The fix was `74ab70f8`.
- Review `5071344516`, inline comments `3898474691` and `3898474697`: the bundled client still rejected large host responses, and CSP blocked its WebAssembly workspace loader. The cross-repository fix was finos/morphir commit `c8a0598d` from morphir-ui commit `4c8ba0e5`.
- The final review of `c8a0598d` reported no major issues. Re-check the anchors above rather than treating that result as exhaustive proof.
Also retain PR #790 review `5103345835`, inline comment `3925698261`: a fresh checkout could not follow the documented mise setup before trusting the repository configuration. Commits `ef584982` and `41db85f4` addressed it. Verify the checkout-to-demo path because a working server that maintainers cannot initialize is not delivered.
## Audit dimensions
- CLI contract: command hierarchy and help, default and explicit workspace selection, `--no-open`, browser-open failure, startup diagnostics, Ctrl-C shutdown, and invalid paths.
- Host boundary: loopback-only ephemeral bind, one-time launch-token exchange, per-instance cookies, cookie attributes, authorization of assets/session/RPC, Host and Origin checks, cache policy, content types, CSP, and missing-asset behavior.
- Protocol: version agreement with the vendored client, initialization ordering, request ID reuse, method/parameter validation, provider/source identity, structured errors, large inbound and outbound messages, and connection closure behavior.
- Workspace providers: native versus extension discovery, refresh cadence, watch deduplication, disconnect and recovery transitions, unwatch, runtime lifecycle, and slow/failing providers.
- IR delivery: supported filenames and layouts, JSON/YAML discrimination, V3/V4 metadata, single-file/document-tree descriptors, UTF-8 and empty-file handling, the 64 MiB model limit, path and symlink confinement, replacement races, and diagnostic fidelity.
- Vendored UI: deterministic source commit and manifest provenance, generated asset table, HTML references, content hashes, protocol pinning, and the ability to serve every referenced asset.
## Acceptance criteria
- [ ] The report contains a matrix for all three serialization/layout groups above across native and extension providers, including discovery, descriptor metadata, delivery, watch refresh, and UI handoff.
- [ ] Every PR #756 and relevant PR #790 review item listed above has a current disposition and fresh evidence.
- [ ] Security and confinement checks use trusted local fixtures and controlled probes. The audit does not execute reviewer-supplied code or broaden the bind beyond loopback.
- [ ] Failure paths have observable outcomes. The report flags silent stale data, reconnect loops, ambiguous diagnostics, unsupported layouts reported as supported, and client/server limit or protocol mismatches.
- [ ] Findings cite source locations, a minimal reproduction, expected and observed behavior, affected matrix cells, and the smallest sensible fix boundary.
- [ ] The report separates delivery blockers from optional hardening and excludes remote hosting, multi-user operation, deployment, and unrelated refactoring.
- [ ] The audit produces one consolidated report. It does not edit code, add tests, push commits, comment on a PR, or request another bot review.
## Blocked by
None. This can start immediately and can run in parallel with the UI audit.
## Handoff
Compare the protocol-boundary results with the UI-side audit under #792. If one side claims a profile is supported and the other side cannot produce or consume it, classify the combined route as incomplete.
Contributor guide
Research direction
Start with the `morphir live` and `morphir ui` command paths, using the V3/V4 JSON/YAML profiles and native and extension providers named in the issue. Trace the listed CLI, host boundary, protocol, workspace, IR delivery, and vendored UI checks, then compare results with #792 and the cited review anchors. Done means one consolidated report with the required matrix, evidence, dispositions, blockers, and handoff findings, without code or test changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, cli, documentation, security, testing
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100