Skip to content

Comments

feat: add midtown view --matrix mode#1453

Open
btucker wants to merge 19 commits intomainfrom
codex/matrix-bridge-spike
Open

feat: add midtown view --matrix mode#1453
btucker wants to merge 19 commits intomainfrom
codex/matrix-bridge-spike

Conversation

@btucker
Copy link
Owner

@btucker btucker commented Feb 23, 2026

Summary

  • Added new matrix mode for that starts and connects to local Matrix bridge via .
  • Implemented startup and readiness behavior, including bounded bridge startup wait.
  • Added runtime dependency checks (, , npm

Usage:

npm install install all the dependencies in your project
npm install add the dependency to your project
npm test run this project's tests
npm run run the script named
npm -h quick help on
npm -l display usage info for all commands
npm help search for help on
npm help npm more involved overview

All commands:

access, adduser, audit, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
help-search, init, install, install-ci-test, install-test,
link, ll, login, logout, ls, org, outdated, owner, pack,
ping, pkg, prefix, profile, prune, publish, query, rebuild,
repo, restart, root, run, sbom, search, set, shrinkwrap,
star, stars, start, stop, team, test, token, undeprecate,
uninstall, unpublish, unstar, update, version, view, whoami

Specify configs in the ini-formatted file:
/Users/btucker/.npmrc
or on the command line via: npm --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

npm@11.6.0 /Users/btucker/.nvm/versions/node/v24.1.0/lib/node_modules/npm) and Cinny bootstrapping flow (download latest release tarball, extract, patch local config, install deps, and start client).

  • Updated CLI docs and README with matrix mode behavior and requirements.

Notes

Using the default project-based local server hostname and homeserver configuration generated during bootstrap.

@btucker
Copy link
Owner Author

btucker commented Feb 23, 2026

Review Status

🔍 Review in progress by columbus...


Note

This comment will be updated with the review results when complete.

🌃 Co-built with Midtown

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 27f8e1c167

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

impl MatrixClient {
pub fn new(homeserver_url: impl Into<String>, access_token: impl Into<String>) -> Self {
let homeserver_url = homeserver_url.into().trim_end_matches('/').to_string();
let homeserver_domain = infer_homeserver_domain(&homeserver_url);

Choose a reason for hiding this comment

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

P1 Badge Derive Matrix domain from bridge config, not bind URL

MatrixClient::new infers homeserver_domain from homeserver_url, so with http://127.0.0.1:6167 it becomes 127.0.0.1:6167, but the bridge config sets Conduit server_name to <project>.local and run_as_server uses this inferred domain for sender filtering. In that setup, matrix_user_localpart will reject incoming users from <project>.local, so Matrix→Midtown message ingestion is dropped for normal traffic (and generated user IDs/aliases use the wrong domain).

Useful? React with 👍 / 👎.

Comment on lines 353 to 355
cmd.spawn()
.map(|_| ())
.map_err(|e| format!("Failed to spawn Conduit '{exe}': {e}"))

Choose a reason for hiding this comment

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

P1 Badge Track and terminate the Conduit child on bridge stop

The bridge starts Conduit with cmd.spawn() and immediately discards the Child handle, while midtown matrix stop only kills the PID tracked in bridge.pid (the matrix bridge wrapper process). This leaves Conduit running after stop/restart cycles, so port 6167 and old homeserver state can persist unexpectedly across runs.

Useful? React with 👍 / 👎.

Comment on lines 11 to 12
fn matrix_runtime_dir() -> PathBuf {
midtown::paths::midtown_base_dir().join("matrix")

Choose a reason for hiding this comment

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

P1 Badge Scope matrix runtime files by project instead of globally

The bridge PID/state directory is fixed at ~/.midtown/matrix, so all projects share one bridge.pid and one bridge state. In a multi-project workspace this causes cross-project interference: launching midtown view --matrix in project B can reuse project A’s running bridge/state, and stopping from one project tears down the other project’s bridge.

Useful? React with 👍 / 👎.

@btucker
Copy link
Owner Author

btucker commented Feb 23, 2026

I addressed all remaining P1 review items from the latest review and pushed commit b758a3a:\n\n- Matrix AS domain now comes from bridge config server_name (not inferred from URL) so user aliases align with ".local".\n- Conduit is now started as tracked ConduitProcess owned for bridge runtime and killed on bridge shutdown/restart.\n- Matrix runtime files are project-scoped under ~/.midtown/matrix/<project_name>/ (pid/state only affect active repo).\n\nCommit is in the same PR branch and ready for re-review.

@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 2.52343% with 1352 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.69%. Comparing base (64005cf) to head (9607832).

Files with missing lines Patch % Lines
src/bin/midtown/cli/daemon.rs 2.92% 332 Missing ⚠️
src/matrix_bridge/mod.rs 0.00% 329 Missing ⚠️
src/matrix_bridge/client.rs 0.00% 236 Missing ⚠️
src/matrix_bridge/sync.rs 0.00% 159 Missing ⚠️
src/bin/midtown/cli/matrix.rs 10.21% 123 Missing ⚠️
src/matrix_bridge/as_server.rs 0.00% 89 Missing ⚠️
src/matrix_bridge/inbound.rs 0.00% 51 Missing ⚠️
src/bin/midtown/main.rs 36.00% 16 Missing ⚠️
src/matrix_bridge/state.rs 0.00% 9 Missing ⚠️
src/bin/midtown/cli/mod.rs 20.00% 8 Missing ⚠️

❌ Your patch check has failed because the patch coverage (2.52%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1453      +/-   ##
==========================================
- Coverage   67.34%   65.69%   -1.65%     
==========================================
  Files         102      109       +7     
  Lines       52723    54097    +1374     
==========================================
+ Hits        35507    35541      +34     
- Misses      17216    18556    +1340     
Files with missing lines Coverage Δ
src/lib.rs 84.61% <ø> (ø)
src/bin/midtown/cli/mod.rs 6.36% <20.00%> (+0.36%) ⬆️
src/matrix_bridge/state.rs 0.00% <0.00%> (ø)
src/bin/midtown/main.rs 33.10% <36.00%> (-0.15%) ⬇️
src/matrix_bridge/inbound.rs 0.00% <0.00%> (ø)
src/matrix_bridge/as_server.rs 0.00% <0.00%> (ø)
src/bin/midtown/cli/matrix.rs 10.21% <10.21%> (ø)
src/matrix_bridge/sync.rs 0.00% <0.00%> (ø)
src/matrix_bridge/client.rs 0.00% <0.00%> (ø)
src/matrix_bridge/mod.rs 0.00% <0.00%> (ø)
... and 1 more

... and 5 files with indirect coverage changes

🚀 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.

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