Skip to content

Hua work common - #117

Merged
zaihuaji merged 2 commits into
mainfrom
hua-work-common
Aug 24, 2026
Merged

zaihuaji merged 2 commits into
mainfrom
hua-work-common

Conversation

@zaihuaji

Copy link
Copy Markdown
Collaborator

No description provided.

zaihuaji and others added 2 commits August 17, 2026 17:08
…o 3.0.8

set_uid now resolves the login via get_user_uid() instead of a bare query that
exited when no record was on file, so DECS members are no longer blocked from
running dsarch/dsrqst/dsupdt when their dssdb.user record is missing.

New fallback chain in add_missed_user(): UCAR People API, then dssgrp, then a
bare stub. Records that are incomplete are marked stat_flag 'M' and trigger a
once-per-process reminder to run 'filluser -i' later. A closed record found by
the date-independent lookup is reopened rather than duplicated, but only for a
present-day lookup so historical metrics backfills cannot reactivate a user who
has since left.

ucar_user_info() now reads People API keys defensively, since the API omits keys
it has no value for, and skips pgperson/pgusername when those commands are not
installed on the host.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… bump version to 3.0.9

Reopening a closed record already has its own message, so the reminder there
was redundant noise. Remind only when no dssdb.user record existed at all.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 24, 2026 15:42
@zaihuaji
zaihuaji merged commit 347ab49 into main Aug 24, 2026
2 checks passed

Copilot AI 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.

Pull request overview

This PR updates user-lookup behavior to be more resilient when UCAR People API tooling is unavailable, including adding fallbacks for creating incomplete dssdb.user records and re-opening closed user records for present-day lookups. It also updates pg_opt to use the centralized login-name lookup and bumps the package version.

Changes:

  • Add dssgrp-based and stub fallbacks for creating missing dssdb.user records, plus a one-time “run filluser -i” warning.
  • Reopen closed dssdb.user records (clear until_date) for “today” lookups.
  • Update set_uid() to use get_user_uid() and bump version to 3.0.9.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/rda_python_common/pg_opt.py Switches UID lookup to get_user_uid() to reuse centralized user-resolution logic.
src/rda_python_common/pg_dbi.py Adds fallback user-record creation, one-time warning, and re-open logic; hardens People API parsing.
pyproject.toml Bumps project version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1704 to +1706
def dssgrp_user_info(self, userno, logname = None):
"""Build a partial dssdb.user record from dssdb.dssgrp.

Comment on lines +1749 to +1752
pgrec = {'userno': userno} if userno else {'logname': logname}
pgrec['stat_flag'] = 'M'
if pgrec['stat_flag'] == 'M': self.incomplete_user_warning()
return self.pgadd("dssdb.user", pgrec, (self.PGDBI['EXITLG']|self.AUTOID))
Comment on lines +1896 to 1899
email = pgrec.get('email')
if email and re.search(r'(@|\.)ucar\.edu$', email, re.I):
email = pgrec['email'] = pgrec.get('ucaremail')
pgrec['org_name'] = 'NCAR'
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.

2 participants