fix: various fixes to sentry-reported errors and more

This commit is contained in:
Hampus Kraft
2026-02-18 15:38:51 +00:00
parent 302c0d2a0c
commit 0517a966a3
357 changed files with 25420 additions and 16281 deletions

View File

@@ -3095,6 +3095,46 @@ export function TestHarnessController(app: HonoApp) {
return ctx.json(result, result.success ? 200 : 409);
});
app.post('/test/users/:userId/set-contact-info', async (ctx) => {
ensureHarnessAccess(ctx);
const params = ctx.req.param() as {userId?: string};
const userIdParam = params.userId;
if (!userIdParam) {
throw new Error('Missing userId parameter');
}
const userId = createUserID(BigInt(userIdParam));
const body = await ctx.req.json();
const {phone, email} = body as {phone?: string | null; email?: string | null};
const userRepository = new UserRepository();
const user = await userRepository.findUnique(userId);
if (!user) {
throw new UnknownUserError();
}
const updates: Record<string, unknown> = {};
if (phone !== undefined) {
updates['phone'] = phone;
}
if (email !== undefined) {
updates['email'] = email;
}
if (Object.keys(updates).length === 0) {
return ctx.json({success: true, updated: false});
}
await userRepository.patchUpsert(userId, updates, user.toRow());
return ctx.json({
success: true,
updated: true,
phone: updates['phone'] ?? user.phone,
email: updates['email'] ?? user.email,
});
});
app.post('/test/cache-clear', async (ctx) => {
ensureHarnessAccess(ctx);
const cacheService = ctx.get('cacheService');
@@ -3107,4 +3147,10 @@ export function TestHarnessController(app: HonoApp) {
Logger.info({totalDeleted}, 'Cleared KV cache via test harness');
return ctx.json({cleared: true, deleted_count: totalDeleted});
});
app.post('/test/rpc-session-init', async (ctx) => {
const request = await ctx.req.json();
const response = await ctx.get('rpcService').handleRpcRequest({request, requestCache: ctx.get('requestCache')});
return ctx.json(response);
});
}