Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
994 changes: 994 additions & 0 deletions lib/devils_dictionary/curation/curators.ex

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/devils_dictionary/curation/receipt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ defmodule DevilsDictionary.Curation.Receipt do
attempt_id: attempt && attempt.id,
request_key: attempt && attempt.request_key,
profile: cv && cv.manifest["editor"],
# The exact curator version this choice was made under (#299 M1).
curator_path:
attempt && cv && DevilsDictionary.Curation.Curators.version_path(cv.manifest["editor"]),
at:
if(attempt,
do: attempt.finished_at || attempt.admitted_at,
Expand Down
19 changes: 11 additions & 8 deletions lib/devils_dictionary/curation/shelf_citations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,21 @@ defmodule DevilsDictionary.Curation.ShelfCitations do
@doc false
def expired?(%ShelfCitation{} = c, now \\ DateTime.utc_now()) do
source = Repo.get!(Source, c.source_id)

DateTime.compare(
now,
min_time(c.expires_at, DateTime.add(c.observed_at, Policy.retention_seconds(source.slug)))
) != :lt
DateTime.compare(now, deadline(c, source)) != :lt
end

@doc """
When a citation's observation stops being shown: its own expiry or its
source's retention window from the observation, whichever comes first.
Pure, so a caller holding many citations and their sources asks nothing
more (`Curators`, #299).
"""
def deadline(%ShelfCitation{} = c, %Source{slug: slug}),
do: min_time(c.expires_at, DateTime.add(c.observed_at, Policy.retention_seconds(slug)))

def check(%ShelfCitation{} = c, now \\ DateTime.utc_now()) do
source = Repo.get(Source, c.source_id)

deadline =
min_time(c.expires_at, DateTime.add(c.observed_at, Policy.retention_seconds(source.slug)))
deadline = deadline(c, source)

cond do
DateTime.compare(now, deadline) != :lt ->
Expand Down
10 changes: 10 additions & 0 deletions lib/devils_dictionary/sources.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ defmodule DevilsDictionary.Sources do
Repo.all(from s in Source, order_by: s.slug)
end

@doc """
The sources that provide material, by slug: every source but a curator's
bot principal (kind `:bot`). The footer's Sources list is this one; a
curator has its own page under `/curators` (#299 M1, CD-2). The bot rows
stay, because their actors and receipts depend on them.
"""
def list_providers do
Repo.all(from s in Source, where: s.kind != :bot, order_by: s.slug)
end

@doc """
Records one observation of a source record.

Expand Down
8 changes: 5 additions & 3 deletions lib/devils_dictionary_web/components/layouts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ defmodule DevilsDictionaryWeb.Layouts do
<:links>
<.footer_category title="Browse">
<.footer_link navigate={~p"/artworks"}>Artworks</.footer_link>
<.footer_link navigate={~p"/curators"}>Curators</.footer_link>
</.footer_category>
<.footer_category title="Sources">
<.footer_link :for={source <- sources()} navigate={~p"/sources/#{source.slug}"}>
Expand Down Expand Up @@ -86,9 +87,10 @@ defmodule DevilsDictionaryWeb.Layouts do
end

# The footer names every source we absorb: the attribution #69 backbone rule 1
# asks for, and the fastest way to a source page. Five rows, read straight —
# there is no cache process in the tree and this does not deserve the first.
defp sources, do: DevilsDictionary.Sources.list_sources()
# asks for, and the fastest way to a source page. Read straight — there is no
# cache process in the tree and this does not deserve the first. A curator's
# bot principal is no provider and is listed under Curators instead (#299).
defp sources, do: DevilsDictionary.Sources.list_providers()

# The consoles are reachable from the chrome in development and in test,
# and by URL everywhere. Not `/ops/scopes/:slug` — that route needs a slug,
Expand Down
4 changes: 3 additions & 1 deletion lib/devils_dictionary_web/indexing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule DevilsDictionaryWeb.Indexing do
let crawlers retrieve noindex responses). `surface/1` names the surface a
router path belongs to, so a test can hold every route to this list.

#{Enum.map_join([{"/", "the way in, and search: `?q=` is a lookup variant"}, {"/on/:slug", "every On page but the launch manifest's lexical entries (D1), and any with a query string"}, {"/words/:id/:slug", "every exact word (D1)"}, {"/entities/:id/:slug", "the exact-identity route; its canonical is the subject's address where one is served"}, {"/<family>/:slug", "a draft, a withdrawn page, an alias, a choice, an unresolved address, every page while the switch is off, and any with a query string"}, {"/evidence/…", "raw evidence"}, {"/connections/…, /connect", "claims, proposals and their review"}, {"/sources/:slug", "a source's provenance page"}, {"/artworks", "the artworks shelf"}, {"/ops/…, /reconciliation, /users/…, /kit, /dev/…", "operations, review, accounts and development"}, {"/s/…, /health, /admin/…", "retired paths that redirect"}, {"/robots.txt, /sitemap.xml, /sitemaps/…", "for crawling, not pages: the sitemaps say noindex in X-Robots-Tag"}, {"?demo, ?opening, a section cursor, a trail, a drawer: any query string", "a view variant of a page whose canonical is its base"}], "\n", fn {surface, why} -> " * `#{surface}`: #{why}" end)}
#{Enum.map_join([{"/", "the way in, and search: `?q=` is a lookup variant"}, {"/on/:slug", "every On page but the launch manifest's lexical entries (D1), and any with a query string"}, {"/words/:id/:slug", "every exact word (D1)"}, {"/entities/:id/:slug", "the exact-identity route; its canonical is the subject's address where one is served"}, {"/<family>/:slug", "a draft, a withdrawn page, an alias, a choice, an unresolved address, every page while the switch is off, and any with a query string"}, {"/evidence/…", "raw evidence"}, {"/connections/…, /connect", "claims, proposals and their review"}, {"/sources/:slug", "a source's provenance page"}, {"/artworks", "the artworks shelf"}, {"/curators/…", "the curator pages: each AI curator, its versions and what it did"}, {"/ops/…, /reconciliation, /users/…, /kit, /dev/…", "operations, review, accounts and development"}, {"/s/…, /health, /admin/…", "retired paths that redirect"}, {"/robots.txt, /sitemap.xml, /sitemaps/…", "for crawling, not pages: the sitemaps say noindex in X-Robots-Tag"}, {"?demo, ?opening, a section cursor, a trail, a drawer: any query string", "a view variant of a page whose canonical is its base"}], "\n", fn {surface, why} -> " * `#{surface}`: #{why}" end)}

`robots.txt` keeps crawlers out of the surfaces that are not for reading
at all (`kept_out/0`): the registry's reserved prefixes that are neither a
Expand All @@ -44,6 +44,7 @@ defmodule DevilsDictionaryWeb.Indexing do
{"/connections/…, /connect", "claims, proposals and their review"},
{"/sources/:slug", "a source's provenance page"},
{"/artworks", "the artworks shelf"},
{"/curators/…", "the curator pages: each AI curator, its versions and what it did"},
{"/ops/…, /reconciliation, /users/…, /kit, /dev/…",
"operations, review, accounts and development"},
{"/s/…, /health, /admin/…", "retired paths that redirect"},
Expand All @@ -64,6 +65,7 @@ defmodule DevilsDictionaryWeb.Indexing do
"connect" => "/connections/…, /connect",
"sources" => "/sources/:slug",
"artworks" => "/artworks",
"curators" => "/curators/…",
"ops" => "/ops/…, /reconciliation, /users/…, /kit, /dev/…",
"reconciliation" => "/ops/…, /reconciliation, /users/…, /kit, /dev/…",
"users" => "/ops/…, /reconciliation, /users/…, /kit, /dev/…",
Expand Down
18 changes: 14 additions & 4 deletions lib/devils_dictionary_web/live/curation_receipt_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ defmodule DevilsDictionaryWeb.CurationReceiptLive do
<p id={"receipt-status-#{item.id}"}>{status(item)}</p>
<dl class="grid gap-x-6 gap-y-2 sm:grid-cols-[8rem_1fr]">
<dt class="font-medium">Chosen by</dt><dd id={"receipt-chooser-#{item.id}"}>
{chooser(item.chooser)}
<.link
:if={item.chooser[:curator_path]}
navigate={item.chooser.curator_path}
id={"receipt-curator-#{item.id}"}
class="underline underline-offset-4"
>{item.chooser.label}</.link>{if item.chooser[:curator_path],
do: chooser_detail(item.chooser),
else: chooser(item.chooser)}
</dd>
<dt class="font-medium">Chosen</dt><dd>{stamp(item.chooser.at)}</dd>
<dt class="font-medium">Reason</dt><dd id={"receipt-reason-#{item.id}"}>
Expand Down Expand Up @@ -195,16 +202,19 @@ defmodule DevilsDictionaryWeb.CurationReceiptLive do
defp status(%{status: :replaced, replacement: r}),
do: "Replaced by version #{r.version}, #{stamp(r.at)}."

defp chooser(%{kind: :model} = c),
defp chooser(%{kind: :model} = c), do: "#{c.label}" <> chooser_detail(c)

defp chooser(c), do: c.label || "chooser not recorded"

defp chooser_detail(c),
do:
"#{c.label}, an AI model · #{c.model} · model config ##{c.model_config_id} · attempt ##{c.attempt_id}" <>
", an AI model · #{c.model} · model config ##{c.model_config_id} · attempt ##{c.attempt_id}" <>
if(c.profile,
do:
" · profile ##{c.profile["profile_id"]}, version ##{c.profile["profile_version_id"]}",
else: ""
)

defp chooser(c), do: c.label || "chooser not recorded"
defp basis(nil), do: "basis not recorded"
defp basis(%{origin: "legacy_unknown"}), do: "basis not recorded (legacy choice)"

Expand Down
Loading