Skip to content

GE Cloud: parse option validation text with bracketed labels without crashing (#5217) - #5218

Merged
springfall2008 merged 3 commits into
mainfrom
fix/gecloud-validation-paren-parse-5217
Sep 26, 2026
Merged

springfall2008 merged 3 commits into
mainfrom
fix/gecloud-validation-paren-parse-5217

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

This is an automated draft PR generated from issue #5217 — a maintainer should review it before merging.

Fixes #5217

Summary

select_event and publish_registers in gecloud.py both parsed Value must be one of: (a, b, c) validation strings with pre, post = validation.split("("). That raised ValueError: too many values to unpack whenever an option label contained a (. The exception escaped publish_registers, so the GE Cloud cycle for that site never completed.

Both sites now call one module-level helper, parse_validation_options(). It works like this:

  • It splits on the first ( and removes only the final ). Labels such as Export (AC3) come through intact; the old .replace(")", "") would have stripped their inner brackets.
  • It returns None when the string has no ( at all. The triage found that split("(", 1) on its own would still crash on these, with not enough values to unpack.

When a string can't be parsed, the caller logs a GECloud: Warn: line and falls back to the setting's in: validation-rule options. It no longer raises. Results for strings that already parsed correctly are unchanged.

Testing

  • ./run_pre_commit (from coverage/): all hooks passed, and the quick suite passed with it.
  • tools/triage_test.sh ge_cloud without the fix (gecloud.py stashed): 3 failed / 106 passed.
    • select_event_bracketed_options and publish_registers_bracketed_options fail with the reported ValueError: too many values to unpack.
    • parse_validation_options fails with an ImportError because the helper does not exist yet.
  • tools/triage_test.sh ge_cloud with the fix: 109/109 passed.

New tests in apps/predbat/tests/test_ge_cloud.py:

  • parse_validation_options: plain lists, bracketed labels, no bracket, a non-options validation string, empty string and None.
  • select_event_bracketed_options: a bracketed label is accepted and written, and an invalid option is still rejected. A validation string with no bracket falls back to the in: rule (accepts 2, rejects 3) and logs a warning.
  • publish_registers_bracketed_options: the select entity is published with its bracketed labels intact, and an unparseable string falls back to the in: options. Registers after the bad one are still published.

Notes

  • Blast radius: checked with GitNexus impact. publish_registers is MEDIUM (5 direct callers, all in gecloud.py); select_event is LOW (no static callers; it is dispatched by event). Neither signature changed. detect_changes reports low risk. The other symbols it lists as touched show up only because their line numbers moved.
  • Log volume: an unparseable string logs its warning on every publish_registers call, so about once per settings refresh for each affected setting. I left this as it is rather than adding state to log only once.
  • Commas inside labels: a label that itself contains , would still be split into two options. The old code had the same limitation. The issue does not show any such label, so I left it alone.
  • Triggering string unknown: we still don't know which validation string triggered this on the reporter's EMS + AC3 site. The tests use example labels. If someone captures the real string, it would make a good fixture.

🤖 Generated with Claude Code

…crashing (#5217)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@springfall2008 springfall2008 self-assigned this Sep 24, 2026
@springfall2008 springfall2008 added the BOT_REVIEW Trigger an autotriage label Sep 24, 2026
Comment thread apps/predbat/gecloud.py
Comment thread apps/predbat/gecloud.py
Comment thread apps/predbat/gecloud.py
Comment thread apps/predbat/gecloud.py Outdated
Comment thread apps/predbat/gecloud.py Outdated
@springfall2008 springfall2008 added BOT_CLEANUP Trigger: bot should address PR review feedback and CI failures, then commit and push and removed BOT_REVIEW Trigger an autotriage labels Sep 24, 2026
CI and others added 2 commits September 26, 2026 11:09
…warn once, non-string guard

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@springfall2008 springfall2008 removed the BOT_CLEANUP Trigger: bot should address PR review feedback and CI failures, then commit and push label Sep 26, 2026
@springfall2008
springfall2008 marked this pull request as ready for review September 26, 2026 12:18
@springfall2008
springfall2008 merged commit 889d695 into main Sep 26, 2026
2 checks passed
@springfall2008
springfall2008 deleted the fix/gecloud-validation-paren-parse-5217 branch September 26, 2026 12:18
springfall2008 added a commit that referenced this pull request Sep 28, 2026
…9-28

docs(debug-journal): fold in the 2026-09-28 queue slice (15 candidates); mark GH#5217 fixed by PR #5218, correct entries overtaken by PR #5245/#5267/#5147
philicibine pushed a commit to philicibine/batpred that referenced this pull request Sep 28, 2026
…s); mark GH#5217 fixed by PR springfall2008#5218, correct entries overtaken by PR springfall2008#5245/springfall2008#5267/springfall2008#5147

Co-Authored-By: Claude Code <noreply@anthropic.com>
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.

GE Cloud: setting validation text with more than one '(' crashes gecloud component (ValueError: too many values to unpack)

1 participant