Skip to content

fix(parser): export IoT Core registry models from parser.models - #8743

Closed
azmi2409 wants to merge 1 commit into
aws-powertools:developfrom
azmi2409:fix-8742-iot-registry-model-imports
Closed

azmi2409 wants to merge 1 commit into
aws-powertools:developfrom
azmi2409:fix-8742-iot-registry-model-imports

Conversation

@azmi2409

@azmi2409 azmi2409 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

closes #8742

Summary

Changes

  • Export the six IoT Core registry models from aws_lambda_powertools.utilities.parser.models, following the existing lazy-loading pattern in parser/models/__init__.py (TYPE_CHECKING import, _MODEL_MODULES mapping, and __all__): IoTCoreThingEvent, IoTCoreThingTypeEvent, IoTCoreThingTypeAssociationEvent, IoTCoreThingGroupEvent, IoTCoreAddOrRemoveFromThingGroupEvent, and IoTCoreAddOrDeleteFromThingGroupEvent.
  • Add one regression case per model to tests/functional/parser/test_model_imports.py, asserting the export, submodule, and attribute access paths all resolve and load only the iot_registry_events module.
  • Fix the CloudwatchLogsModel spelling in docs/utilities/parser.md (built-in models table and the CloudWatchLogsEnvelope row) to CloudWatchLogsModel, matching the actual class name.

User experience

Before: from aws_lambda_powertools.utilities.parser.models import IoTCoreThingEvent raised ImportError, even though the Parser docs listed the six models as built-in models; importing from the parser.models.iot_registry_events submodule was the only workaround. The docs table also listed a CloudwatchLogsModel name that does not exist.

After: all six models import from aws_lambda_powertools.utilities.parser.models like the other built-in models, and the docs table spells CloudWatchLogsModel correctly.

Verification

  • Reproduced both failures before the fix: ImportError: cannot import name 'IoTCoreThingEvent' and ImportError: cannot import name 'CloudwatchLogsModel' (with Python suggesting CloudWatchLogsModel). After the fix, all six models plus CloudWatchLogsModel import from parser.models, including via from ... import *.
  • Confirmed the new IoTCoreThingEvent export test fails on develop (without the fix) with the same AttributeError reported in the issue, and passes with the fix.
  • tests/functional/parser/test_model_imports.py: 42 passed.
  • tests/functional/parser/ (full suite): 72 passed.
  • ruff format --check and ruff check on both changed Python files: clean.
  • I used an AI coding assistant to prepare this PR; all verification above was run by me.

@azmi2409
azmi2409 requested a review from a team as a code owner November 2, 2026 14:34
@azmi2409
azmi2409 requested a review from hjgraca November 2, 2026 14:34
@boring-cyborg boring-cyborg Bot added documentation Improvements or additions to documentation tests labels Nov 2, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 2, 2026
@powertools-for-aws-oss-automation

Copy link
Copy Markdown

No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template at .github/PULL_REQUEST_TEMPLATE.md#acknowledgment

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@leandrodamascena

Copy link
Copy Markdown
Contributor

Thanks @azmi2409, the change is correct, but @Manishram-ai reported this and asked to send the fix before this PR opened, and their #8746 is up now. We go with whoever claimed the issue first, so I'm closing this one. Sorry for the wasted effort; the Logger audit in #8730 will turn into issues this week if you want another one.

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

Labels

documentation Improvements or additions to documentation size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: IoT Core registry models can't be imported from parser.models

2 participants