Summary
The conditional HTTP handlers write resources without emitting subscription events, so rest-hook (and every other channel) subscribers miss creates, updates and deletes performed via If-None-Exist, PUT [type]?[criteria], or DELETE [type]?[criteria]. Discussion #59 defines the event evaluator as running "on each resource write (create/update/delete)".
Evidence
crates/rest/src/handlers/create.rs:232-243 emits emit_subscription_event(..., ResourceEventType::Create) on the unconditional path only. The If-None-Exist branch (:117-205) returns before reaching it, so a resource created by conditional create is never announced.
update.rs: update_handler emits at :285-300 (Create or Update depending on created). conditional_update_handler (:333-464) contains no subscription_engine reference; both the Updated arm and the created-by-upsert arm are silent.
delete.rs: the instance path emits emit_delete_event at :201-212; conditional_delete_handler (:239-307) emits nothing.
patch.rs: patch_handler emits at :146-156; conditional_patch_handler does not. (That handler currently has no route; see the PATCH issue.)
Related audit gap in the same handler: conditional_delete_handler's NoMatch arm (delete.rs:298-301) answers 204 without an AuditResponseContext, so a no-match conditional delete is audited with no entity. The Deleted arm was fixed in #860.
Proposed fix
Emit through the same helpers the unconditional handlers use, in each conditional success arm (Created, Exists is not a write, Updated, Deleted). Add an AuditResponseContext naming the resource type on NoMatch. Tests: a rest-hook subscription receiving a notification for each conditional interaction (the subscriptions crate's channel tests are the model).
Found while validating #511 (see PR #860).
Summary
The conditional HTTP handlers write resources without emitting subscription events, so rest-hook (and every other channel) subscribers miss creates, updates and deletes performed via
If-None-Exist,PUT [type]?[criteria], orDELETE [type]?[criteria]. Discussion #59 defines the event evaluator as running "on each resource write (create/update/delete)".Evidence
crates/rest/src/handlers/create.rs:232-243emitsemit_subscription_event(..., ResourceEventType::Create)on the unconditional path only. TheIf-None-Existbranch (:117-205) returns before reaching it, so a resource created by conditional create is never announced.update.rs:update_handleremits at:285-300(Create or Update depending oncreated).conditional_update_handler(:333-464) contains nosubscription_enginereference; both theUpdatedarm and the created-by-upsert arm are silent.delete.rs: the instance path emitsemit_delete_eventat:201-212;conditional_delete_handler(:239-307) emits nothing.patch.rs:patch_handleremits at:146-156;conditional_patch_handlerdoes not. (That handler currently has no route; see the PATCH issue.)Related audit gap in the same handler:
conditional_delete_handler'sNoMatcharm (delete.rs:298-301) answers 204 without anAuditResponseContext, so a no-match conditional delete is audited with no entity. TheDeletedarm was fixed in #860.Proposed fix
Emit through the same helpers the unconditional handlers use, in each conditional success arm (
Created,Existsis not a write,Updated,Deleted). Add anAuditResponseContextnaming the resource type onNoMatch. Tests: a rest-hook subscription receiving a notification for each conditional interaction (the subscriptions crate's channel tests are the model).Found while validating #511 (see PR #860).