feat(types): adopt shared mokosh-types crate via HTTPS git dep (MAPPS-378) #445
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/MAPPS-378-adopt-mokosh-types"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Completes MAPPS-378: mokosh-apps now depends on the shared
mokosh-typescrate and sources the cleanly-shareable client/server DTOs from it, superseding the interim hand field-sync merged in #443. This is the "make the compiler enforce the contract" half of the ticket.Why
The hand-maintained DTO copies let client/server drift deserialize to serde defaults silently instead of failing the build. Depending on
mokosh-typesmakes drift a compile error for the adopted types. The earlier adoption attempt failed only because it used the SSH git URL, which CI/docker cannot host-key-verify; this PR uses the anonymously-readable HTTPS git URL (the same way bunyip fetches dunite), pinned by rev.mokosh-typesis wasm-safe (serde, serde_json, chrono, chrono-tz 0.9, uuid, validator 0.19, rust_decimal; no sqlx), which the gate confirms by wasm-compiling it.Changes
mokosh-types = { git = "https://dev.a8n.run/psa-systems/mokosh-server.git", rev = "a317a14..." }to Cargo.toml (HTTPS, pinned) and the resolved entries to Cargo.lock.CurrentUserandUserRolefrommokosh_types::auth, deleting the byte-identical local copies; dropped the unused localUserRole::parse_roleshim (zero call sites).AuthState(which maps auth failure to the SPA's ownAppError),User,UserResponse,UserStatus, and the request DTOs stay local.Tenant,TenantBranding,TenantStatus,CreateTenantRequest,UpdateTenantRequest,TenantResponse), which was byte-identical to the shared crate includingTenantStatus::from_str/as_strandFrom<Tenant> for TenantResponse; the SPA-unusedTenantUsageis intentionally not re-exported.TicketNoteandTicketNoteResponse(thecreated_by_contact_iddrift this closes), deleting the local copies; the SPA-localNoteType,CreateNoteRequest,Ticket(itssla_statususes the SPA's quarter-window algorithm, deliberately kept local), and the other ticket types are unchanged.Deferred (drift discovered at the pinned rev, out of scope here)
mokosh_types::contacts::Contactadds acompany_namefield andCompanyTypeadds anInternalvariant that the client copies lack, so re-exporting would be a behaviour change (deserialization/exhaustiveness), not a drop-in. Left as local hand copies.mokosh_types::time_tracking::TimeEntryResponsetypesbilling_status/approval_statusas enums (client usesString) and addsworked_minutes,task_id,ticket_number, and more; several timesheet DTOs also gained fields. Re-exporting would break the timesheet feature's construction and field-access sites. Left as local hand copies.TicketResponse/CreateTicketRequest/TicketCategory/Upsert*ticket types were deleted in #443 and have no client consumers, so they are not re-added (YAGNI); the SPA renders its ownRemoteTicketsubsets.Reconciling the contacts and time_tracking drift is a separate follow-up, since it changes SPA behaviour rather than adopting a matching contract.
Tests
just pre-commitgreen in the repo Docker gate:cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo check --target wasm32-unknown-unknown, andcargo test --lib(223 passed, 0 failed).Pull request closed