fix: eliminate target cache mount for build freshness and echo websocket close frame #7

Merged
Wuast94 merged 2 commits from fix/build-freshness-and-websocket-close into main 2026-10-19 18:08:51 +02:00
Owner

Summary

  1. Build Freshness / Migration 44 Root Cause:

    • In Dockerfile, mounting /app/target as a persistent cache mount (--mount=type=cache,id=${RUSTFIN_TARGET_CACHE_ID},target=/app/target,sharing=locked) collided with source mtime normalization (scripts/normalize-source-timestamps.sh sets file mtimes to 2024 based on content hash).
    • Cargo compares source mtimes against .rlib timestamps in target/. Because October 2026 > 2024, Cargo assumed existing workspace crate artifacts (such as rustfin-db-schema) were already up to date and skipped compiling them into the binary.
    • Removed the /app/target cache mount from Dockerfile, aligning with the Goldstandard rust-template where Cargo runs in a clean container filesystem and object caching is handled safely by content-hashed sccache.
  2. WebSocket RFC 6455 Close Handshake:

    • In crates/rustfin-client-api/src/api/websocket/connection.rs, incoming Message::Close(frame) was handled by simply breaking out of the loop and dropping the socket without sending a response frame.
    • Added echo of the Close frame (socket.send(Message::Close(frame)).await; break;) and sending Message::Close(None) on cancellation/channel closure, completing the close handshake cleanly.

Verification

  • just fmt && just fmt-check && just clippy
  • node --test scripts/docker-build.test.mjs
  • just architecture && just deny && just machete
  • just domain-test realtime_api_tests
  • just schema-check
### Summary 1. **Build Freshness / Migration 44 Root Cause**: - In `Dockerfile`, mounting `/app/target` as a persistent cache mount (`--mount=type=cache,id=${RUSTFIN_TARGET_CACHE_ID},target=/app/target,sharing=locked`) collided with source mtime normalization (`scripts/normalize-source-timestamps.sh` sets file mtimes to 2024 based on content hash). - Cargo compares source mtimes against `.rlib` timestamps in `target/`. Because October 2026 > 2024, Cargo assumed existing workspace crate artifacts (such as `rustfin-db-schema`) were already up to date and skipped compiling them into the binary. - Removed the `/app/target` cache mount from `Dockerfile`, aligning with the Goldstandard `rust-template` where Cargo runs in a clean container filesystem and object caching is handled safely by content-hashed `sccache`. 2. **WebSocket RFC 6455 Close Handshake**: - In `crates/rustfin-client-api/src/api/websocket/connection.rs`, incoming `Message::Close(frame)` was handled by simply breaking out of the loop and dropping the socket without sending a response frame. - Added echo of the Close frame (`socket.send(Message::Close(frame)).await; break;`) and sending `Message::Close(None)` on cancellation/channel closure, completing the close handshake cleanly. ### Verification - `just fmt && just fmt-check && just clippy` - `node --test scripts/docker-build.test.mjs` - `just architecture && just deny && just machete` - `just domain-test realtime_api_tests` - `just schema-check`
fix(websocket): echo close frame on teardown per RFC 6455
All checks were successful
CI / Quality (pull_request) Successful in 22m16s
CI / Build production (pull_request) Successful in 33m48s
2024f7a54a
Wuast94 deleted branch fix/build-freshness-and-websocket-close 2026-10-19 18:08:52 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Wuast94/rustfin!7
No description provided.