A word of her own language could never reach the garden

Right-clicking "carro" in a Portuguese document showed a full word card
— gloss, phonetic, two definitions — and stored nothing. The forward
lookup of a Portuguese word answers empty; everything the card renders
comes out of `reverse`, and the capture gate only ever read the forward
fields. Academic while every document was English. On a Portuguese
document it emptied the garden of exactly the words she met.

So the reverse reading now counts as known, and fills `definition` (its
gloss is the English sense — "carro" → "car; automobile; machine",
which is what a review card wants) and `phonetic`. Forward lookups are
untouched: the reverse fields are read only where the forward ones are
empty, so an English word with a Portuguese gloss captures exactly as
it did.

Claude-Session: https://claude.ai/code/session_01GJHNvirh7Hzhc9RL3HAvz7
This commit is contained in:
prosolis
2026-07-29 00:35:15 -07:00
parent acb35108c0
commit 2c5b05b398
+19 -3
View File
@@ -1106,7 +1106,17 @@ export function EditorCore({
// actually knows (a real gloss or definition), so accidental lookups of
// typos or proper nouns don't clutter the garden. Looking words up IS
// the data source; this costs the writer nothing.
const known = !!info.gloss || info.definitions.length > 0
//
// "Knows" has to include the reverse reading, or a word of her own
// language can never be captured at all: the forward lookup of "carro"
// answers with nothing, and everything the card shows her comes out of
// `reverse`. Before Phase 28 that was academic, because every document
// was English; on a Portuguese document it silently emptied the garden
// of every word she actually met. Caught in a browser 2026-07-29 —
// right-clicking "carro" showed a full card and stored nothing.
const rev = info.reverse
const known =
!!info.gloss || info.definitions.length > 0 || !!rev?.gloss || (rev?.definitions?.length ?? 0) > 0
// Reflect the saved state optimistically so the heart shows 💚 the
// moment a known word loads, rather than flashing 🤍 until the capture
// round-trips. vocabId is filled in when recordVocab returns.
@@ -1116,12 +1126,18 @@ export function EditorCore({
.recordVocab({
word: range.word,
gloss: info.gloss,
definition: info.definitions[0]?.definition ?? '',
// `definition` is the English sense the review card falls back to
// when there is no gloss in her language — and for a word that *is*
// her language, the reverse gloss is exactly that: "carro" →
// "car; automobile; machine". The Portuguese monolingual definition
// underneath it explains the word in the language she already knows
// it in, which is not what a flashcard is for.
definition: info.definitions[0]?.definition ?? rev?.gloss ?? '',
// The garden's pronunciation field holds whichever this word has:
// IPA for an English word, pinyin for a Chinese one. Both answer
// the same question on a review card — how do I say this — and a
// second column would only be a second thing to keep in sync.
phonetic: pinyin || info.phonetic,
phonetic: pinyin || info.phonetic || rev?.phonetic || '',
example,
doc_id: docId,
})