Skip to content

refactor(server): move webhook worker and polish handlers#118

Merged
martsokha merged 2 commits into
mainfrom
chore/polish-handlers
Jun 12, 2026
Merged

refactor(server): move webhook worker and polish handlers#118
martsokha merged 2 commits into
mainfrom
chore/polish-handlers

Conversation

@martsokha

Copy link
Copy Markdown
Member

A polishing pass over the server handlers, plus a small file move.

Move

  • worker/webhook.rsservice/webhook/worker.rs (alongside the webhook emitter); the now-empty worker/ module is dissolved. WebhookWorker is re-exported through service, so consumers import it from nvisy_server::service.

Handler polish (no behavior change except the bug fix)

  • Bug fix — file download set Content-Disposition by interpolating the user-controlled display_name into the header and .parse().unwrap()-ing it. A filename with control chars/quotes could panic the handler (and was a header-injection vector). Now sanitized with a generic fallback.
  • Removed an unwrap()-with-justification in login by binding the validated account in the match arm.
  • Added an Error::not_found(resource) constructor and used it to replace the repeated 3-line NotFound builder across the find_* helpers and a delete path.

Notes

The handlers were already in consistent shape (module docs, canonical tracing targets/spans, _docs builders, documented routes()). The review surfaced one genuine bug and two minor cleanups; everything else already followed the canonical pattern.

Verification

Full workspace green: cargo check, clippy -D warnings, cargo +nightly fmt --check, cargo doc -D warnings, cargo deny check all, tests.

🤖 Generated with Claude Code

martsokha and others added 2 commits June 12, 2026 07:04
Relocate the webhook delivery worker from worker/webhook.rs to
service/webhook/worker.rs, alongside the webhook emitter, and dissolve
the now-empty worker module. WebhookWorker is re-exported through
service, so consumers import it from nvisy_server::service.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix a panic / header-injection risk in file download: the user-controlled
  display name was interpolated into the Content-Disposition header and
  unwrapped. Sanitize it and fall back to a generic disposition.
- Remove an unwrap-with-justification in login by binding the validated
  account in the match arm.
- Add an Error::not_found(resource) constructor and use it to replace the
  repeated NotFound builder across the find_* helpers and a delete path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@martsokha martsokha self-assigned this Jun 12, 2026
@martsokha martsokha added the chore maintenance, dependency updates, code cleanup label Jun 12, 2026
@martsokha martsokha merged commit 3d77a72 into main Jun 12, 2026
5 checks passed
@martsokha martsokha deleted the chore/polish-handlers branch June 12, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore maintenance, dependency updates, code cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant