[BUG](cli) `validate` reports a mistyped `theme` as a segment subtype error

Open
#872 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli, testing

Research direction

Start in cli/error_formatting.py, especially select_most_likely_errors and _suppress_sibling_tag_noise, and trace how the DivisionArea and empty-model error groups are ranked. Reproduce with the division_area/region_land.yaml example after changing its theme as described. Done when validation reports the theme error instead of hiding it behind the segment union tag error; the payload names no specific test.

Written by the indexing model from the issue text.

Description

overture-schema validate does not report a wrong theme on a division_area. Copy reference/examples/divisions/division_area/region_land.yaml to typo.yaml, change theme: divisions to theme: division, and run COLUMNS=80 overture-schema validate typo.yaml. With #837 applied it exits 1 and prints:

  (root)
    → Input tag 'region' found using get_discriminator_value() does not match 
any of the expected tags: <SegmentSubtype.ROAD: 'road'>, <SegmentSubtype.RAIL: 
'rail'>, <SegmentSubtype.WATER: 'water'>

Before #837 the same command printed the theme error, behind an "Ambiguous" warning:

  ⚠ Ambiguous: Data matches multiple types equally. Consider:
    • Specifying --tag or --type to narrow validation
    • Adding discriminator fields to clarify intent

 ─ Validation Failed ────────────────────────────────────────────────────────── 
        ...                                                                     
   geometry    MultiPolygon                                                     
      theme      "division" ← Input should be 'divisions'                       
       type "division_area"                                                     
        ...                                                                     
 ────────────────────────────────────────────────────────────────────────────── 

The error now printed comes from the segment union, which is discriminated on subtype. region is the division area's subtype, and no segment takes it. The feature's real mistake, theme, is missing from the output.

The CLI groups each item's errors by the model that produced them, and select_most_likely_errors (cli/error_formatting.py) shows the best group. Here there are two groups. The DivisionArea group has the literal_error on theme. The other has the segment union's union_tag_invalid, which no model produced, so its group key is empty. _suppress_sibling_tag_noise keeps both: the tag error is not one it treats as redundant, because region is no segment's subtype. #837 ranks each group by a pair, (tag fields among theme, type and subtype that the group's model rejected, error count), lowest first. DivisionArea rejected theme and scores (1, 1). The empty group has no model, so it rejects nothing and scores (0, 1), and its tag error is shown alone.

Before #837 the groups were ranked by error count alone. They tied at one error each, which produced the "Ambiguous" warning, and the panel showed the theme error.

The same happens for any feature whose subtype no segment takes. Copying each of reference/examples/base/land-sand-example.yaml (subtype: sand, theme: bas), buildings/building-polygon.yaml (subtype: transportation, theme: building) and divisions/division/capital_of.yaml (subtype: locality, theme: division) with that one-line theme edit prints the segment union's Input tag '<subtype>' error. Before #837 each printed its theme error under the same warning.

This came up in review of #837, and this issue follows up on it.

Dominant language
Python
Stars
219
Forks
20
Avg merge
1d 21h
Merged PRs (30d)
37

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OvertureMaps/schema

All issues in OvertureMaps/schema

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.