Skip to content

feat(monetize): ServiceOffer type=dataset — CRD, catalog & x402 extras wiring (P1)#640

Open
bussyjd wants to merge 1 commit into
mainfrom
feat/dataset-offer-p1
Open

feat(monetize): ServiceOffer type=dataset — CRD, catalog & x402 extras wiring (P1)#640
bussyjd wants to merge 1 commit into
mainfrom
feat/dataset-offer-p1

Conversation

@bussyjd

@bussyjd bussyjd commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

P1 — ServiceOffer type=dataset (declarations + pipeline wiring)

First slice of the decentralized fine-tuning plan: make a versioned dataset a first-class type=dataset ServiceOffer so the existing controller→Middleware→HTTPRoute→ForwardAuth→catalog pipeline publishes and gates it with no new serving code. This PR is declarations + pipeline glue + parity tests only — it deliberately does not build the dataset server, version log, or download client (later phases).

What it adds

Surface Change
CRD (internal/monetizeapi/types.go) dataset added to spec.type enum; new ServiceOfferDataset{manifestHash, version, fileHash, sizeBytes} spec block (mirrors ServiceOfferAgent); PriceTable.PerMB; IsDataset() helper
Verifier extras (internal/x402) RouteRule.Dataset* fields; routeRuleFromOffer dataset branch (hashes lowercased); effectivePrice perMB case; mergeDatasetExtras() adds accepts[].extra.dataset{manifestHash,version,fileHash,sizeBytes} to the 402, wired after mergeAgentExtras
Catalog (internal/schemas, render.go) dataset in the catalog type enum + perMB in priceUnit enum + 3 additive dataset* properties; ServiceCatalogEntry.Dataset* fields; populated in buildServiceCatalogJSON; perMB handled in offerPriceRawAndUnit + describeOfferPrice
Generated serviceoffer-crd.yaml + zz_generated.deepcopy.go regenerated via just generate (committed)

Deliberately unchanged (parity with http)

  • normalizeOfferType folds datasethttp render branch (a download isn't chat-completions) → generic 402 copy + bazaarGenericJSON. No bespoke datasetCopy() / chat schema. Dataset metadata reaches buyers only via extra.dataset.
  • No obol sell dataset CLI, no server, no download/versionlog — those are P2/P3.

Tests (matching the other types)

  • TestServiceOfferCRD_Fields extended (enum + spec fields) + new TestServiceOfferCRD_DatasetFields (dataset block schema + perMB)
  • dataset_extras_test.go: noop / all-fields / nil-extra / omit-zero / additive-preservation (mirrors agent_extras_test.go)
  • TestRouteRuleFromOffer_DatasetAdvertisesDatasetMetadata (lowercasing + perMB price + all 4 fields)
  • TestBuildServiceCatalogJSON_DatasetOfferSurfacesVersion + …_NonDatasetOmitsDatasetFields (omitempty)
  • TestBuildBazaarExtension dataset case; TestFallbackOfferType dataset case; TestDescribeOfferPrice perMB (USDC + OBOL)
  • TestHTMLAware_DatasetUsesGenericHTTPCopy (pins the http-fold)

Status

just generate clean (no drift), go build ./... clean, go vet clean, full go test ./... green. Net diff: 15 files, +415/−11 (~190 LOC production, rest tests + generated).

…s wiring

P1 of the decentralized fine-tuning plan: make a versioned dataset a
first-class type=dataset ServiceOffer so the existing
controller -> Middleware -> HTTPRoute -> ForwardAuth -> catalog pipeline
publishes and gates it with no new serving code. Declarations + pipeline
wiring + parity tests only; the dataset server/versionlog/download client
are later phases.

- CRD: dataset enum value; ServiceOfferDataset{manifestHash,version,
  fileHash,sizeBytes} spec block (mirrors ServiceOfferAgent);
  PriceTable.PerMB; IsDataset(); regenerated serviceoffer-crd.yaml + deepcopy.
- x402: RouteRule.Dataset* fields; routeRuleFromOffer dataset branch
  (hex digests lowercased); effectivePrice perMB; mergeDatasetExtras()
  adds accepts[].extra.dataset{...} to the 402, wired after mergeAgentExtras.
- catalog: schema type enum + perMB priceUnit + additive dataset* properties;
  ServiceCatalogEntry.Dataset*; buildServiceCatalogJSON population; perMB in
  offerPriceRawAndUnit + describeOfferPrice.
- dataset folds to the http render branch in normalizeOfferType (a download
  is not chat-completions): generic 402 copy + bazaarGenericJSON, no bespoke
  copy. Version metadata reaches buyers only via extra.dataset.
- parity tests across CRD fields/block, mergeDatasetExtras, route-rule,
  catalog surface + omitempty, bazaar, fallbackOfferType, describeOfferPrice
  (incl. perMB precedence), and the HTML 402 copy fold.

go build/vet, full go test ./..., and just generate (idempotent) all green.
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.

1 participant