feat(farmer_demo): seed large commercial farm with idle land for CEL demo (#1119) - #323
feat(farmer_demo): seed large commercial farm with idle land for CEL demo (#1119)#323emjay0921 wants to merge 4 commits into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #323 +/- ##
==========================================
- Coverage 72.24% 66.78% -5.46%
==========================================
Files 419 100 -319
Lines 29813 9789 -20024
==========================================
- Hits 21539 6538 -15001
+ Misses 8274 3251 -5023
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
gonzalesedwin1123
left a comment
There was a problem hiding this comment.
Clean, minimal, and it delivers exactly what the docs promised. What I verified:
idle_pctis a supported blueprint key (seeded_farm_generator.py:449), already used by two existing blueprints — so "no generator changes needed" is true.- The test's threshold lookup (
spp.farmer.smallholder_threshold, default"5.0") exactly mirrors the realis_smallholdercompute (spp_farmer_registry/models/farm.py:165), so the test tracks the actual logic rather than a copy of it. docs/USE_CASES.mdStory 9 already describes EC1 as implemented here — the data now matches the pre-existing docs, which is the right direction.- The test asserts through the real generator (
generate_all_farms([ec1])), not the blueprint dict. - The blueprint matches its neighbours' schema, and all-
Falseeligibility fits the deliberate rejection example.
Two items:
1. Blocker — version bump
Per the convention Edwin ruled on (see #391): bump + HISTORY in the PR, with the number assigned at merge-time rebase. Note this module now has a three-PR ordering — #412 already carries 19.0.2.1.2, so this and #322 take .3/.4 in whichever order they merge.
2. Minor — the USE_CASES inventory is now stale
docs/USE_CASES.md says "Total blueprints: 21. Total farms: ~730." and its blueprint table has no EC1 row — this PR makes both undercount. Please add the EC1 row and bump the totals (22 / ~731). Small, but that document is the reason this blueprint exists, so it should agree with it.
With those two, this is an approve.
Version bump with its changelog entry, per the convention that bumps land in the PR. The module now has three PRs in flight, so the concrete number is a merge-time reconciliation: #412 carries .2, this takes .4 and #322 takes .3. USE_CASES.md is the document this blueprint exists to serve, and it had no EC1 row while its totals still read 21 blueprints and ~730 farms — both undercounts as soon as this lands. The row is added and the totals now read 22 and ~731.
|
Thanks — both done. Pushed as 1. Version bump — 2. The stale inventory — fixed.
|
#412 landed the same module's 19.0.2.1.2, so the manifest version and the top of the changelog both conflicted. Resolved by keeping this branch's 19.0.2.1.4 and both changelog entries, newest first; README.rst and the description page are generated from readme/, so they were rebuilt rather than merged by hand.
Why is this change needed?
Docs Scenario 5 (Climate Resilience) STEP 4 contrasts the qualifying smallholder against EC1 — a large commercial farm (50 ha, idle) to show the CEL
r.is_group == true and is_smallholder and farm_size_idle > 0rejecting it onis_smallholdereven though it has idle land. No demo farm had bothis_smallholder = False(size above the 5 ha threshold) andfarm_size_idle > 0, so this exclusion couldn't be demonstrated (OP#1119).How was the change implemented?
bp_22_ec1_large_commercial_idletoFARMER_BLUEPRINTS: a 50 ha crop farm (count: 1) withidle_pct: 0.1(≈5 ha fallow) and all program eligibilityFalse(it's the deliberate rejection example). 50 ha > 5 ha threshold ⇒is_smallholder = False, andfarm_size_idle > 0.idle_pct, so no generator changes were needed. EC1 is volume-generated, matching the docs (USE_CASES Story 9 / EC1).New unit tests
test_1119_ec1_large_commercial_not_smallholder_with_idle— generates the EC1 blueprint and assertsfarm_total_size> smallholder threshold,is_smallholder == False, andfarm_size_idle > 0.Unit tests executed by the author
spp_farmer_registry_demosuite: 0 failed, 0 error(s) of 133 tests (fresh DB,--stop-after-init). The~730farm-count range tests remain green with the +1 farm.How to test manually
is_smallholder), while a smallholder with idle land qualifies.Related links
https://projects.acn.fr/work_packages/1119