Skip to content

fix(microskills): guard parse_payload against wrongly-typed proposer fields - #198

Open
Tejas Lamba (TejasLamba2006) wants to merge 1 commit into
microsoft:mainfrom
TejasLamba2006:fix/parse-payload-type-guards
Open

Tejas Lamba (TejasLamba2006) wants to merge 1 commit into
microsoft:mainfrom
TejasLamba2006:fix/parse-payload-type-guards

Conversation

@TejasLamba2006

Copy link
Copy Markdown
Contributor

Summary

When the proposer returns wrongly-typed fields, parse_payload crashes instead of filtering them out, causing the session to stay pending and retry the proposer on every session start.

Changes

  • obj.get("extractors", []) returns None (not []) when the key exists with value null. Changed to obj.get("extractors") or []
  • Filter extractors with non-string pattern field
  • Filter facts with non-dict detector field
  • Guard _rx() against non-string input

Test plan

Inline verification:

parse_payload('{"extractors": null, "facts": []}')  # was TypeError, now ([], [])
parse_payload('{"extractors": [{"name": "x", "pattern": [1,2]}], "facts": []}')  # filters out
parse_payload('{"extractors": [], "facts": [{"id": "f1", "detector": "string"}]}')  # filters out
_rx(['a', 'b'])  # was TypeError, now None

Fixes #173

…fields

- Handle extractors/facts as null (not just missing key)
- Filter extractors with non-string pattern
- Filter facts with non-dict detector
- Guard _rx against non-string pattern input

Fixes microsoft#173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant