Skip to content

fix(sds): hide field options that come back as an empty list - #802

Merged
albert-tb merged 1 commit into
mainfrom
tejas/ex-2811
Sep 29, 2026
Merged

albert-tb merged 1 commit into
mainfrom
tejas/ex-2811

Conversation

@albert-tb

@albert-tb albert-tb commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What

An SDS field the tenant has not configured no longer shows up as a question. Viscosity - SDS Output, pH - SDS Output, and the other Section 9 fields that come back as a bare empty list are now hidden.

Why

Those entities are not in the TEN1 or TEN5 field configuration. The field-options endpoint returns [] for them, with no display flag. get_field_options stored every list as displayed, so Ask Albert rendered them as free-text inputs. EX-2811.

How

A bare empty list means the field is not configured, so display is false. A non-empty list is still the option list and stays displayed. An object that already says display: true is unchanged, including a free-text field whose data is empty.

Testing

  • uv run ruff format src/albert/collections/sds.py tests/unit/collections/test_sds.py
  • uv run ruff check src/albert/collections/sds.py tests/unit/collections/test_sds.py
  • uv run pytest tests/unit/collections/test_sds.py -v

SDK Changes

sds.get_field_options reports display=False when the field-options response is an empty list.

An unconfigured SDS entity is a bare empty list with no display flag.
Treating every list as displayed turned those into free-text questions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@claude

claude Bot commented Sep 28, 2026

Copy link
Copy Markdown

Code Review

The fix is correct: display=bool(payload) maps a bare empty list to display=False while preserving the non-empty and explicit-object cases. No bugs or correctness issues.

Two minor pattern notes (not blocking):

  • src/albert/collections/sds.py:194 Stray run of spaces in the docstring (after flash_point) — collapses fine in rendered markdown but reads oddly in source; worth tidying.
  • tests/unit/collections/test_sds.py OPINIONS.md says don't unit-test public collection methods (extract branching into a pure helper and test that). Here it's transport-faked (responses) and asserts on how the SDK reacts to each response shape, so it's defensible for a one-line branch, but it deviates from the stated convention.

Summary: 0 bugs found. Fix is correct and well-tested; only minor style/convention nits.

@albert-tb
albert-tb merged commit c9c7884 into main Sep 29, 2026
7 checks passed
@albert-tb
albert-tb deleted the tejas/ex-2811 branch September 29, 2026 18:13
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.

2 participants