feat(dvm): trap NIP-90 job request events and record them via job repository - #729
Open
Priyanshubhartistm wants to merge 4 commits into
Open
feat(dvm): trap NIP-90 job request events and record them via job repository#729Priyanshubhartistm wants to merge 4 commits into
Priyanshubhartistm wants to merge 4 commits into
Conversation
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 detectedLatest commit: ad58095 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DvmJobRepositoryadded in #727. No worker dispatch yet — that's a separate follow-up PR.EventKinds.DVM_JOB_REQUEST_FIRST/DVM_JOB_REQUEST_LAST(5000/5999) tosrc/constants/base.ts, andisDvmJobRequestEvent()tosrc/utils/event.ts, following the same range-check pattern asisEphemeralEvent/isParameterizedReplaceableEvent.DvmJobRequestEventStrategy(src/handlers/event-strategies/dvm-job-request-event-strategy.ts):stores the event via
eventRepository.create()and broadcasts it (job request events are stillregular 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-repositoryfailure is logged but never causes a valid event to be rejected.
eventStrategyFactory, checked early alongside the existing NIP-43 checks.IDvmJobRepositorythrough the factory chain that constructs the strategy:worker-factory.ts(constructsDvmJobRepository) →websocket-adapter-factory.ts→message-handler-factory.ts→event-strategy-factory.ts.src/repositories/dvm-job-repository.tsfrom.knip.json's ignore list — it now has areal 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
DefaultEventStrategyand 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?
isDvmJobRequestEvent(range boundaries),DvmJobRequestEventStrategy(event creation, job recording, broadcast behavior, duplicate handling, and that a job-repository failure doesn't reject the event), andeventStrategyFactory(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.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
Checklist: