Skip to content

702: nicer error when entities update specified but entity list not attached - #859

Merged
lindsay-stevens merged 5 commits into
XLSForm:masterfrom
lindsay-stevens:pyxform-702
Aug 6, 2026
Merged

702: nicer error when entities update specified but entity list not attached#859
lindsay-stevens merged 5 commits into
XLSForm:masterfrom
lindsay-stevens:pyxform-702

Conversation

@lindsay-stevens

Copy link
Copy Markdown
Contributor

Closes #702

Why is this the best possible solution? Were any other approaches considered?

Branch based on deps-update / PR 853 branch so only commit 42bc8ab is relevant.

Catches the missing secondary instance reference to show a nicer and more specific error message. Per commit message:

this problem is caught by ODK Validate, but the error is somewhat cryptic since it refers to instance() expressions generated by pyxform for entity attributes (as shown in the replaced test test_implicit_update_mode__instance_required__error).

Also includes a couple of seemingly straightforward refactoring improvements in code updated for / nearby 42bc8ab:

  • a1d07b1 refactor selects validation/processing into type branches
  • f4bda32 replace missing list_name error with detailed errorcode message

What are the regression risks?

Low risk. An external tool or training material may expect the ODK Validate message. The selects refactoring passes existing tests, although as noted in f4bda32 there are some seemingly obvious / basic scenarios that don't (or didn't) have tests.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run python -m unittest and verified all tests pass
  • run ruff format pyxform tests and ruff check pyxform tests to lint code
  • verified that any code or assets from external sources are properly credited in comments

- this problem is caught by ODK Validate, but the error is somewhat
  cryptic since it refers to instance() expressions generated by pyxform
  for entity attributes (as shown in the replaced test
  test_implicit_update_mode__instance_required__error).
- xls2json.py: existing secondary_instances tracking to include the
  file type, update question_types/geo.py accordingly
- previously the code seemed to be repetitively and inconsistently
  identifying the select types, so now there's 3 distinct branches:
  external selects, internal selects, select_from_file.
- now suggests adding a list or checking spelling.
- it seems there was no existing test for the old message so new tests
  are added for the pass/fail cases.
- commit 29cf8c2 refactored or_other tests and added this test case,
  which now needs to reference the error message added in c1e273b.
- although pyproject.toml specifies the flit_core version under the
  build-system section, pip doesn't read that. The flit project doesn't
  have an upper bound on flit_core dependency so when a newer version
  released with a breaking API change, it broke the build.
@lindsay-stevens

Copy link
Copy Markdown
Contributor Author

Rebased on top of all other PRs merged today. Compared to code previously requested for review:

  • the first 3 commits are the same as before
  • commit 98882dd fixes a merge conflict from remove-xls branch
  • commit 548ee3f fixes CI build error due to recent flit release

@lognaturel lognaturel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good new test cases for missing choice list declarations and the rework around different kinds of selects looks good 👍

@lindsay-stevens
lindsay-stevens merged commit 26006d0 into XLSForm:master Aug 6, 2026
14 checks passed
@lindsay-stevens
lindsay-stevens deleted the pyxform-702 branch August 6, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when entities update specified, but entity list not attached

2 participants