Feature/userinfo - #273
Conversation
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #273 +/- ##
==========================================
- Coverage 41.88% 38.23% -3.65%
==========================================
Files 986 1183 +197
Lines 49488 56796 +7308
Branches 5843 6173 +330
==========================================
+ Hits 20726 21718 +992
- Misses 27852 34102 +6250
- Partials 910 976 +66
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
This comment was marked as resolved.
This comment was marked as resolved.
…modal) and responds to code-quality bot userinfo recommendations
22567dc to
694ecd4
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
… IDisposable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateEmployeeInfoAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| // Exceptions during student info retrieval are caught and ignored to allow other directory details to load. | ||
| Console.WriteLine($"Warning: PopulateStudentInfoAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"IAM API EXCEPTION: {ex}"); | ||
| // Log exception but don't fail the entire request | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateUCPathInfoAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateUCPathHistoryAsync failed: {ex.Message}"); | ||
| } |
| catch | ||
| { | ||
| // Return empty string on any error | ||
| } |
| catch (Exception ex) | ||
| { | ||
| // Fall back to returning string.Empty if DB query fails. | ||
| Console.WriteLine($"Warning: GetReportsToTitleAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateIDCardsAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateKeysAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateEmployeeInfoAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| // Exceptions during student info retrieval are caught and ignored to allow other directory details to load. | ||
| Console.WriteLine($"Warning: PopulateStudentInfoAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"IAM API EXCEPTION: {ex}"); | ||
| // Log exception but don't fail the entire request | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateUCPathInfoAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Warning: PopulateUCPathHistoryAsync failed: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| result.InstinctInfo = new InstinctResult { ErrorMessage = $"Populate Exception: {ex.Message}" }; | ||
| } |
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"Error populating AD info: {ex.Message}"); | ||
| } |
| catch (Exception ex) | ||
| { | ||
| string errMsg = $"Token request exception: {ex.Message}"; | ||
| Console.WriteLine($"[INSTINCT AUTH] {errMsg}"); | ||
| AppendError(result, errMsg); | ||
| } |
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
| foreach (var middleInitial in middleParts | ||
| .Where(middlePart => middlePart.Length > 0) | ||
| .Select(middlePart => middlePart[0])) | ||
| { | ||
| var variation = $"{name} {middleInitial}"; | ||
| if (!nameVariations.Contains(variation)) | ||
| { | ||
| nameVariations.Add(variation); | ||
| } | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 218 out of 220 changed files in this pull request and generated no new comments.
Suppressed comments (3)
web/Areas/Directory/Controllers/DirectoryController.cs:145
- This refactor dropped the length guard that the original inline code (and the comment just below in
AddVmacsContactInfoAsync) relied on.Nextel,LDPager, andUnitarestring[]?, and empty XML element lists deserialize as empty (length‑0) arrays rather than null. With only a!= nullcheck, indexing[0]on an empty array will throwIndexOutOfRangeException. Restore the{ Length: > 0 }guard (consistent withUserInfoService.cswhich uses?.Length > 0).
if (vm.item.Nextel != null) result.Nextel = vm.item.Nextel[0];
if (vm.item.LDPager != null) result.LDPager = vm.item.LDPager[0];
if (vm.item.Unit != null) result.Department = vm.item.Unit[0];
web/Areas/Directory/Models/IndividualSearchResultWithIDs.cs:49
LdapUserContact.PostalAddressis declared= null!and is only assigned when the LDAP entry contains apostalAddressattribute, so it can be null at runtime. Removing the null guard here meansPostalAddress.Replace(...)can throw aNullReferenceException. Note the baseIndividualSearchResultconstructor already uses the null-safe form (?.Replace(...) ?? ""); this override should match it.
PostalAddress = ldapUserContact.PostalAddress.Replace("$", '\n'.ToString());
web/Classes/Utilities/LdapService.cs:123
- The param documentation is inaccurate: this method looks up by MothraID (the filter uses
ucdpersonuuid, which maps toLdapUserContact.MothraId), not by iamID. Describing the parameter as "iamID" could lead callers to pass the wrong identifier.
| catch (Exception ex) | ||
| { | ||
| result.InstinctInfo = new InstinctResult { ErrorMessage = $"Populate Exception: {ex.Message}" }; | ||
| } |
| @@ -113,6 +136,24 @@ public IActionResult DirectoryResult(string mothraID) | |||
| return View("~/Areas/Directory/Views/UserInfo.cshtml"); | |||
There was a problem hiding this comment.
@JasonRobertFrancis This returns UserInfo.cshtml with no model, but the view is @model UserInfoResult and dereferences Model.DisplayFullName on line 3. Every request to /Directory/userInfo/{mothraID} is a 500. UserInfoController supersedes it and Card.cshtml now links to /UserInfo/{mothraId}, so this should be deleted.
| Console.WriteLine($"[INSTINCT SERVICE] mothraId: '{mothraId}', iamId: '{iamId}', result.MothraId: '{result.MothraId}'"); | ||
| var individual = await _aaudContext.AaudUsers.FirstOrDefaultAsync(u => (u.MothraId == result.MothraId)); | ||
| Console.WriteLine($"[INSTINCT SERVICE] individual is null: {individual == null}"); | ||
| if (individual != null) | ||
| { | ||
| Console.WriteLine($"[INSTINCT SERVICE] individual: '{individual.DisplayFullName}', LastName: '{individual.LastName}', FirstName: '{individual.FirstName}'"); |
There was a problem hiding this comment.
@JasonRobertFrancis These run on every user info page load and write mothraId, iamId, and the person's full name to stdout. Looks like leftover debugging from the Instinct work. There are 30 Console.WriteLine calls in this file and no ILogger at all. Please drop the debug ones and move the rest to an injected logger, running route input through LogSanitizer first.
No description provided.