Repository navigation
fix(mappings): follow network-specs #12/#13, and name a knowledge source by its title - #36
Merged
Merged
Conversation
Brings this repo's mappings back in line with the copies helmcharts serves, which drifted when OpenAgriNet/helmcharts#25 landed there first. The three files are now byte-identical to that branch again; pocra already was. THREE CHANGES, two of them the schema pack's. network-specs#12 -- a resolved location is a Beckn Location, with the GeoJSON under `geo`. The weather mapping both emits one and READS one, and all four sites move: what it writes, the `required:` precondition, the request half's $lat/$lon, and the response half's $asked echo. network-specs#13 -- MandiPrice drops the singular `commodity`; supportedCommodities is the one coded collection in both modes. ONE entry per resource, because a Direct Resource's single prices object applies to every commodity listed and this mapping emits one resource per price record. And sourceName is hits[].name_en rather than hits[].filename -- a document title ("Karnataka Gruha Jyoti Scheme Guidelines") instead of the ingestion pipeline's artefact name ("doc-d7124029cb60-rerun-1788841718"). No fallback: a document with no name_en gets "", because the blank reports a gap in the corpus where a filename would hide it behind something that looks like an answer. THE TESTS ARE THE WORK HERE. They encoded the old shapes, so each had to be re-argued rather than mechanically flipped: WeatherObservation the inbound fixture and the precondition helper both wrap the geometry, so the refusal cases -- polygon, line string, multipoint, absent -- still exercise the shape the mapping actually reads MandiPrice supportedCommodities moves from the must-NOT-appear list to the required one, and a new assertion pins exactly one entry carrying a code KnowledgeAdvisory the captured providerResponse predates name_en, so the four hits gain the titles their two documents really carry; the assertion now refuses a "doc-" prefix outright TestShippedMappingLeavesAnUnnamedSourceBlank is new and covers the case the change exists to produce: name_en absent, empty, and whitespace-only all yield "" while sourceId survives. It carries a negative control -- restoring the filename fallback fails all three with `sourceName = "doc-d1", want ""`. Based on release-0.0.1 rather than development: pocra's mapping there is already identical to helmcharts', and development is behind on it, so basing there would have meant porting or regressing someone else's work. go build, go vet, the full go test ./pkg/... and a -race pass over all four capability plugins are green.
🛡️ Trivy security scan (CRITICAL,HIGH,MEDIUM,LOW)Go dependenciesNo findings at CRITICAL,HIGH,MEDIUM,LOW. Container image
|
|
📊 Test Coverage: ➖ Not applicable — no non-test Go files changed vs |
manjudr
approved these changes
Sep 15, 2026
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.
Summary
Brings this repo's mappings back in line with the copies helmcharts serves. They drifted when helmcharts#25 landed there first; the three files are byte-identical to that branch again, and
pocraalready was.Three changes, two of them the schema pack's:
Location, GeoJSON undergeo.commodity;supportedCommoditiesis the one coded collection in both modes.sourceNameis the document's title, not the ingestion pipeline's filename.Both upstream PRs are merged and their packs are published, so nothing here is waiting on anything.
Changes
#12 — location becomes a Beckn Location
The weather mapping both emits a location and reads one, and all four sites move:
{type, coordinates}{geo: {type, coordinates}}required:preconditionlocation.typelocation.geo.type$lat/$lonlocation.coordinateslocation.geo.coordinates$askedlocation.coordinateslocation.geo.coordinatesThe read sites are the ones worth noting — converting only the write half refuses every select with
SCH_INVALID_FORMAT: this capability needs a Point location, which reads like a bad payload and is actually the precondition looking where the geometry no longer is. That was caught inoan-localon the helmcharts side, not in review.response.location.latis untouched: that is the upstream's response shape, not Beckn's.#13 — commodity folds into supportedCommodities
One entry per resource, not the caller's whole list. From that PR's compatibility note: a Direct resource's single
pricesobject applies to every commodity listed. This mapping emits one resource per price record, each with its own prices — so listing more would claim that row's prices for commodities it never priced.The
codestays the caller's and thenamethe record's, because the upstream takes a commodity code and answers with a name only.marketneeded nothing: #13 relaxes it to ananyOfacrossmarketCode/marketName/district/state/location, and this mapping already emits three of the five.sourceName is the document's title
No fallback, and the blank is the point. A document with no
name_engets"". Falling back tofilenamehides the gap behind something that looks like an answer but names nothing a reader can place; omitting the key leaves a consumer unable to tell "this document has no name" from "the provider reported nothing".sourceIdsurvives either way, so the passage stays attributable.title_enis not a third candidate — it exists on the hit and comes back empty on this corpus.The tests are the work here
They encoded the old shapes, so each had to be re-argued rather than mechanically flipped.
WeatherObservation — the inbound fixture and the precondition helper both wrap the geometry, so the refusal cases (polygon, line string, multipoint, absent) still exercise the shape the mapping actually reads rather than passing for the wrong reason.
MandiPrice —
supportedCommoditiesmoves from the must-NOT-appear list to the required one, and a new assertion pins exactly one entry carrying acode.KnowledgeAdvisory — the captured
providerResponsepredatesname_en. The live provider returns it today, so the four hits gain the titles their two documents really carry; that makes the fixture current rather than fictional. The assertion now refuses adoc-prefix outright, so a silent regression to filenames fails loudly.New:
TestShippedMappingLeavesAnUnnamedSourceBlankcovers the case the change exists to produce —name_enabsent, empty, and whitespace-only all yield""whilesourceIdsurvives.Testing
go build ./...,go vet, and the fullgo test ./pkg/...are green-racepass over all four capability pluginssourceName = "doc-d1", want ""release-0.0.1oan-localon the helmcharts side — weather and mandi selects both answeringon_selectagainst the merged packsNotes
Based on
release-0.0.1, notdevelopment.pocra's mapping onrelease-0.0.1is already identical to helmcharts', anddevelopmentis behind on it — basing there would have meant either porting someone else's POCRA work as a side effect or silently regressing it.developmentis still behind on all four mappings and will need the same sync, including thepocrachanges from helmcharts#20 and #21 that never came back here. Worth doing as its own pass rather than folding in here.