Repository navigation
refactor(client): add openframe-common crate CU-17tkuw66nxa - #3047
Conversation
🦩 Flamingo Code Review➖ No tests ran on this commit (no lane ran): nothing here proves the change works. 3 findings: 🔴 0 action required · 🟠 0 recommended · 🔵 3 informational Advisory: findings do not block the merge. 3 defects outside any rule
🔵 Informational (3)
✅ What this change does well
Inline comments: 3 new 7 possible problems checked and ruled out, 5 after reading more of the repository
🧪 Tests and mutationTests per lane
Stage 2 ran no lanes: the hub planned only Trivy and YAML checks for this change, and neither tool is on this machine. It has no Rust lane, so it ran no Rust tests and no mutation testing. Run by hand on macOS arm64 at 9b3bfdf: in clients/openframe-common, CI on 9b3bfdf: Build Rust and Build Rust common pass on macos-latest and windows-latest. 🤖 Prompt for AI agents: fix every findingNext: commit a suggestion, or hand a comment's prompt to your coding agent. React 👍 on a finding that helped and 👎 on one that is wrong: the reviewer learns from both. Review again. New commits are not reviewed until you ask:
Or comment Updated 2026-11-16 19:37 UTC · reviewed from Mikhail Matsykh's machine |
|
devops side:
|
95c1a0a
ClickUp task: CU-17tkuw66nxa Add the openframe-common crate and move the client onto it
Change-Set: refactor-openframe-common-crate
Summary
The client, chat and Console each keep their own copy of the JWT parsing, the shared-token encryption and the NATS wire types, so one fix has to land up to three times. This PR adds the crate they will share,
clients/openframe-common, with its first three parts, and moves the client onto it by path. No behaviour, wire, on-disk or log-text change.Change
New standalone crate
clients/openframe-common(libopenframe_common). It has its ownCargo.lockandMakefileand no workspace, like the client, and no Tauri:auth::jwt:utils/jwt.rsand its tests, moved unchanged. Always on.auth::shared_token, behind featureshared-token(pulls inaes-gcmandanyhow):KEY,FILE_NAME,encrypt(key, plaintext),decrypt(key, data). The envelope stays base64 ofnonce(12) || AES-256-GCM ciphertext + tag, with the client's error texts.decryptreturns an error for another key, input shorter than the nonce and text that is not base64; a test covers each, since chat will rely on those paths.protocol::InstalledAgentMessage: moved frommodels/, same serde shape ({"agentType":..,"version":..}, matching theopenframe-data-natsDTO).Client (
openframe-agent-lib):openframe-common = { path = "../openframe-common", features = ["shared-token"] }.aes-gcmis dropped, andbase64moves to[dev-dependencies]because only two test files use it now. The lockfile gainsopenframe-commonand changes no versions.EncryptionServiceand its module are deleted. It was a zero-sized wrapper around a single call.SharedTokenService::newno longer takes it and callsshared_token::encrypt(shared_token::KEY.as_bytes(), …)directly.ToolCommandParamsResolverheld a second literal copy of the key and ofshared_token.enc. It now usesshared_token::KEYandshared_token::FILE_NAME, so each lives in one place.token_refresh_run_manager,installed_agent_message_publisher,integration_testsand two test files. The hidden per-file docs ofjwt,installed_agent_messageandencryption_serviceare deleted with their modules.CI and hooks:
build-rust-commonjob inbuild.yml, onmacos-latestandwindows-latestlikebuild-rust:make lint,make hackandmake testin the new crate. It runs on the existingrustfilter (clients/**).make hackiscargo hack --feature-powerset clippy --all-targets --locked -- -D warnings. That lints every feature combination with tests included. A plaincheckwith--no-dev-depsnever compiles the tests, so a test that needsshared-tokenbut is not gated by it would only show up later, in a consumer.cargo-hack0.6.46 is installed withtaiki-e/install-action@v2andfallback: none: the tool comes from its own release with a checksum, and without thecargo-binstallfallback the action gets no job token.clients/.githooks: pre-commit runscargo fmt --checkin each crate that has staged Rust. pre-push runsmake clippyin every crate underclients/, because a change inopenframe-commoncan break the client without touching it. It skips withoutmakethe same way it skips withoutcargo.clients/README.md: the layout, the hooks text, and the CI workflow name, which wasrust-client.ymlbut isbuild.yml. It no longer calls CI a gate: the Rust jobs are not required checks onmain.Things that look odd on purpose
decryptwith no caller in this repo. Chat is its next user: it decryptsshared_token.encwith the secret it is launched with, so the key stays a parameter. The fixture test uses it too.shared_token_tests.rsdecrypts a ciphertext produced by the oldEncryptionService. The format is read by osquery (C++), orbit (Go), meshagent (C) and chat, so its bytes must not drift.protocol_tests.rscompares the serializedInstalledAgentMessagewith the exact JSON the backend reads.#![allow(deprecated)]and// TODO: use generated keymoved with the code. The key was already a public literal in this repo, twice, so nothing new is exposed. Generating it is out of scope.build-rust.Not in this PR
v0.0.Ntag cut after this merges, in its own PR with thisChange-Setline. Cargo finds the crate inside the oss-lib checkout by name.connect,fs,agent::*andnotify: later steps of the ticket.Testing
openframe-commonon Windows:make lint,make hack(both feature combinations),make test(13 passed). Without the length check indecrypt, the short-input test panics.openframe-clienton Windows:make lint,cargo build --release --locked,make test(528 passed, 7 ignored).git = "file://…", the way the saas-tenant thin client pinsopenframe-agent-lib.nats-server2.15.2:REQUIRE_NATS_SERVER=1 OPENFRAME_VERSION=0.0.0-dev cargo test --lib --locked, 528 passed, 7 ignored. All 25 integration tests ran, including the two installed-agent tests that decodeInstalledAgentMessagefrom the new crate. CI installs nonats-server, so there the suite skips.Build Rust common (macos-latest)(lint, every feature combination, tests) andBuild Rust (macos-latest)(client lint and tests) pass on this PR. Not run on a physical Mac; the change has no platform code.Change set
flamingo-stack/openframe-oss-lib#3047: these pull requests are one change, reviewed together.Linked work
Linked by the
Depends-On/Change-Setlines in these descriptions; this block is maintained by the hub.