Merge pull request #128 from jschoeny/feat/curated-hacks
Some checks failed
Deploy Supabase Migrations to Production / migrate (push) Has been cancelled

Only show curated hacks on Discover and the homepage
This commit is contained in:
Jared Schoeny
2026-11-19 19:02:47 -07:00
committed by GitHub
parent 8da2b78cfe
commit 02929fffd3
16 changed files with 261 additions and 29 deletions

View File

@@ -45,9 +45,10 @@ async function generateDiscoverData(): Promise<DiscoverData> {
const { data: rows, error: hacksError } = await supabase
.from("hacks")
.select(
`slug,title,summary,base_rom,downloads,created_by,current_patch,custom_version_name,original_author,approved_at,is_archive,completion_status,${AI_SELECT}`,
`slug,title,summary,base_rom,downloads,created_by,current_patch,custom_version_name,original_author,curated_at,is_archive,completion_status,${AI_SELECT}`,
)
.eq("approved", true)
.eq("curated", true)
.eq("is_archive", false)
.is("deleted_at", null);
if (hacksError) throw hacksError;
@@ -241,7 +242,7 @@ async function generateDiscoverData(): Promise<DiscoverData> {
summary: row.summary,
is_archive: false,
completion_status: row.completion_status,
approvedAt: row.approved_at,
curatedAt: row.curated_at,
publishedAt: currentPatch?.published_at ?? null,
trendingScore: recentDownloads + 8 * Math.log(downloads + 1),
ai: aiDisclosureFromRow(row)?.levels ?? null,
@@ -259,7 +260,7 @@ async function generateDiscoverData(): Promise<DiscoverData> {
const getCachedDiscoverData = cache(
generateDiscoverData,
// Bump the version when DiscoverHack's shape changes, so a deploy never reads the old shape.
["discover-data", "v2"],
["discover-data", "v3"],
{
revalidate: DISCOVER_REVALIDATE_SECONDS,
tags: ["discover"],

View File

@@ -112,7 +112,7 @@ Both formats support checksum verification so the patch is linked to the correct
### How does my hack gain visibility?
We highly recommend linking to your romhack's Hackdex page from PokéCommunity, Reddit, or other social media platforms. Doing so can help boost your hack's visibility and outrank those sketchy ROM sharing sites that steal many creators' hard work.
Once approved, your hack can appear on Discover. "Newest" sorts by approval date, and "Recently updated" sorts by the publication date of your current patch. "Most popular" and "Trending" use download activity. These listings are ordered automatically and do not reflect staff preferences.
Once approved, your hack gets a public page. Staff choose which approved hacks appear on Discover and the homepage, and those listings are ordered automatically. "Newest" sorts by the date a hack was curated, and "Recently updated" sorts by the publication date of your current patch. "Most popular" and "Trending" use download activity.
Here are some helpful tips for improving your hack's page to help increase visibility:
- Include at least 3 screenshots that help make your hack stand out, with the first one being the most eye-catching.

View File

@@ -25,7 +25,7 @@ export default async function ApprovePage({ params }: ApprovePageProps) {
// Fetch hack data
const { data: hack, error } = await supabase
.from("hacks")
.select("title, approved, approved_at, approved_by, created_by, submitted_at, ai_disclosed_at")
.select("title, approved, approved_at, approved_by, created_by, submitted_at, ai_disclosed_at, is_archive")
.eq("slug", slug)
.maybeSingle();
@@ -67,7 +67,8 @@ export default async function ApprovePage({ params }: ApprovePageProps) {
async function handleApprove(formData: FormData) {
"use server";
const verified = creatorProfile?.verified ? undefined : formData.get("verified") === "on";
await approveHack(slug, verified);
const curate = formData.get("curate") === "on";
await approveHack(slug, { verified, curate });
}
return (
@@ -126,6 +127,16 @@ export default async function ApprovePage({ params }: ApprovePageProps) {
</>
)}
</div>
{/* Discover and the homepage only list curated hacks. Archives are never curated. */}
{!hack.is_archive && (
<div className="flex items-center gap-2">
<input type="checkbox" name="curate" id="curate" disabled={!hack.ai_disclosed_at} className="disabled:cursor-not-allowed" />
<label htmlFor="curate" className={hack.ai_disclosed_at ? undefined : "cursor-not-allowed text-text-3"}>
Also curate it, so it appears on Discover and the homepage.
{!hack.ai_disclosed_at && " It needs an AI label first."}
</label>
</div>
)}
<div className="flex items-center gap-2">
<Button type="submit" variant="primary">
Approve

View File

@@ -33,6 +33,7 @@ export interface HackMetadata {
social_links: unknown;
created_by: string;
approved: boolean;
curated: boolean;
original_author: string | null;
permission_from: string | null;
language: string | null;
@@ -82,7 +83,7 @@ export async function getHackMetadata(slug: string): Promise<HackMetadata | null
const { data: hack, error } = await supabase
.from("hacks")
.select(`slug,title,summary,description,base_rom,created_at,updated_at,current_patch,custom_version_name,box_art,social_links,created_by,approved,original_author,permission_from,language,is_archive,completion_status,verification_contact_info,submitted_at,show_emulators,${AI_SELECT}`)
.select(`slug,title,summary,description,base_rom,created_at,updated_at,current_patch,custom_version_name,box_art,social_links,created_by,approved,curated,original_author,permission_from,language,is_archive,completion_status,verification_contact_info,submitted_at,show_emulators,${AI_SELECT}`)
.eq("slug", slug)
.is("deleted_at", null)
.maybeSingle();
@@ -138,7 +139,7 @@ export async function getHackMetadata(slug: string): Promise<HackMetadata | null
userEmail = userData?.user?.email || null;
}
// Get other approved hacks by the same author (non-archive hacks only)
// Get other curated hacks by the same author (non-archive hacks only)
let otherHacks: {
slug: string;
title: string;
@@ -150,6 +151,7 @@ export async function getHackMetadata(slug: string): Promise<HackMetadata | null
.select("slug,title,summary")
.eq("created_by", hack.created_by)
.eq("approved", true)
.eq("curated", true)
.eq("is_archive", false)
.is("deleted_at", null)
.neq("slug", hack.slug)
@@ -211,7 +213,8 @@ export async function getHackMetadata(slug: string): Promise<HackMetadata | null
}
};
},
[`hack:${slug}:metadata`],
// Bump the version when the shape or filters change, so a deploy never reads the old entry.
[`hack:${slug}:metadata`, "v2"],
{
revalidate: 14400, // 4 hours
tags: ["hack", `hack:${slug}:metadata`],

View File

@@ -354,7 +354,8 @@ export async function presignCoverUpload(args: { slug: string; objectKey: string
}
export async function approveHack(slug: string, verified?: boolean) {
/** `verified` marks the creator as verified; `curate` also curates the hack in the same update. */
export async function approveHack(slug: string, { verified, curate }: { verified?: boolean; curate?: boolean } = {}) {
const supabase = await createClient();
const {
data: { user },
@@ -370,7 +371,7 @@ export async function approveHack(slug: string, verified?: boolean) {
// Check if hack exists
const { data: hack, error: hErr } = await serviceClient
.from("hacks")
.select("slug, approved, title, created_by, submitted_at, current_patch, is_archive")
.select("slug, approved, title, created_by, submitted_at, current_patch, is_archive, ai_disclosed_at")
.eq("slug", slug)
.is("deleted_at", null)
.maybeSingle();
@@ -379,6 +380,8 @@ export async function approveHack(slug: string, verified?: boolean) {
// Only the creator can submit; a draft isn't in the queue yet.
if (hack.submitted_at === null) return { ok: false, error: "This hack hasn't been submitted for review yet." } as const;
if (!hack.approved && !hack.is_archive && hack.current_patch === null) return { ok: false, error: "This hack has no playable patch yet." } as const;
if (curate && hack.is_archive) return { ok: false, error: "Archives can't be curated." } as const;
if (curate && hack.ai_disclosed_at === null) return { ok: false, error: "This hack needs an AI label before it can be curated." } as const;
if (verified === true) {
const { error: updateErr } = await serviceClient
@@ -399,13 +402,15 @@ export async function approveHack(slug: string, verified?: boolean) {
return { ok: true } as const;
}
// Approve the hack
const { error: updateErr } = await supabase
// Approve the hack. The service role, because only it can write the curation columns.
const now = new Date().toISOString();
const { error: updateErr } = await serviceClient
.from("hacks")
.update({
approved: true,
approved_at: new Date().toISOString(),
approved_at: now,
approved_by: user.id,
...(curate ? { curated: true, curated_at: now, curated_by: user.id } : {}),
})
.eq("slug", slug);
@@ -415,6 +420,7 @@ export async function approveHack(slug: string, verified?: boolean) {
revalidateTag(`hack:${slug}:metadata`);
revalidateTag(`hack:${slug}:downloads`);
revalidatePath(`/hack/${slug}`);
if (curate) await revalidateOtherHacks(serviceClient, hack.created_by, slug);
try {
const { data: creatorData, error: creatorError } = await serviceClient.auth.admin.getUserById(hack.created_by);
@@ -472,6 +478,58 @@ export async function approveHack(slug: string, verified?: boolean) {
redirect(`/hack/${slug}`);
}
/**
* Admin-only. Sets whether a hack appears on Discover and the homepage. Only
* approved, non-archived hacks qualify, and curating one requires an AI label.
*/
export async function setHackCurated(slug: string, curated: boolean) {
const supabase = await createClient();
const {
data: { user },
} = await supabase.auth.getUser();
if (!user) return { ok: false, error: "Unauthorized" } as const;
const { data: isAdmin } = await supabase.rpc("is_admin");
if (!isAdmin) return { ok: false, error: "Forbidden" } as const;
// The service role: these columns aren't readable with an ordinary session.
const service = await createServiceClient();
const { data: hack, error: hackError } = await service
.from("hacks")
.select("approved, is_archive, ai_disclosed_at, created_by")
.eq("slug", slug)
.is("deleted_at", null)
.maybeSingle();
if (hackError) return { ok: false, error: hackError.message } as const;
if (!hack) return { ok: false, error: "Hack not found" } as const;
if (!hack.approved || hack.is_archive) return { ok: false, error: "Only approved, non-archived hacks can be curated." } as const;
if (curated && hack.ai_disclosed_at === null) return { ok: false, error: "This hack needs an AI label before it can be curated." } as const;
const { error: updateError } = await service
.from("hacks")
.update(
curated
? { curated: true, curated_at: new Date().toISOString(), curated_by: user.id }
: { curated: false, curated_at: null, curated_by: null },
)
.eq("slug", slug)
// A repeat from a stale tab shouldn't reset the curation date.
.eq("curated", !curated);
if (updateError) return { ok: false, error: updateError.message } as const;
revalidateTag(`hack:${slug}:metadata`);
revalidatePath(`/hack/${slug}`);
revalidateDiscoverCatalog();
await revalidateOtherHacks(service, hack.created_by, slug);
return { ok: true } as const;
}
/** Refreshes the creator's other hack pages, which list curated hacks under "other hacks by this creator". */
async function revalidateOtherHacks(service: Awaited<ReturnType<typeof createServiceClient>>, createdBy: string, slug: string) {
const { data: siblings } = await service.from("hacks").select("slug").eq("created_by", createdBy).neq("slug", slug);
for (const sibling of siblings ?? []) revalidateTag(`hack:${sibling.slug}:metadata`);
}
export async function createHackReviewThread(slug: string) {
const supabase = await createClient();
const {

View File

@@ -42,7 +42,7 @@ function toCard(h: DiscoverHack): HackCardAttributes {
};
}
function byDateDesc(key: "approvedAt" | "publishedAt") {
function byDateDesc(key: "curatedAt" | "publishedAt") {
return (a: DiscoverHack, b: DiscoverHack) => (b[key] ? Date.parse(b[key]!) : 0) - (a[key] ? Date.parse(a[key]!) : 0);
}
@@ -52,7 +52,7 @@ export default async function Home() {
const catalog = hacks.map(toCard);
const trending = [...hacks].sort((a, b) => b.trendingScore - a.trendingScore).slice(0, SHELF_SIZE).map(toCard);
const newest = [...hacks].sort(byDateDesc("approvedAt")).slice(0, SHELF_SIZE).map(toCard);
const newest = [...hacks].sort(byDateDesc("curatedAt")).slice(0, SHELF_SIZE).map(toCard);
const updated = [...hacks].filter((h) => h.publishedAt).sort(byDateDesc("publishedAt")).slice(0, SHELF_SIZE).map(toCard);
return (

View File

@@ -164,7 +164,7 @@ export default function DiscoverBrowser({ catalog, generatedAt, initialState, ta
const matches = hackMatcher({ tags: selectedTags, baseRoms: selectedBaseRoms, completionStatuses: selectedCompletionStatuses, onlyReady, ai }, query, groups, readyBaseRomIds);
return catalog.filter(matches).sort((a, b) => {
if (sort === "popular") return b.downloads - a.downloads;
if (sort === "new") return (b.approvedAt ? Date.parse(b.approvedAt) : 0) - (a.approvedAt ? Date.parse(a.approvedAt) : 0);
if (sort === "new") return (b.curatedAt ? Date.parse(b.curatedAt) : 0) - (a.curatedAt ? Date.parse(a.curatedAt) : 0);
if (sort === "updated") {
if (!a.publishedAt && !b.publishedAt) return 0;
if (!a.publishedAt) return 1;

View File

@@ -9,7 +9,7 @@ import { baseGameLabel, baseRoms, PLATFORM_NAMES, type Platform } from "@/data/b
const RAIL_PLATFORMS: Platform[] = ["GBA", "GBC", "GB", "NDS"];
import { DISCOVER_COMPLETION_STATUSES } from "@/app/discover/search-params";
import type { DiscoverHack } from "@/types/discover";
import { AI_AREAS, AI_DISCLOSURE_DEADLINE, AI_PRESETS, aiFilterActive, aiPresetOf, matchesAiFilter, normalizeAiFilter, NO_AI_FILTER, type AiArea, type AiFilter } from "@/utils/aiDisclosure";
import { AI_AREAS, AI_PRESETS, aiFilterActive, aiPresetOf, matchesAiFilter, normalizeAiFilter, NO_AI_FILTER, type AiArea, type AiFilter } from "@/utils/aiDisclosure";
import { useCloseOnDesktop, useDialog } from "@/hooks/useDialog";
/** The filterable part of the Discover URL state. The sheet edits a draft copy of this. */
@@ -266,14 +266,6 @@ export function FilterFields({ value, onChange, tagGroups, counts, readyCount, o
))}
</div>
</Disclosure>
<Check
className={`mt-1 ${rowH}`}
label="Hide hacks without an AI label"
hint={`Creators have until ${AI_DISCLOSURE_DEADLINE} to add missing labels, per the Terms.`}
count={counts.ai({ ...value.ai, disclosedOnly: true })}
checked={value.ai.disclosedOnly}
onChange={() => setAi({ ...value.ai, disclosedOnly: !value.ai.disclosedOnly })}
/>
</Group>
<Group title="Tags">

View File

@@ -0,0 +1,62 @@
"use client";
import { MenuItem } from "@headlessui/react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { FaRegStar, FaStar } from "react-icons/fa6";
import { toast } from "sonner";
import { setHackCurated } from "@/app/hack/actions";
interface CurateMenuItemProps {
slug: string;
curated: boolean;
}
/** Admin menu item that adds a hack to, or removes it from, Discover and the homepage. */
export default function CurateMenuItem({ slug, curated }: CurateMenuItemProps) {
const router = useRouter();
const [isPending, setIsPending] = useState(false);
const StarIcon = curated ? FaStar : FaRegStar;
const handleToggle = async () => {
if (isPending) return;
setIsPending(true);
try {
const result = await setHackCurated(slug, !curated);
if (!result.ok) {
toast.error(result.error);
return;
}
// The menu closes on click, so the star's pop plays in the toast.
if (curated) {
toast.success("Un-curated. It no longer appears on Discover or the homepage.", { icon: <FaRegStar size={14} /> });
} else {
toast.success("Curated. It now appears on Discover and the homepage.", { icon: <FaStar className="anim-pop text-accent-text" size={14} /> });
}
router.refresh();
} catch {
toast.error("Failed to update this hack's curation.");
} finally {
setIsPending(false);
}
};
const label = curated ? "Un-curate" : "Curate";
const pendingLabel = curated ? "Un-curating…" : "Curating…";
return (
<MenuItem
as="button"
type="button"
disabled={isPending}
onClick={handleToggle}
className="block w-full px-3 py-2 text-left text-sm font-medium text-text-2 data-focus:bg-surface-2 disabled:opacity-50"
>
<StarIcon className="mb-0.5 mr-2 inline-block align-middle" size={12} />
{isPending ? pendingLabel : label}
</MenuItem>
);
}

View File

@@ -235,7 +235,7 @@ function NextSteps() {
const steps = [
["A volunteer reviews your page and patch", null],
["They may reach out to confirm it’s yours", "Using your verification contact."],
["Once approved, it’s listed on Discover", "Edits you make now are included in the review."],
["Once approved, it gets a public page you can share", "Edits you make now are included in the review."],
] as const;
return (
<ol className="mt-4 grid gap-2.5 text-left">

View File

@@ -1,6 +1,7 @@
import Avatar from "@/components/Account/Avatar";
import CollapsibleTags from "@/components/Hack/CollapsibleTags";
import CreateReviewThreadMenuItem from "@/components/Hack/CreateReviewThreadMenuItem";
import CurateMenuItem from "@/components/Hack/CurateMenuItem";
import DownloadsBadge from "@/components/Hack/DownloadsBadge";
import HackActions from "@/components/Hack/HackActions";
import HackOptionsMenu from "@/components/Hack/HackOptionsMenu";
@@ -308,6 +309,7 @@ export default function HackDetailView({ metadata, downloads, canEdit, canUpload
Approve
</MenuItem>
)}
{isAdmin && hack.approved && !isArchive && <CurateMenuItem slug={hack.slug} curated={hack.curated} />}
{isAdmin && profile?.email && (
<MenuItem as="a" href={`mailto:${profile.email}`} className="block w-full px-3 py-2 text-left text-sm font-medium text-text-2 data-focus:bg-surface-2">
<FiMail className="mb-0.5 mr-2 inline-block align-middle" size={12} />

View File

@@ -223,6 +223,9 @@ export type Database = {
| null
created_at: string
created_by: string
curated: boolean
curated_at: string | null
curated_by: string | null
current_patch: number | null
custom_version_name: string | null
deleted_at: string | null
@@ -274,6 +277,9 @@ export type Database = {
| null
created_at?: string
created_by: string
curated?: boolean
curated_at?: string | null
curated_by?: string | null
current_patch?: number | null
custom_version_name?: string | null
deleted_at?: string | null
@@ -325,6 +331,9 @@ export type Database = {
| null
created_at?: string
created_by?: string
curated?: boolean
curated_at?: string | null
curated_by?: string | null
current_patch?: number | null
custom_version_name?: string | null
deleted_at?: string | null

View File

@@ -4,7 +4,7 @@ import type { AiLevels } from "@/utils/aiDisclosure";
export type DiscoverSortOption = "trending" | "popular" | "new" | "updated" | "alpha";
export interface DiscoverHack extends HackCardAttributes {
approvedAt: string | null;
curatedAt: string | null;
publishedAt: string | null;
trendingScore: number;
/** The AI label's level per area, for the AI filter; null until the creator fills it in. */

View File

@@ -0,0 +1,72 @@
-- Curated hacks are the ones shown on Discover and the homepage. Admins curate from a hack's menu;
-- an approved hack that isn't curated keeps its public page. Read and written with the service role,
-- so anon and authenticated get no SELECT grant on these columns.
alter table public.hacks
add column curated boolean not null default false,
add column curated_at timestamptz,
add column curated_by uuid references auth.users (id) on delete set null,
add constraint hacks_curated_has_date check (curated = (curated_at is not null));
-- The starting set: every listable hack with an AI label. Their approval date keeps the "New" order
-- as it was. curated_by stays null because no admin made this call. Skip the updated_at trigger so
-- the backfill doesn't stamp every hack with migration day.
alter table public.hacks disable trigger set_hacks_updated_at;
update public.hacks
set curated = true, curated_at = coalesce(approved_at, created_at)
where approved and ai_disclosed_at is not null and not is_archive and deleted_at is null;
alter table public.hacks enable trigger set_hacks_updated_at;
-- Same as 20261006120000_hack_soft_delete.sql, plus the three curation columns.
create or replace function public.hacks_update_guard()
returns trigger
language plpgsql
as $function$
begin
if current_user in ('postgres', 'dashboard_user', 'service_role') then
return new;
end if;
if public.is_admin() then
return new;
end if;
if tg_op = 'INSERT' then
if new.downloads <> 0 or new.is_archive or new.rejected or new.curated or num_nonnulls(
new.current_patch, new.original_author, new.permission_from, new.submitted_at,
new.approved_at, new.approved_by, new.rejected_at, new.rejected_reason, new.rejected_by, new.assigned_admin,
new.ai_graphics, new.ai_music, new.ai_story, new.ai_translation, new.ai_events, new.ai_code, new.ai_note, new.ai_disclosed_at,
new.deleted_at, new.deleted_by, new.redirect_url,
new.curated_at, new.curated_by
) > 0 then
raise exception 'only Hackdex can set these hack fields';
end if;
return new;
end if;
if new.slug is distinct from old.slug then
raise exception 'non-admins cannot change slug';
end if;
if new.created_by is distinct from old.created_by then
raise exception 'non-admins cannot change created_by';
end if;
if new.approved is distinct from old.approved then
raise exception 'non-admins cannot change approved';
end if;
if (
new.downloads, new.is_archive, new.current_patch, new.original_author, new.permission_from, new.submitted_at,
new.approved_at, new.approved_by, new.rejected, new.rejected_at, new.rejected_reason, new.rejected_by, new.assigned_admin,
new.ai_graphics, new.ai_music, new.ai_story, new.ai_translation, new.ai_events, new.ai_code, new.ai_note, new.ai_disclosed_at,
new.deleted_at, new.deleted_by, new.redirect_url,
new.curated, new.curated_at, new.curated_by
) is distinct from (
old.downloads, old.is_archive, old.current_patch, old.original_author, old.permission_from, old.submitted_at,
old.approved_at, old.approved_by, old.rejected, old.rejected_at, old.rejected_reason, old.rejected_by, old.assigned_admin,
old.ai_graphics, old.ai_music, old.ai_story, old.ai_translation, old.ai_events, old.ai_code, old.ai_note, old.ai_disclosed_at,
old.deleted_at, old.deleted_by, old.redirect_url,
old.curated, old.curated_at, old.curated_by
) then
raise exception 'only Hackdex can change these hack fields';
end if;
return new;
end;
$function$;

View File

@@ -547,3 +547,6 @@ CROSS JOIN LATERAL generate_series(0, spec.cnt - 1) AS gs(n);
-- Seeded hacks count as submitted (drafts are made in the app); otherwise the pending ones show up as private drafts.
UPDATE public.hacks SET submitted_at = created_at WHERE slug LIKE 'seed-%' AND submitted_at IS NULL;
-- Curated so Discover and the homepage have something to show locally.
UPDATE public.hacks SET curated = true, curated_at = coalesce(approved_at, created_at) WHERE slug LIKE 'seed-%' AND approved AND NOT is_archive;

View File

@@ -5,7 +5,7 @@ begin;
create extension if not exists pgtap with schema extensions;
select plan(17);
select plan(21);
insert into auth.users (id, email) values
('aaaaaaaa-0000-4000-8000-000000000001', 'owner@test.local'),
@@ -58,6 +58,16 @@ select lives_ok(
);
select is((select title from public.hacks where slug = 'owned-hack'), 'Renamed', 'hack edit applied');
select throws_ok(
$$ update public.hacks set curated = true, curated_at = now() where slug = 'owned-hack' $$,
'P0001', 'only Hackdex can change these hack fields', 'owner cannot curate their hack'
);
select throws_ok(
$$ insert into public.hacks (slug, title, summary, description, base_rom, patch_url, version, language, created_by, curated, curated_at)
values ('forged-curated', 'Forged', 's', 'd', 'poke_emerald', '', '1.0', 'English', auth.uid(), true, now()) $$,
'P0001', 'only Hackdex can set these hack fields', 'owner cannot insert a curated hack'
);
-- An archiver who doesn't own the hack, so only the archiver policies apply. The role comes from
-- protected app_metadata.
select set_config('request.jwt.claims', '{"sub":"aaaaaaaa-0000-4000-8000-000000000002","role":"authenticated","app_metadata":{"archiver":true}}', true);
@@ -99,6 +109,15 @@ select isnt(
(select deleted_at from public.hacks where slug = 'owned-hack'), null,
'service role can soft-delete a hack'
);
update public.hacks set curated = true, curated_at = now() where slug = 'archive-hack';
select ok(
(select curated from public.hacks where slug = 'archive-hack'),
'service role can curate a hack'
);
select throws_ok(
$$ update public.hacks set curated_at = null where slug = 'archive-hack' $$,
'23514', null, 'a curated hack must have a curation date'
);
-- A verified creator's own later edit doesn't drop their badge.
reset role;