Skip to content

fix: import salt.utils.jid explicitly in pgjsonb returner (#69042)#69128

Open
SAY-5 wants to merge 1 commit into
saltstack:3006.xfrom
SAY-5:say5/pgjsonb-import-utils-jid-69042
Open

fix: import salt.utils.jid explicitly in pgjsonb returner (#69042)#69128
SAY-5 wants to merge 1 commit into
saltstack:3006.xfrom
SAY-5:say5/pgjsonb-import-utils-jid-69042

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 12, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Restores the explicit import salt.utils.jid in the pgjsonb returner. The module calls salt.utils.jid.gen_jid() in prep_jid() (line 461) and salt.utils.jid.format_jid_instance() in get_jids() (line 436), but currently only imports salt.utils.data and salt.utils.job. The salt.utils.jid reference works today as a side effect of salt.utils.args being loaded transitively via salt.utils.data. Any refactor of that import chain silently breaks pgjsonb with AttributeError: module 'salt.utils' has no attribute 'jid'.

prep_jid() is called from master.py:_prep_jid() on every job publish. That caller only handles KeyError, TypeError so the latent AttributeError would propagate and prevent the master from publishing jobs when master_job_cache: pgjsonb is in use.

A regression test in tests/pytests/unit/returners/test_pgjsonb.py asserts that salt.utils.jid is reachable through the module's globals so future refactors can no longer drop the explicit import.

What issues does this PR fix or reference?

Fixes #69042

Previous Behavior

prep_jid / get_jids worked only because salt.utils.jid was loaded transitively. In an interpreter where it had not been loaded yet, both functions raised AttributeError: module 'salt.utils' has no attribute 'jid'.

New Behavior

The explicit import salt.utils.jid is restored alongside the existing salt.utils.data / salt.utils.job imports, so both call sites resolve regardless of which other modules have been imported beforehand.

Merge requirements satisfied?

  • Docs
  • Changelog - changelog/69042.fixed.md
  • Tests written/updated

Commits signed with GPG?

No

@twangboy twangboy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please rebase once 3006.x branch tests are green. Fix conflicts if any.
Make this on the earliest branch where the bug exists. Likely 3006.x

@dwoz
dwoz force-pushed the say5/pgjsonb-import-utils-jid-69042 branch from 18ef4d7 to 6c3d62e Compare July 1, 2026 22:52
@dwoz
dwoz changed the base branch from master to 3006.x July 1, 2026 22:52
@dwoz dwoz added this to the 3006.28 milestone Jul 1, 2026
@twangboy

Copy link
Copy Markdown
Contributor

Please rebase and fix failing tests

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

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: pgjsonb returner uses salt.utils.jid without importing it (latent AttributeError)

3 participants