Skip to content

Conversation

@deiga
Copy link
Contributor

@deiga deiga commented Jan 7, 2026

Superseded #3043

Resolves #3030


Before the change?

  • No tests for github_emu_group_mapping
  • Import set wrong ID
  • Not able to import Groups with multiple teams mapped
  • Using legacy CRUD provider functions

After the change?

  • Adds tests for github_emu_group_mapping
  • Fixes import logic
  • Enabled importing Group with multiple team mappings
  • Refactor to use Context-aware functions

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@github-actions github-actions bot added the Type: Bug Something isn't working as documented label Jan 7, 2026
@deiga deiga changed the title Fix emu group mapping import multiple teams 3030 [BUG] Enable importing github_emu_group_mapping for Group with multiple teams Jan 7, 2026
@deiga deiga force-pushed the fix-emu-group-mapping-import-multiple-teams-3030 branch from beb7f4d to abb3de3 Compare January 7, 2026 21:24
Copy link
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

As we as the inline comments, we need to be careful when using tflog that it can only be used with contexts injected by TF (e.g. CreateContext).

Comment on lines 270 to 278
tflog.Debug(ctx, "Parsed two-part import ID", map[string]any{
"import_id": importID,
"group_id": groupID,
"team_slug": teamSlug,
})

tflog.Trace(ctx, "Setting state attribute: group_id", map[string]any{
"group_id": groupID,
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need both of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I liked the idea of having a DEBUG statement "Parsing successful" and separately TRACE statements for each operation that isn't covered and can lead to an interruption.

But that might be too verbose and unnecessary. I'm trying to think about how we can get better information from future DEBUG or TRACE logs from bug reports 😬

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think there is value in two log entries without anything between them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if they are for different log levels?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Even if they are for different log levels?

Yes, as long as the payload isn't significantly different for the lower level log. Logs need to have a purpose and there isn't a purpose for logging to two different messages at the same point; it doesn't make it any easier for me to debug the system and arguably it makes it harder.

In this case the higher level log (trace) actually contains a smaller payload than the lower level one.

Comment on lines 310 to 317
tflog.Debug(ctx, "Parsed integer import ID", map[string]any{
"import_id": importID,
"group_id": groupID,
})

tflog.Trace(ctx, "Setting state attribute: group_id", map[string]any{
"group_id": groupID,
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need both of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevehipwell stevehipwell added this to the v6.10.0 Release milestone Jan 8, 2026
deiga added 7 commits January 8, 2026 23:27
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Which was found by our new tests!

Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
@deiga deiga force-pushed the fix-emu-group-mapping-import-multiple-teams-3030 branch from abb3de3 to a523161 Compare January 8, 2026 21:44
@deiga deiga requested a review from stevehipwell January 8, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Importing GitHub EMU group mapping fails for more than 1 team

2 participants