fix(ci): resolve Journey strict checks and test contexts

Give the upload DTO an object for file-only requests, make UI error keys discoverable, and run the digest fixtures with the same ORM context as scheduled jobs.
This commit is contained in:
Maurice
2026-11-30 17:41:53 +01:00
parent 0c08a6dcb9
commit 21391e483d
40 changed files with 47 additions and 72 deletions
@@ -149,7 +149,7 @@ export default function JourneyDayRecordingButton({
}
aria-disabled={!canTakeOver}
aria-label={label}
aria-haspopup={canTakeOver && canImportGpx ? 'menu' : undefined}
aria-haspopup={canImportGpx ? 'menu' : undefined}
data-testid="journey-day-recording"
className={ROUND}
style={{ background: 'var(--vg-surf2)' }}
@@ -6,7 +6,7 @@ import { useToast } from '../shared/Toast';
import { Tooltip } from '../shared/Tooltip';
/** One comment as the thread draws it: in the app and on the shared page alike. */
export interface EntryCommentItem {
interface EntryCommentItem {
id: number;
author_name?: string | null;
is_guest: boolean;
@@ -285,18 +285,17 @@ interface GuestThreadState {
addComment: (entryId: number, name: string, body: string) => Promise<GuestOutcome>;
}
const GUEST_OUTCOME_KEYS: Record<Exclude<GuestOutcome, 'ok'>, string> = {
closed: 'journey.comments.closed',
gone: 'journey.public.notFoundMessage',
locked: 'journey.comments.locked',
rate_limited: 'common.tooManyAttempts',
invalid: 'journey.comments.invalid',
failed: 'journey.comments.failed',
};
/** The thread under an entry on the shared page, for readers who sign with a name. */
export function GuestEntryComments({ entryId, thread }: { entryId: number; thread: GuestThreadState }) {
const { t } = useTranslation();
const messages = {
closed: t('journey.comments.closed'),
gone: t('journey.public.notFoundMessage'),
locked: t('journey.comments.locked'),
rate_limited: t('common.tooManyAttempts'),
invalid: t('journey.comments.invalid'),
failed: t('journey.comments.failed'),
};
if (!thread.commentsOpen) return null;
return (
<JourneyEntryComments
@@ -305,7 +304,7 @@ export function GuestEntryComments({ entryId, thread }: { entryId: number; threa
guest
onAdd={async (body, name) => {
const outcome = await thread.addComment(entryId, name, body);
return outcome === 'ok' ? null : t(GUEST_OUTCOME_KEYS[outcome]);
return outcome === 'ok' ? null : messages[outcome];
}}
/>
);
@@ -8,18 +8,19 @@ export function useJourneyLiveData<T>(journeyId: number | null, eventName: strin
const [loaded, setLoaded] = useState<{ journeyId: number; data: T } | null>(null);
const [failedFor, setFailedFor] = useState<number | null>(null);
const activeId = useRef(journeyId);
const latestRead = useRef(0);
const latestRead = useRef<symbol | null>(null);
useLayoutEffect(() => {
activeId.current = journeyId;
return () => {
activeId.current = null;
latestRead.current++;
latestRead.current = null;
};
}, [journeyId]);
const refresh = useCallback(async () => {
if (journeyId === null) return;
const version = ++latestRead.current;
const version = Symbol();
latestRead.current = version;
await read(journeyId).then(
(data) => {
if (latestRead.current === version) setLoaded({ journeyId, data });
@@ -23,7 +23,7 @@ export function expiryIso(day: string): string | null {
}
/** Today as a date field's lower bound. */
export function todayDay(): string {
function todayDay(): string {
return expiryDay(new Date().toISOString());
}