Skip to content

feat(dvm): trap NIP-90 job request events and record them via job repository - #729

Open
Priyanshubhartistm wants to merge 4 commits into
cameri:mainfrom
Priyanshubhartistm:feat/dvm-job-ingestion
Open

feat(dvm): trap NIP-90 job request events and record them via job repository#729
Priyanshubhartistm wants to merge 4 commits into
cameri:mainfrom
Priyanshubhartistm:feat/dvm-job-ingestion

Conversation

@Priyanshubhartistm

@Priyanshubhartistm Priyanshubhartistm commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Note: This PR is stacked on #727 (still open). Until #727 merges to main, this diff will
show #727's commits too (4 commits / 19 files instead of 2 / 14) — that's expected, not a
mistake. Once #727 merges, this PR's diff will automatically narrow to just its own two commits.
Please don't merge this before #727.

Description

Adds ingestion for NIP-90 DVM job request events (kind 5000-5999): the relay now recognizes these events, stores and broadcasts them like any other event, and records job state via the DvmJobRepository added in #727. No worker dispatch yet — that's a separate follow-up PR.

  • Added EventKinds.DVM_JOB_REQUEST_FIRST/DVM_JOB_REQUEST_LAST (5000/5999) to src/constants/base.ts, and isDvmJobRequestEvent() to src/utils/event.ts, following the same range-check pattern as isEphemeralEvent/isParameterizedReplaceableEvent.
  • New DvmJobRequestEventStrategy (src/handlers/event-strategies/dvm-job-request-event-strategy.ts):
    stores the event via eventRepository.create() and broadcasts it (job request events are still
    regular Nostr events, so clients/DVMs can query them normally), then records job state via
    dvmJobRepository.create(id, pubkey, kind) as a best-effort side effect — a job-repository
    failure is logged but never causes a valid event to be rejected.
  • Wired into eventStrategyFactory, checked early alongside the existing NIP-43 checks.
  • Threaded IDvmJobRepository through the factory chain that constructs the strategy:
    worker-factory.ts (constructs DvmJobRepository) → websocket-adapter-factory.ts
    message-handler-factory.tsevent-strategy-factory.ts.
  • Removed src/repositories/dvm-job-repository.ts from .knip.json's ignore list — it now has a
    real consumer, so the temporary entry added in feat(dvm): add dvm job persistence migration and repository #727 is no longer needed.

Related Issue

Fixes #728, part of #639

Motivation and Context

Kind 5000-5999 currently falls outside every existing event-kind range constant, so DVM jobrequests silently land in DefaultEventStrategy and are treated as plain events — no job state is tracked at all. This PR adds recognition and job-state recording so the persistence layer added in
#727 actually gets populated, without yet building the IPC dispatch logic that consumes it (kept separate to avoid a large, hard-to-review PR).

How Has This Been Tested?

  • New tests for isDvmJobRequestEvent (range boundaries), DvmJobRequestEventStrategy (event creation, job recording, broadcast behavior, duplicate handling, and that a job-repository failure doesn't reject the event), and eventStrategyFactory (dispatches to the new strategy for kind 5000 and 5999). Updated the four factory test files whose constructor signatures changed to thread the new repository through.
  • Ran the full local CI suite: pnpm lint, pnpm check:format, pnpm check:deps,
    pnpm run build:check, pnpm run build, pnpm run test:unit (1576 passing), pnpm run cover:unit,
    pnpm run docker:test:integration (99 scenarios / 489 steps passing).

Screenshots (if appropriate):

N/A — event ingestion change, no UI.

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
…ository

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
@changeset-bot

changeset-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ad58095

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 69.921% (+0.2%) from 69.748% — Priyanshubhartistm:feat/dvm-job-ingestion into cameri:main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants