Skip to content

Trap NIP-90 job request events (kind 5000-5999) and record them via the job repository #728

Description

@Priyanshubhartistm

Description

Follow-up to #639 and the persistence layer added in #727 (DvmJobRepository). Nostream can now store DVM job state, but nothing captures incoming job requests yet — kind 5000-5999 events currently fall through to DefaultEventStrategy and are treated as plain regular events.

This issue covers ingestion only: recognize job request events, validate them, and persist a submitted job row via DvmJobRepository.create(). No worker dispatch yet - that's a separate follow-up.

What needs to be done

  • Add a DvmJobRequestEventStrategy that recognizes kind 5000-5999 events, following the same event-strategy pattern used elsewhere (e.g. ParameterizedReplaceableEventStrategy, EphemeralEventStrategy).
  • Wire it into eventStrategyFactory (src/factories/event-strategy-factory.ts), checked early — same reasoning as the existing NIP-43 join/leave check — since kind 5000-5999 sits outside every existing range constant and would otherwise land in DefaultEventStrategy.
  • On a matching event: validate it, then call DvmJobRepository.create(id, requesterPubkey, kind) to record it as submitted.
  • Tests for the strategy: recognized kinds, rejection/validation cases, and that a job row is correctly created via the repository.

Out of scope (follow-up work)

  • Spawning/dispatching the job to a worker process (separate issue/PR)
  • Publishing kind 6000-6999 result events or kind 7000 feedback events (separate issue/PR)

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions