Skip to content

feat(forestry-source): MultiPolygon, ring ≥ 4 positions and Point ⇒ Area ≤ 4 ha in v1.1.0 - #344

Closed
stiebitzhofer wants to merge 5 commits into
mainfrom
feat/forestry-source-geometry-336
Closed

stiebitzhofer wants to merge 5 commits into
mainfrom
feat/forestry-source-geometry-336

Conversation

@stiebitzhofer

Copy link
Copy Markdown
Member

Description

ForestrySource v1.1.0 gets the EUDR Information System geometry rules in place: MultiPolygon support, linear rings of at least 4 positions, and a Point feature must carry properties.Area between 0.0001 and 4 ha (TRACES accepts a Point only for plots up to 4 ha). ProducerCountry stays optional in v1.1.0 for backwards compatibility; the platform UI enforces it and the EU-minimum families (#335) will require it in the schema.

The eight geometry definitions are extracted to test/shared/forestry-geometry-block.json and the spec asserts the schema matches that canonical block, so ForestrySourceEU / ForestryOutputEU can share it byte-for-byte.

Related Issues

Type of Change

  • New feature (non-breaking change adding functionality) — MultiPolygon
  • Breaking change (fix or feature causing existing functionality to change) — ring ≥ 4 positions, Point ⇒ Area ≤ 4 ha (maintainer decision 2026-09-30 / 2026-10-03, in place)
  • Documentation update

Changes

  1. schemas/ForestrySource/v1.1.0/schema.json: new MultiPolygon definition (additionalProperties: false), accepted in Feature.geometry and GeometryCollection.geometries; PolygonCoordinates inner ring minItems 3 → 4 with a description stating the closure requirement the schema cannot enforce; Feature gets an if/then requiring properties.Area (0.0001–4) when geometry.type is Point; Area description updated.
  2. schemas/ForestrySource/v1.1.0/README.md: new "Geometry (harvest units)" section with the normative references and the ProducerCountry decision.
  3. test/shared/forestry-geometry-block.json: canonical geometry block; test/forestry-source-v1.1.spec.js asserts identity and adds the valid/invalid cases (MultiPolygon as feature and as collection member, empty MultiPolygon, 3-position rings, Point with Area 0.0001 / 3.5 / 4, Point without Area, Point with Area 0 / 4.0001 / 29.3, Polygon without Area, ProducerCountry absent).
  4. src/test/java/.../ForestrySourceV110SchemaTest.java: the same boundaries under networknt (draft 2019-09 if/then).
  5. Fixtures: five of nine v1.1.0 fixtures had Point features that TRACES rejects (two without Area, three with Points of 29.3–450 ha). DMP_01/09 get an Area within the limit (their PDFs regenerated: the harvest-units table now shows the area); DMP_02/03's 29.3 ha Points become closed Polygons; DMP_08's 450 ha Point becomes the MultiPolygon case; DMP_06 gains a MultiPolygon member inside a GeometryCollection. The latter four render text-identical PDFs, so their baselines are unchanged.

Testing

Manual Testing Performed

Testing steps:

  1. npx jest test/forestry-source-v1.1.spec.js test/validate.spec.js — 678 passed.
  2. mvn -o test -Dtest=ForestrySourceV110SchemaTest — 7 passed; mvn -o test -Dtest=RenderTest — 149 passed against the baselines.
  3. Re-rendered DMP_02/03/06/08 with json2pdf.js --include-remote-attachments and compared pdftotext output with the committed PDFs: identical. Regenerated DMP_01/09 the same way.

Tested environments:

  • Local development

👤 Manual Review Required

Author Self-Review

  • Code quality
  • Security: schema-only; every new array is bounded by the existing Coordinates shape, no new free text
  • Breaking changes: documented below
  • Documentation: v1.1.0 README updated

Production Deployment Impact

Breaking Changes

  • Breaking changes documented below

Breaking change details:

  • What breaks: a v1.1.0 certificate with a Point feature lacking properties.Area or with Area > 4 ha, or with a linear ring of 3 positions, no longer validates.
  • Migration steps: give small plots an Area ≤ 4 ha; describe larger plots as Polygon/MultiPolygon; close rings with ≥ 4 positions.
  • Backwards compatibility: the platform assigns every Point plot exactly 4 ha and always closes rings, so platform-published certificates stay valid. The 299-feature customer export from fep: ForestrySource v1.1.0 — accept MultiPolygon geometry and require ≥ 4 positions per polygon ring #327 was not available for re-validation. ProducerCountry deliberately stays optional.

Rollback Plan

  • Low risk - Standard rollback (revert commit)

Additional Context

Review Focus

  1. The if/then on Feature: AJV strict mode needs type: object and the required members declared in the same subschema; both validators agree on the boundary cases in the tests.
  2. The fixture conversions keep every PDF baseline except DMP_01/09; confirm the two regenerated PDFs look right.
  3. Ring closure is documented, not enforced — decide whether lib/validator should check it (deferred from fep: ForestrySource v1.1.0 — accept MultiPolygon geometry and require ≥ 4 positions per polygon ring #327).

🤖 Generated with Claude Code

…rea ≤ 4 ha in v1.1.0 (#336, #327)

Apply the EUDR Information System geometry rules to ForestrySource v1.1.0 in
place: add a MultiPolygon definition (feature geometry and GeometryCollection
member), require at least 4 positions per linear ring, and require
properties.Area between 0.0001 and 4 ha on a Feature whose geometry is a Point.
ProducerCountry stays optional for backwards compatibility.

Extract the geometry definitions to test/shared/forestry-geometry-block.json
and assert the schema matches it, so the EU-minimum families can share the
block. Add jest and networknt boundary tests.

Adjust five fixtures whose Point features TRACES would reject: small plots get
an Area within the limit (DMP_01/09, PDFs regenerated), 29.3 ha Points become
closed Polygons (DMP_02/03), the 450 ha Point becomes the MultiPolygon case
(DMP_08) and DMP_06 gains a MultiPolygon inside a GeometryCollection; those
four render text-identical PDFs, baselines unchanged.

Resolves #336. Resolves #327.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@eamon0989
eamon0989 temporarily deployed to s1-schemas-pr-344 October 5, 2026 12:20 Inactive
…ry until 1.2.2 clears the release-age window

The weekly Grype DB of 2026-10-06 flags two packages in ui/package-lock.json
on every branch, main included:

- postcss-selector-parser 6.1.4 (GHSA-rj75-hqrm-r3gf, Medium): quadratic
  selector parsing. Pinned to 7.1.6 via npm overrides; tailwindcss 3.4.3 and
  postcss-nested asked for ^6 but build identically against 7.1.6 — the Angular
  build output is byte-identical before and after.
- source-map-js 1.2.1 (GHSA-68fv-2mgg-jv7q, High): event-loop DoS on untrusted
  source maps. The fix, 1.2.2, was published 2026-09-30 and the repo's .npmrc
  (min-release-age=7) quarantines it until 2026-10-07. Reached only through
  postcss/sass inside the Angular CLI build, never deployed; accepted in
  .grype.yaml until the window clears, bump tracked in #348.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@stiebitzhofer
stiebitzhofer temporarily deployed to s1-schemas-pr-344 October 6, 2026 09:56 Inactive

This branch was previously deployed

1 inactive deployment
s1-schemas-pr-344 — 8fb4b1c6 Deployed Oct 6, 2026 by stiebitzhofer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Forestry Source Forestry Source

Projects

None yet

2 participants