Feat/91 agrifacilities plugin - #15
Conversation
0d30731 to
940255f
Compare
8915a56 to
e0e6d15
Compare
ameersohel45
left a comment
There was a problem hiding this comment.
Reviewed the AgricultureFacility plugin and the POCRA mapping.
The mapping is careful work — the field-level reasoning is documented better than most production code, $clean scrubbing POCRA's "Unknown"/"N/A"/"000000" placeholders is right, refusing to synthesise a location from the search origin is right, and the PROVISIONAL marker on the unconfirmed query convention is honest. Fetching the pack from schema-packs-v0.1 instead of vendoring it is a good change, and I verified both pack URLs return 200. The plugin itself is 43 lines with an empty prerequisites map — exactly the shape the architecture promises for provider #3.
Two blocking findings below, both reproduced against the shipped mapping through the real mapper, and both failing the entire response rather than dropping one facility. One should-fix on the schema cache. The rest are minor.
d6033a8 to
6f3ab95
Compare
Code reviewFound 3 issues:
network-adapter/core/module/handler/stdHandler.go Lines 249 to 263 in e0e6d15 network-adapter/core/module/handler/responsestep.go Lines 330 to 347 in e0e6d15
network-adapter/config/local-simple.yaml Lines 55 to 60 in e0e6d15
network-adapter/pkg/plugin/implementation/internal/upstream/upstream.go Lines 797 to 800 in e0e6d15 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
|
@kelvinprabhu - there are conflicts in the PR - please resolve them |
c481e7a to
5fcfb2f
Compare
c408a41 to
1b902a7
Compare
🛡️ Trivy security scan (CRITICAL,HIGH,MEDIUM,LOW)Go dependenciesNo findings at CRITICAL,HIGH,MEDIUM,LOW. Container imageNo findings at CRITICAL,HIGH,MEDIUM,LOW. |
5fcfb2f to
9a1594f
Compare
…comment [#16] Both subscriberId occurrences become `<>`, with the value that was there kept beside them as `[#16] was: provider-network-vistaar.da.gov.in`. A reference config that ships one deployment's real network identity invites it being copied into another, and the id is not reusable: the registry cannot update a published key and its delete is soft, so a second deployment claiming the same id has no way out of it. Both, not one. The handler's id and the keyManager's have to agree -- the second is what the signer puts in the Authorization header's keyId -- so placeholdering only one would have produced a config that signs as a participant it does not claim to be, which fails at a peer rather than here. Nothing loads this file, so nothing breaks: it is a reference, and the placeholder is the point. It parses as YAML, and the value reads back as the string "<>" rather than tripping the parser. Also cleared the organisation name from three comments in the same file, which the earlier sweep missed because it only looked at Go comments and not YAML. [#16] Please enter the commit message for your changes. Lines starting [#16] with '#' will be ignored, and an empty message aborts the commit. [#16] [#16] Date: Mon Sep 7 18:02:45 2026 +0530 [#16] [#16] interactive rebase in progress; onto 983affb [#16] Last commands done (6 commands done): [#16] reword 6385051 refactor: name the registry and binding packages for what they are [#16] [#16] reword 9ebb5c1 docs(config): placeholder the subscriber id, keep the old value in a comment [#16] [#16] No commands remaining. [#16] You are currently editing a commit while rebasing branch 'tmp/rebase-16' on '983affb'. [#16] [#16] Changes to be committed: [#16] modified: config/provider-adapter.yaml [#16]
…lity - Introduced a new file `prerequisites.go` in the agrifacility implementation. - Defined an empty prerequisites variable to handle upstream requirements for agriculture facility capabilities. - Documented the rationale for keeping the payload explicit and avoiding unnecessary entries.
…Facility validation
…oding pack URL
… the mapping scrubs The README predated two changes and contradicted both: the placeholder list omitted "-", which the warehouse BPP uses for a phone it does not have, and nothing said @context is echoed from the request rather than restated. Also states what conformance_test.go covers, and why the pack's own examples are validated -- every other result in that file is worthless if the schema was compiled too loosely to reject anything. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Follows the convention a1db4e7 set for the other two: the package, the built .so and the id a deployment names in providerSteps are all the capability's own local name, so which plugin owns a binding key is readable from the key. mandi became MandiPrice and weather became WeatherObservation; agrifacility becomes AgricultureFacility. A directory rename carries the id with it, since the .so basename IS the id. docs/agrifacility-testing.md moves with it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…hing mechanism and context handling
… httpStatusError type
1b902a7 to
bd0d4c4
Compare
…Verify (upstream_test.go). Verified clean with go test -race -count=3 ./pkg/plugin/implementation/internal/upstream/....
|
@kelvinprabhu - This PR contains a Claude co-auther information and also contains unclear commit messages - can you please do the fresh PR with proper commits? |
|
📊 Test Coverage: ✅ Passed — 91% of changed lines covered, min 80% |
note : its branch on top of the feat/9-mandi-plugin will have contents of both
Serves
openagrinet:AgricultureFacilityfrom POCRA's aggregator API, as aprovider step on the existing
internal/upstreammachinery.One capability answers all four governed facility types — Krishi Vigyan Kendra,
Custom Hiring Centre, Warehouse, Soil Testing Facility. Which one a request
wants is a value in its payload, not a binding key, so there is one registry row
and one mapping file rather than four of each.
Closes beckn#91.
What is here
authScheme: none— POCRA's search takes no credential, which is also why itsbaseUrlcan be published as it stands.Schema pack conformance
Follows
openagrinet:AgricultureFacilityv0.1 Direct mode, fromOpenAgriNet/network-specs@schema-packs-v0.1.Two of the pack's own mapping rules shaped the answer directly:
POCRA returns no verified per-facility coordinate — the single
gpsin itsanswer is a fixed stub unrelated to the point asked for — so the answer carries
addressand nolocation. Direct mode permits that.Distance is parsed, used to order the resources nearest-first, and then dropped.
The ranking POCRA computed survives; nothing is invented.
Also absent, and deliberately:
services,capacityfor non-warehouses,website,lastUpdatedAt. POCRA supplies none of them. Deriving services fromthe facility type, or
lastUpdatedAtfrom the time of the fetch, would assertsomething nobody verified.
contact.webUrlis POCRA's own site repeated onevery item, so it goes to
source.sourceUrirather thanwebsite."Unknown","N/A","000000"and"-"are treated as absent, so a field isomitted rather than published as a placeholder.
Adding a facility type
Three lines in the mapping — the forward table, the inverse table, and the
precondition's list of accepted values. No registry row, no config change, no
rebuild, live on the next mapping cache expiry.
CustomHiringCentrechcKrishiVigyanKendrakvkWarehousewarehouseSoilTestingFacilitysoil_labThat table is the only place POCRA's private vocabulary appears anywhere.
Pocra is tightly coupled with the Maharastra boundaries
Testing
mappings_test.goruns the shipped mapping file through the realjsonmapperand the real step against a fake POCRA. It reads fromconfig/mappings/pocra/rather than an inline copy, so it fails when what isdeployed fails.
live_test.goruns against the real API. It routes through a recording proxy soone call answers two questions — what POCRA returned, and what the mapping made
of it — because
0 facilitiesis otherwise ambiguous between "POCRA had nothing"and "the mapping dropped everything", and only one of those is a bug. It skips
rather than passes when the upstream had nothing to say, and the leak test skips
rather than passes when POCRA did not misbehave that run.