Repository navigation
Conversation
Copy network-adapter#119's mandi-price.select.yaml, the file deployments fetch through AGMARKNET_MAPPING_URL. marketCode is optional (absent means the whole district), a marketName without marketCode is refused, state, district, commodity and validity dates are mandatory, and only the requested price fields are returned. The MandiPrice select example and the API collection's mandi select sent marketName without marketCode, which the new mapping refuses; both now carry marketCode 1634 (Rahuri APMC). Refs OpenAgriNet/network-adapter#119
Drops the guards the pack's schema already enforces.
Conflict in the API collection: kept development's #121 changes (bppId/bppUri, environments) and re-added marketCode 1634 to the mandi select body.
manjudr
left a comment
There was a problem hiding this comment.
1. No self review
Problem
The review on 95d3448 has the body "Done" and zero inline comments. Nothing on the diff.
Recommendation
Walk the three files and leave inline comments, then re-request review. This is the gate; the findings below are what a self review would have caught.
2. The benchmark select template still sends a market name with no code, so every benchmark run now gets a 400
Problem
benchmark/capabilities/mandiprice/templates/select.json sends "market": {"marketName": "{{MARKET_NAME}}", "district": "{{DISTRICT}}", "state": "{{STATE}}"}. It has no marketCode -- it is the only MandiPrice payload left in this repo that does not. benchmark/capabilities/mandiprice/config/select.yaml:11 points at it.
That is the exact payload the new mapping refuses at mandi-price.select.yaml:87.
Recommendation
Add "marketCode": "{{MARKET_CODE}}" to the template and define MARKET_CODE wherever MARKET_NAME is defined.
Two more inline.
manjudr
left a comment
There was a problem hiding this comment.
Re-reviewed at b3ba08f0. All four findings are still open and none has a reply. The eleven commits since are all "sync the mandi mapping with network-adapter#119".
1. Still no self review
Problem
The review on 95d3448 says "Done". The one on 6 Nov 06:10 also says "Done". Neither has a single inline comment on the diff.
Recommendation
Go through the three files and leave comments on them, then re-request review.
2. The benchmark select template still has no marketCode, so every benchmark run gets a 400
Problem
benchmark/capabilities/mandiprice/templates/select.json still sends "market": {"marketName": "{{MARKET_NAME}}", "district": "{{DISTRICT}}", "state": "{{STATE}}"}. grep -c marketCode on it returns 0, and it is still the only MandiPrice payload in this repo without one. benchmark/capabilities/mandiprice/config/select.yaml:11 points at it.
The mapping this PR ships refuses that payload at line 38.
Recommendation
Add "marketCode": "{{MARKET_CODE}}" to the template and define MARKET_CODE alongside MARKET_NAME.
Two more on the existing threads.
…ict-wide example [#122] The mapping refuses a market name without a code, so every benchmark select got a 400. The generator now copies marketCode from the published resource. district-wide.json selects a whole district with only district and state.
|
Benchmark finding fixed in 59dabb4: |
|
Re-review at
|
kelvinprabhu
left a comment
There was a problem hiding this comment.
Self Review Done
internal/shippedmappings holds the helmcharts base URL and one line per provider; each mapping test points its constant there. Refs OpenAgriNet/helmcharts#123 (review comment r4489737182) Refs #128 (review comment r4491627003)
Refs OpenAgriNet/helmcharts#123 (review comment r4489737182) Refs #128 (review comment r4491627003)
Drops internal/mappingurls; each mapping test holds its helmcharts URL. Refs OpenAgriNet/helmcharts#123 (review comment r4489737182) Refs #128 (review comment r4491627003)
manjudr
left a comment
There was a problem hiding this comment.
Re-reviewed at c3c7be0. The benchmark finding is fixed. The district-wide example was fixed and then un-fixed. Two new findings, one inline.
1. A fix was applied, reported as done, and then reverted
Problem
8ed2e01 added quick-start/capability-examples/MandiPrice/select/select (district-level).json, and the thread on select.json:55 says "Fixed in 8ed2e01". c3c7be0 deletes that file, with the commit body Refs #123 (review comment r4489737192) -- the same review comment that asked for it.
So the thread reads as resolved while the branch has gone back to where it started. quick-start/capability-examples/MandiPrice/select/ holds one file and it carries marketCode: "1634".
Recommendation
Restore the file from 8ed2e01. If it was dropped on purpose, say why on the thread and reopen it rather than closing it with a commit that removes the fix.
2. Still no self review
Problem
Three reviews on this PR, bodies "Done", "Done" and "Self Review Done". None carries an inline comment on the diff -- every comment by the author on this PR is a reply to one of mine.
59dabb4 changes benchmark/capabilities/mandiprice/tools/prepare-select-data/main.go, a Go file that was not in this PR when it opened and that nobody has commented on. Two more commits landed after "Self Review Done", one of them c3c7be0.
Recommendation
Walk the diff and leave comments on it, then re-request. This is the gate before a line-by-line review, and it has now been asked for twice.
3. The description quotes a 400 message the mapping does not emit
Problem
The body says:
marketNamewithoutmarketCode: 400market.marketName alone is not enough: send market.marketCode ...
quick-start/config/mappings/agmarknet/mandi-price.select.yaml:40 says:
market.marketName alone is insufficient; provide market.marketCode or omit market.marketName for district-wide search.
Recommendation
Quote the shipped string, or drop the quote and say the request is refused with a 400.
4. The state guard
Inline on quick-start/config/mappings/agmarknet/mandi-price.select.yaml:30. Raised on network-adapter#119 too, but it ships from here, so it blocks here.
Resolved
The benchmark template. 59dabb4 adds {{MARKET_CODE}} to templates/select.json:52 and fills it in prepare-select-data/main.go:340 from a.Market.MarketCode, which templates/catalog.json:74 writes as {{MARKET_ID}}. Traced end to end -- the published payload always carries a market code, so the generated selects do too.
The two copies of the mapping. Answer recorded: maintained by hand for now, mappings to come out of network-adapter in a follow-up. They are still byte-identical at 91ca538 -- I diffed them again. Link the follow-up issue on the thread so it does not get lost.
| $match($ra.market.district, /^[0-9]+$/) | ||
| and $match($ra.market.state, /^[A-Za-z]{2,4}$/) | ||
| /* Mandatory: Agmarknet refuses a call without statecode. */ | ||
| $exists($ra.market.state) |
There was a problem hiding this comment.
The state guard is weaker than the one on development
Problem
This check is existence only. The same guard on network-adapter's development checks the shape of both codes:
$match($ra.market.district, /^[0-9]+$/)
and $match($ra.market.state, /^[A-Za-z]{2,4}$/)
The mapping this PR ships keeps the district half and drops the state half.
The pack calls state a "State name or governed code" with minLength: 1 and no pattern (MandiPrice/v0.1/attributes.yaml:125-128), so "state": "Chattisgarh" is pack-legal, passes this check, and goes upstream as statecode=Chattisgarh. Agmarknet takes the code -- capability-examples/MandiPrice/select/select.json sends "state": "MH". The caller gets a signed, spec-valid "no prices" for a state that has prices.
This repo is what deployments fetch (AGMARKNET_MAPPING_URL), so this is the copy that fails in the field.
Recommendation
Fix it on network-adapter#119 and re-sync here. The check becomes:
$exists($ra.market.state)
and $count($match($ra.market.state, /^[A-Za-z]{2,4}$/)) > 0
There was a problem hiding this comment.
Fixed on OpenAgriNet/network-adapter#119 in 62f3d2bb and re-synced here in a2cc06b: state must match ^[A-Za-z]{2,4}$, so "Maharashtra" is refused with a 400. Test added: a state name where the upstream wants a code.
|
Finding 2 (self review) is withdrawn -- the self review is done, my mistake. Findings 1, 3 and 4 stand:
|
Merge readinessNot yet, and not before network-adapter#119. The state guard ( Worth doing in the same pass, none blocking on its own:
Order: network-adapter#119 first, then re-sync here and merge. Merging this ahead of #119 deploys a mapping the adapter repo has not agreed to yet. |
] Refs #123 (review comment r4509945972)
] Refs OpenAgriNet/helmcharts#123 (review comment r4509945972)
manjudr
left a comment
There was a problem hiding this comment.
Re-reviewed at a2cc06b. Everything I raised is addressed.
Resolved
The state guard. Fixed on network-adapter#119 in 62f3d2b and re-synced here in a2cc06b. I diffed the two copies again -- byte-identical.
The district-wide example. Answered: covered by TestShippedMappingSearchesTheDistrictWithoutAMarketCode rather than by an example file. Fine -- the behaviour is pinned somewhere, which was the point.
The two copies of the mapping. Follow-up named: network-adapter#127 / #128 removes the local copies and points the tests here. That is the mechanism I was asking for.
The description. Now quotes the shipped 400 string exactly, and says state must be a 2-4 letter code.
The benchmark template. 59dabb4, traced end to end earlier: {{MARKET_CODE}} is filled from a.Market.MarketCode, which templates/catalog.json:74 writes as {{MARKET_ID}}.
Approved. Merge after network-adapter#119, since this ships that mapping.
Refs OpenAgriNet/helmcharts#123 (review comment r4489737182)
Refs OpenAgriNet/helmcharts#123 (review comment r4489737182)
Closes #122
Depends on OpenAgriNet/network-adapter#119 (closes OpenAgriNet/network-adapter#107)
Changes
quick-start/config/mappings/agmarknet/mandi-price.select.yamlreplaced with network-adapter#119's mapping.AGMARKNET_MAPPING_URL,charts/registry-seed), not from network-adapter.capability-examples/MandiPrice/select/select.json:marketCode: "1634"added tomarket.marketNamewithout a code, which the new mapping refuses with a 400.api-collection/OpenAgriNet.api-collection.json: the same fix in the mandi select.Behaviour after this
marketCodegiven: that market. Absent (with nomarketName): the whole district.marketNamewithoutmarketCode: 400market.marketName alone is insufficient; provide market.marketCode or omit market.marketName for district-wide search.MH, notMaharashtra). Only the requested price fields come back.