Repository navigation
#309: the curated page as its own article, phone first #315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cad1fdb
#309 D3: /on/:slug as its own curated article, phone first
holden 1a9903f
#309 D3: screenshots of the built page from the 4017 demo server
holden b1b25c2
#309 D3: short related words, one switch on both views
holden 8b469e6
#309 D5: 44 px tap targets and the artwork label's contrast
holden 6ddd106
#309 D6: the built love page at 375 px, screen by screen, as the read…
holden edc8a41
#309 D3: the independent review's three REQUIRED items, and its cheap…
holden d471db4
#309: the second review's REQUIRED item, and its cheap RECOMMENDED
holden 80e368a
#309: the third review's two REQUIRED items, and its cheap RECOMMENDED
holden 8377c1b
#309: every tap target 44 px at 640 px and wider too
holden 00f47f1
#309: review 5's REQUIRED small links, one credit to a line
holden f952b48
#309: review 6's byline link, Wikidata and a sense's source on lines …
holden 8f2c901
#309: one view switch on both views, and a wide screen's width
holden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+139 KB
docs/discovery/issue-309-d3-bestiality-375-light-first-screen-2026-11-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+135 KB
docs/discovery/issue-309-d3-greed-375-light-first-screen-2026-11-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+126 KB
docs/discovery/issue-309-d3-love-375-light-first-screen-2026-11-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+140 KB
docs/discovery/issue-309-d3-nepotism-375-light-first-screen-2026-11-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| defmodule DevilsDictionary.Curation.PageState do | ||
| @moduledoc """ | ||
| What a curated page says when it has no selection to show (#309 §4 H, D1 | ||
| rows 20–23), and the versions its footer lists. | ||
|
|
||
| * `%{kind: :withheld, reasons, published_on, assessment}` — a version is | ||
| published but withheld as a whole (`Published.current/1`), with the | ||
| composition's latest assessment under the current configuration, or | ||
| `nil`; | ||
| * `%{kind: :abstained, editor, assessed_at, reason}` — nothing is | ||
| published and the editor last assessed the words and chose not to | ||
| select; `reason` is its stored abstain reason, or `nil` when none was | ||
| stored or it was withheld; | ||
| * `%{kind: :unpublished}` — nothing is published and the latest | ||
| assessment did something else (it needs an editor, or a proposal | ||
| waits for the owner); | ||
| * `%{kind: :none}` — no editor has assessed the words under the current | ||
| configuration, or the page has no composition. | ||
|
|
||
| It reads the same rows the page's reader and refresh clock read: the global | ||
| default configuration, the page's composition, its publication, its | ||
| refresh row and, for an abstention, the latest abstained attempt under the | ||
| composition and configuration version that finished by the row's last | ||
| completion. Database reads only; no model, | ||
| no write, and never an attempt's packet summary (#299 M5). | ||
| """ | ||
|
|
||
| import Ecto.Query | ||
|
|
||
| alias DevilsDictionary.Curation.{ | ||
| CompositionItem, | ||
| CompositionPublication, | ||
| CompositionVersion, | ||
| Compositions, | ||
| Configurations, | ||
| Published, | ||
| PublishedReader, | ||
| Publications, | ||
| Refresh | ||
| } | ||
|
|
||
| alias DevilsDictionary.Repo | ||
|
|
||
| def for_page(page) do | ||
| with {:ok, %{configuration: configuration, version: configuration_version}} <- | ||
| Configurations.resolve_default(), | ||
| {:ok, ids, language} <- PublishedReader.scope(page), | ||
| %{} = composition <- | ||
| Compositions.active( | ||
| configuration.id, | ||
| :lexical_page, | ||
| language, | ||
| Compositions.signature(ids) | ||
| ) do | ||
| assessment = assessment(composition.id, configuration_version.id) | ||
|
|
||
| case Published.current(composition.id) do | ||
| {:withheld, reasons} -> | ||
| %{ | ||
| kind: :withheld, | ||
| reasons: reasons, | ||
| published_on: published_on(composition.id), | ||
| version: version_number(composition.current_published_version_id), | ||
| assessment: assessment | ||
| } | ||
|
|
||
| _ -> | ||
| assessment || unassessed(composition.id, configuration_version.id) | ||
| end | ||
| else | ||
| _ -> %{kind: :none} | ||
| end | ||
| end | ||
|
|
||
| @doc """ | ||
| What the editor chose in a version: how many items it holds and whether | ||
| one of them is the lead, for "The editor chose {k}" (D1 row 17c), which | ||
| counts the version's items, shown or withheld at read time. | ||
| """ | ||
| def chosen(composition_id, version) do | ||
| Repo.one( | ||
| from i in CompositionItem, | ||
| join: v in CompositionVersion, | ||
| on: v.id == i.composition_version_id, | ||
| where: v.composition_id == ^composition_id and v.version == ^version, | ||
| select: %{items: count(i.id), lead?: fragment("bool_or(? = 'lead')", i.role)} | ||
| ) | ||
| end | ||
|
|
||
| @doc "The composition's earlier published versions, newest first." | ||
| def earlier_versions(composition_id, version) do | ||
| Repo.all( | ||
| from p in CompositionPublication, | ||
| join: v in CompositionVersion, | ||
| on: v.id == p.published_version_id, | ||
| where: | ||
| p.composition_id == ^composition_id and p.action == :publish and v.version < ^version, | ||
| distinct: true, | ||
| select: v.version | ||
| ) | ||
| |> Enum.sort(:desc) | ||
| end | ||
|
|
||
| defp version_number(nil), do: nil | ||
|
|
||
| defp version_number(version_id) do | ||
| Repo.one(from v in CompositionVersion, where: v.id == ^version_id, select: v.version) | ||
| end | ||
|
|
||
| defp published_on(composition_id) do | ||
| case Publications.latest(composition_id) do | ||
| %{committed_at: %NaiveDateTime{} = at} -> NaiveDateTime.to_date(at) | ||
| %{committed_at: %DateTime{} = at} -> DateTime.to_date(at) | ||
| _ -> nil | ||
| end | ||
| end | ||
|
|
||
| # The refresh row's outcome is the assessment. Its generation moves on as | ||
| # soon as the next check is admitted, while the outcome and its time stay | ||
| # the last completed run's, so the attempt is the latest abstention under | ||
| # this composition and configuration version that finished by then — not | ||
| # the one the current generation names (#309 review R1). | ||
| defp assessment(composition_id, configuration_version_id) do | ||
| case Refresh.state_for(composition_id, configuration_version_id) do | ||
| %{last_outcome: :abstained, last_completed_at: %{} = at} -> | ||
| attempt = abstention("proposal:#{composition_id}:#{configuration_version_id}:", at) | ||
|
|
||
| %{ | ||
| kind: :abstained, | ||
| assessed_at: at, | ||
| attempt?: not is_nil(attempt), | ||
| editor: attempt && attempt.editor, | ||
| reason: attempt && present(attempt.reason), | ||
| # The runtime blanks a reason that quoted provider text; the page | ||
| # then says nothing about a reason rather than "gave no reason". | ||
| reason_withheld?: (attempt && attempt.reason_withheld?) || false | ||
| } | ||
|
|
||
| _ -> | ||
| nil | ||
| end | ||
| end | ||
|
|
||
| defp unassessed(composition_id, configuration_version_id) do | ||
| case Refresh.state_for(composition_id, configuration_version_id) do | ||
| %{last_completed_at: %{}} -> %{kind: :unpublished} | ||
| _ -> %{kind: :none} | ||
| end | ||
| end | ||
|
|
||
| defp abstention(prefix, at) do | ||
| finished_by = at |> DateTime.to_naive() |> NaiveDateTime.add(1, :second) | ||
|
|
||
| Repo.one( | ||
| from a in "inference_attempts", | ||
| left_join: actor in "actors", | ||
| on: actor.id == a.requested_by_actor_id, | ||
| where: | ||
| like(a.request_key, ^(prefix <> "%")) and a.outcome == "abstained" and | ||
| a.finished_at <= type(^finished_by, :naive_datetime), | ||
| order_by: [desc: a.finished_at, desc: a.id], | ||
| limit: 1, | ||
| select: %{ | ||
| editor: actor.label, | ||
| reason: fragment("?->>'abstain_reason'", a.result), | ||
| reason_withheld?: fragment("(?->>'abstain_reason_withheld') is not null", a.result) | ||
| } | ||
| ) | ||
| end | ||
|
|
||
| defp present(text) when is_binary(text), do: if(String.trim(text) == "", do: nil, else: text) | ||
| defp present(_text), do: nil | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: razrfly/dictionary
Length of output: 9654
Script executed:
Repository: razrfly/dictionary
Length of output: 45548
Script executed:
Repository: razrfly/dictionary
Length of output: 19948
Script executed:
Repository: razrfly/dictionary
Length of output: 15584
Bound abstention lookup results to the refresh timestamp.
A later generation can complete an abstained attempt after the row's
last_completed_atand before that generation updates the row. The one-second allowance can therefore display the later attempt's editor and reason with the previous assessment. Use the refresh timestamp as the upper bound.Suggested fix
Committable suggestion