From 8f41539bacec6395aed53cf1a82d2f4c7e182dfe Mon Sep 17 00:00:00 2001
From: hokiepokedad2 <38219945+hokiepokedad2@users.noreply.github.com>
Date: Tue, 25 Aug 2026 08:59:48 -0400
Subject: [PATCH] chore(humans): delete a dead repository read, and say why its
neighbour stays
IHumanRepository.GetByIdAsync had no callers. HumanService.GetByIdAsync goes through
the proxy, so every controller that reads a human is already on the API; the
repository method was left behind by that migration and nothing referenced it,
tests included.
ExistsAsync is NOT the same case, and the comment now records why so this does not
get "cleaned up" later. IHumanService.ExistsAsync is otherwise identical and is
already injected into UserPurgeService -- but it reads through the proxy, and
GetHumanAsync returns null for ANY non-success. So a Poracle that is merely
unreachable is indistinguishable from an account that does not exist, and the method
would answer false. AdminController turns false into 404, so an outage would report
the account an admin is deleting as already gone.
The database read is the correct one here precisely because it does not depend on
Poracle being up.
Refs jfberry/PoracleNG#214
---
.../Repositories/IHumanRepository.cs | 1 -
.../Pgan.PoracleWebNet.Core.Repositories/HumanRepository.cs | 6 ------
Core/Pgan.PoracleWebNet.Core.Services/UserPurgeService.cs | 5 +++++
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/Core/Pgan.PoracleWebNet.Core.Abstractions/Repositories/IHumanRepository.cs b/Core/Pgan.PoracleWebNet.Core.Abstractions/Repositories/IHumanRepository.cs
index 3f067da5..e670d89a 100644
--- a/Core/Pgan.PoracleWebNet.Core.Abstractions/Repositories/IHumanRepository.cs
+++ b/Core/Pgan.PoracleWebNet.Core.Abstractions/Repositories/IHumanRepository.cs
@@ -8,7 +8,6 @@ public interface IHumanRepository
/// The webhook humans, id and name. Used to resolve a delegated webhook named by name.
public Task> GetWebhooksAsync();
- public Task GetByIdAsync(string id);
public Task> GetByIdsAsync(IEnumerable ids);
public Task ExistsAsync(string id);
public Task DeleteUserAsync(string userId);
diff --git a/Core/Pgan.PoracleWebNet.Core.Repositories/HumanRepository.cs b/Core/Pgan.PoracleWebNet.Core.Repositories/HumanRepository.cs
index 0f5b93c6..9bbfcdb2 100644
--- a/Core/Pgan.PoracleWebNet.Core.Repositories/HumanRepository.cs
+++ b/Core/Pgan.PoracleWebNet.Core.Repositories/HumanRepository.cs
@@ -23,12 +23,6 @@ public async Task> GetWebhooksAsync()
return entities.Select(e => e.ToModel());
}
- public async Task GetByIdAsync(string id)
- {
- var entity = await this._context.Humans.FirstOrDefaultAsync(h => h.Id == id);
- return entity is null ? null : entity.ToModel();
- }
-
public async Task> GetByIdsAsync(IEnumerable ids)
{
var idArray = ids.ToArray();
diff --git a/Core/Pgan.PoracleWebNet.Core.Services/UserPurgeService.cs b/Core/Pgan.PoracleWebNet.Core.Services/UserPurgeService.cs
index 0cc0fc96..4dc67043 100644
--- a/Core/Pgan.PoracleWebNet.Core.Services/UserPurgeService.cs
+++ b/Core/Pgan.PoracleWebNet.Core.Services/UserPurgeService.cs
@@ -26,6 +26,11 @@ public partial class UserPurgeService(
public async Task PurgeAsync(string userId)
{
+ // Deliberately the DATABASE, not IHumanService.ExistsAsync, which is otherwise identical and
+ // already injected here. That one reads through the proxy, and the proxy answers null for any
+ // non-success -- so a Poracle that is merely unreachable is indistinguishable from an account
+ // that does not exist, and this method would answer false. The caller turns false into 404, so
+ // an outage would tell an admin the account they are deleting is already gone.
if (!await this._humanRepository.ExistsAsync(userId))
{
return false;