documented verification and added file attachements to post response

This commit is contained in:
Ivan I. Ovchinnikov
2026-11-18 13:20:04 +03:00
parent 6296a3a719
commit f08289905d
4 changed files with 94 additions and 84 deletions
+23
View File
@@ -194,3 +194,26 @@ See `docs/mvp-checklist.md` for the detailed checklist.
Current state: phases 0-3a complete (storage foundation). Current state: phases 0-3a complete (storage foundation).
Next: phase 3b (REST client, auth, connect/me). Next: phase 3b (REST client, auth, connect/me).
## Verification
To verify the bridge works against your corporate Mattermost instance:
1. Start the bridge: `./scripts/docker-up.sh`
2. Connect and get a token:
```bash
./scripts/mm-cli.sh '{"id":"1","type":"request","method":"connect","params":{"server_id":"work","url":"https://mm.local","login_id":"user","password":"pass"}}'
```
3. Open self-DM channel:
```bash
./scripts/mm-cli.sh '{"id":"2","type":"request","method":"open_self_dm","params":{"server_id":"work"}}'
```
4. Send a message to yourself:
```bash
./scripts/mm-cli.sh '{"id":"3","type":"request","method":"send_post","params":{"server_id":"work","channel_id":"<ID_FROM_STEP_3>","message":"Test"}}'
```
4. Check history:
```bash
./scripts/mm-cli.sh '{"id":"4","type":"request","method":"get_history","params":{"server_id":"work","channel_id":"<ID_FROM_STEP_3>","limit":1}}'
```
+2
View File
@@ -75,4 +75,6 @@ pub struct Post {
pub create_at: i64, pub create_at: i64,
pub update_at: i64, pub update_at: i64,
pub delete_at: i64, pub delete_at: i64,
#[serde(default)]
pub file_ids: Vec<String>,
} }
+67 -83
View File
@@ -7,7 +7,7 @@
- [x] Docker Compose as primary bridge runtime. - [x] Docker Compose as primary bridge runtime.
- [x] Emacs does not start Docker. - [x] Emacs does not start Docker.
- [x] TCP JSONL transport. - [x] TCP JSONL transport.
- [x] Web status UI planned. - [x] Web status UI.
- [x] Mattermost 10.9.3 target. - [x] Mattermost 10.9.3 target.
- [x] Mattermost server is source of truth. - [x] Mattermost server is source of truth.
- [x] Emacs buffers are display-only. - [x] Emacs buffers are display-only.
@@ -19,45 +19,41 @@
- [x] Typing not in MVP. - [x] Typing not in MVP.
- [x] Reactions not in MVP. - [x] Reactions not in MVP.
- [x] Login/password and session/PAT token only. - [x] Login/password and session/PAT token only.
- [x] Plain token cache file for MVP. - [x] Plain token file per server, private mode.
- [x] Explicit CA configuration for self-signed/internal CA. - [x] Explicit CA configuration, verification stays enabled.
- [x] Automated dependency resolution, no manual version pins.
## Phase 0 — repository bootstrap ## Phase 0 — repository bootstrap
- [x] Create repository tree script. - [x] Repository tree script.
- [x] Create README. - [x] README.
- [x] Create .gitignore. - [x] .gitignore / .dockerignore.
- [x] Create .dockerignore. - [x] architecture / protocol / docker / tls / mattermost notes docs.
- [x] Create architecture doc. - [x] MVP checklist.
- [x] Create protocol doc.
- [x] Create Docker doc.
- [x] Create TLS doc.
- [x] Create Mattermost 10.9.3 notes.
- [x] Create MVP checklist.
## Phase 1 — minimal Rust bridge ## Phase 1 — minimal Rust bridge
- [x] Add Cargo workspace. - [x] Cargo workspace, five crates.
- [x] Add crate manifests. - [x] mm-core: ids, errors, models.
- [x] Add minimal mm-core types. - [x] JSONL protocol parse/validate/encode.
- [x] Add JSONL protocol types. - [x] TCP listener, line-based handling.
- [x] Add TCP listener. - [x] ping, status, unknown_method, invalid_json.
- [x] Implement ping. - [x] Unit tests.
- [x] Implement status. - [x] dev-check.sh, smoke-ping.sh.
- [x] Add smoke test for ping/status.
## Phase 2 — Docker and status web UI ## Phase 2 — Docker and web status UI
- [x] Add Dockerfile. - [x] mm-web with axum.
- [x] Add compose.yaml. - [x] /health, /status, HTML index.
- [x] Add bridge config from environment. - [x] Shared BridgeStatus between TCP and web.
- [x] Add /health. - [x] Config from environment (listen addresses).
- [x] Add /status JSON. - [x] Dockerfile with Nexus builder and internal CA.
- [x] Add simple HTML status page. - [x] compose.yaml, docker helper scripts.
- [x] Add Docker helper scripts. - [x] Non-root runtime user.
- [x] Add web smoke script. - [x] smoke-web.sh with proxy bypass.
- [x] Verify local bridge + web smoke. - [x] MSRV-aware Cargo.lock, committed after green build.
- [x] Verify Docker Compose bridge + web smoke. - [x] Local bridge + web smoke verified.
- [x] Docker Compose bridge + web smoke verified.
## Phase 3a — storage foundation (no network) ## Phase 3a — storage foundation (no network)
@@ -78,34 +74,30 @@
## Phase 3b — authentication (network) ## Phase 3b — authentication (network)
### 3b-1: HTTP client foundation - [x] mm-client: HTTP client with explicit CA support.
- [x] login/password against Mattermost 10.9.3, read Token header.
- [x] Save session token via TokenStore.
- [x] Load saved token on connect.
- [x] Support PAT token.
- [x] Implement connect.
- [x] Implement me.
- [x] Map Mattermost errors to normalized error codes.
- [x] Ensure tokens/passwords are never logged.
- [ ] mm-client crate skeleton. ## Phase 4a — self-DM backend vertical slice
- [ ] reqwest dependency with rustls-tls-native-roots (for system CA) + explicit CA support.
- [ ] Client struct with base_url and optional ca_file.
- [ ] login(login_id, password) -> Result<String, Error> (extracts Token header).
- [ ] get_me(token) -> Result<User, Error>.
- [ ] Unit/integration tests for client construction.
### 3b-2: Bridge integration - [x] Implement teams.
- [x] Resolve current user.
- [x] Create/get self direct channel.
- [x] Implement open_self_dm.
- [x] Implement get_history with ascending post order.
- [x] Implement send_post.
- [x] Bridge methods verified via smoke tests.
- [x] Post model includes file_ids.
- [ ] Implement connect method in bridge. ## Phase 4b — Emacs UI (pending)
- [ ] Implement me method in bridge.
- [ ] Save session token via TokenStore on successful connect.
- [ ] Load saved token on startup (future: auto-reconnect).
- [ ] Support PAT token (same flow, just skip login).
- [ ] Map Mattermost API errors to normalized error codes.
- [ ] Ensure tokens/passwords are never logged.
## Phase 4 — self-DM vertical slice - [ ] Connect Emacs to bridge over TCP.
- [ ] Implement teams.
- [ ] Resolve current user.
- [ ] Create/get self direct channel.
- [ ] Implement open_self_dm.
- [ ] Implement get_history.
- [ ] Implement send_post.
- [ ] Connect Emacs to bridge.
- [ ] Open self-DM buffer. - [ ] Open self-DM buffer.
- [ ] Display raw messages. - [ ] Display raw messages.
- [ ] Send message from Emacs. - [ ] Send message from Emacs.
@@ -127,46 +119,38 @@
## Phase 6 — replies/threads ## Phase 6 — replies/threads
- [ ] Implement reply_post. - [ ] Implement reply_post.
- [ ] Add thread buffer. - [ ] Thread buffer.
- [ ] Add mattermost-thread-display. - [ ] mattermost-thread-display option.
- [ ] Default to separate thread buffers. - [ ] Default separate-buffer.
- [ ] Keep inline mode as future-compatible option. - [ ] Keep inline mode future-compatible.
- [ ] Show server/team context in thread buffer names. - [ ] Server/team context in thread buffer names.
## Phase 7 — channels ## Phase 7 — channels
- [ ] Implement list_channels. - [ ] Implement list_channels.
- [ ] Add channel list buffer. - [ ] Channel list buffer.
- [ ] Open channel buffer. - [ ] Open channel buffer, load history, send message.
- [ ] Load channel history. - [ ] Channel events online.
- [ ] Send channel message.
- [ ] Receive channel events online.
- [ ] Implement mark_read. - [ ] Implement mark_read.
- [ ] Forced refresh with g. - [ ] Forced refresh with g.
## Phase 8 — TLS/self-signed support ## Phase 8 — TLS/self-signed support
- [ ] Add explicit CA file configuration. - [ ] MM_CA_FILE configuration for bridge to Mattermost.
- [ ] Same CA policy for REST and WebSocket.
- [ ] Document Docker CA mount. - [ ] Document Docker CA mount.
- [ ] Document Emacs CA settings separately. - [ ] Clear tls_error messages.
- [ ] Do not disable certificate verification by default in Rust bridge.
- [ ] Add clear error message for TLS failures.
## Phase 9 — hardening ## Phase 9 — hardening
- [ ] Add structured errors. - [ ] Request timeouts.
- [ ] Add request timeouts. - [ ] Rate-limit handling.
- [ ] Add rate-limit handling. - [ ] Integration smoke tests.
- [ ] Add basic integration smoke tests. - [ ] Emacs Lisp tests.
- [ ] Add Emacs Lisp tests. - [ ] Log review for secret leaks.
- [ ] Review logs for secret leaks. - [ ] Cache permission review.
- [ ] Review cache file permissions. - [ ] Multiserver-ready naming review.
- [ ] Review multiserver-ready identifiers and naming.
## Next atomic step ## Next atomic step
Verify Phase 2 locally and in Docker Compose. Phase 5: WebSocket client implementation in mm-client.
After that:
Implement authentication foundation: connect, me, login/password, token cache.
+2 -1
View File
@@ -11,4 +11,5 @@ else
read -r INPUT read -r INPUT
fi fi
printf '%s\n' "$INPUT" | nc -w 2 "$HOST" "$PORT" # Use -q 1 to wait 1 second for response after EOF on stdin
printf '%s\n' "$INPUT" | nc -q 1 "$HOST" "$PORT"