Skip to content

Fix double boolean conversion in format_list#3

Open
z-image wants to merge 1 commit intoljadach:mainfrom
z-image:fix/format-list-double-conversion
Open

Fix double boolean conversion in format_list#3
z-image wants to merge 1 commit intoljadach:mainfrom
z-image:fix/format-list-double-conversion

Conversation

@z-image
Copy link
Copy Markdown
Contributor

@z-image z-image commented Mar 3, 2026

Summary

  • parse_lists_response converts RTM string values ("1"/"0") to booleans
  • format_list then compared these booleans against "1" again (True == "1"False)
  • This caused all smart lists to appear as smart: false in get_lists output
  • Also affected archived and locked fields

Test plan

  • All 30 existing tests pass
  • get_lists now correctly shows smart: true for smart lists (1MTD, 1MTD Now, etc.)

parse_lists_response already converts string "1"/"0" to boolean,
but format_list compared the result against "1" again, causing
True == "1" to evaluate to False. This made all smart lists
appear as non-smart in get_lists output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@ljadach ljadach left a comment

Choose a reason for hiding this comment

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

Thanks for identifying this bug — the double boolean conversion is real and well-diagnosed!

However, the fix introduces a regression in other code paths. format_list() is called from two places:

  1. get_lists (via parse_lists_response) — input has already been converted to booleans (True/False). Your fix works correctly here.
  2. add_list, rename_list, archive_list, unarchive_list — these pass raw RTM API responses directly to format_list(), where the values are still strings ("1"/"0"). After this change, those paths would return raw strings instead of booleans.

A more robust fix would be one of:

  • Make format_list handle both input types, e.g. "smart": lst.get("smart") in (True, "1")
  • Remove the conversion from parse_lists_response and let format_list be the sole converter
  • Stop calling format_list on already-parsed data in get_lists

The test change also masks this by switching inputs from strings to booleans, which no longer covers the raw API string path.

Would you be open to adjusting the fix to handle both caller contexts?

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