Repository navigation
Merge PRs #28 to #38 into main (they merged into #27's branch) - #41
Merged
Merged
Conversation
…d fix the publish step
Each published version downloads its own schema's dictionary, so once `main` moves to schema 7, two schemas are live: 0.1 to 0.3 read schema 6 from `dictionary-latest`, and the next release reads `dictionary-v7`. The workflow built only the schema of the commit it ran on. After the bump, schema 6 would never be refreshed again, and nothing could rebuild it.
The data workflow now builds each schema that a published release reads, from the newest code that reads it: the current commit for its own schema, and the newest release tag for any older one. `scripts/data-builds.ts` derives this from the release tags, so tagging a release is what adds its schema to the set. A plan job turns it into a matrix of `{ schema, ref, tags }`. Each build job checks out its ref, builds with that ref's own scripts, checks that the built sidecar names the planned schema, and publishes to the planned tags. `fail-fast` is off, so a schema that fails to refresh never stops the others.
- A push that changes the schema or the data build rebuilds the current schema; a manual run refreshes every live schema.
- A manual run with `publish` off builds and checks everything and uploads nothing, for testing the workflow on a branch.
- `scripts/release-tags.ts` is gone; the plan computes the tags with the same `releaseTagsFor`.
**Fixed: the publish step has failed on every run since 2026-08-09.** It uploads `jisho-common.db.zst*`, but no step built the common dictionary, so `gh release upload` stopped at "no matches found for assets/jisho-common.db.zst.sha256" and published nothing. `dictionary-latest` still holds the 2026-08-10 build. Each job now builds and verifies the common dictionary first. `.gitignore` also gains the common archive, which every `vp run build:data` writes.
…g nothing (D-2) Tests never ran the release steps: the dictionary check, the provisioning, the per-platform packaging and the publish script. Each one first broke after the merge, in the Publish job, with the release already under way (audit I-10, I-11). Bumpy's version PR now gets a "Release gate (packaging)" job with the Publish job's steps, in the same order: - `check-data-release.ts`: red until this schema's dictionary is published, which is the point; - the tokenizer dictionary; - `vp run build:platforms`: the WASM, both bundles, and one `.vsix` per platform; - `publish-vsix.ts --dry-run`. No tokens are needed: nothing is uploaded. `publish-vsix.ts --dry-run` does everything but publish. It checks that every package is a platform build of this version (a stray one from an earlier version, or one whose name does not parse, would be offered to the registries again, or published to Open VSX as universal). It checks that `vsce` and `ovsx` resolve, and asks the Marketplace what it already has. Then it prints each publish command instead of running it.
`pasting a sentence lands it once, with the caret after it` read the search box once, right after pressing paste. The paste handler suppresses the native paste, reads the clipboard asynchronously and re-inserts the text, so the read raced that insert and sometimes saw an empty box. It failed the release gate's macOS E2E job on 2026-11-09, and a local Windows run the same day, with nothing wrong. It now waits the way the clipboard spec's paste test always has (`toPass`, 5 s), for both the paste and the character typed after it. A paste that never lands still fails.
…ached (H-11) Three problems in the part-of-speech colouring pass (audit SM-6, P-2): - **Split view.** Passes and the debounce were keyed by DOCUMENT. A second editor on the same document cancelled the first one's pass, so only one side of a split view was ever coloured. They are now keyed by editor. Generations come from one counter that is never reused, so an entry can be dropped once its pass is done without a stale pass ever matching a newer number. - **A pass could not be interrupted.** `segment()` resumes through microtasks, and VS Code's events are macrotasks, so the per-line `superseded()` check never saw a keystroke. A whole pass (~120 lines, 80-200 ms) blocked the extension host. The pass now yields to the event loop every 8 ms of work, so a scroll or the debounced repaint after a keystroke supersedes it. - **No cache.** Scrolling back over coloured text tokenized every line again. Each line's colouring is now cached by its text in a bounded LRU (5,000 lines), so a second pass over the same lines makes no tokenizer calls. The comment-span filter for code files still applies on every pass, because it depends on the surrounding lines. Tests, each mutation-checked: both editors of a split view are coloured; each has its own debounce; a newer pass interrupts a running one, so only the newest paints; a second pass makes no tokenizer calls. The fake-timer cleanup moved to an `afterEach`: a failing assertion used to leave fake timers on, which hung every later test.
…ver (H-12) Whether a position is in a comment depends on the grammar's rule stack there, and the stack at a line is defined by every line above it. So each hover tokenized from line 0, on a path with no debounce: ~140 ms at line 2,000 (audit P-4). The decoration pass paid the same walk before each viewport. `LineStates` keeps the tokenizing state (rule stack, and whether a JSDoc fence is open) at every 100th line, per document version. A lookup tokenizes from the nearest checkpoint at or above it, at most 99 lines, and keeps the checkpoints it passes. `commentSpans`, which both the hover and the decorations use, records them as it goes. An edit changes the version, which drops that document's checkpoints. At most 16 documents are kept. `stackAt` and `fencedAt`, the two walks from line 0, are gone. Tests, each mutation-checked against a counting fake grammar: a second hover at line 2,000 tokenizes no lines, and one at 2,050 tokenizes 50; an edit starts over; an open fence survives a checkpoint; documents are kept apart.
…a stuck reading (H-13) `speechSynthesis` is one queue for the page, but each `SpeechSequence` tracked only its own token (audit SM-7). When `speak()` or another sequence cleared the queue, the interrupted sequence's current reading ended, its wait resolved, and it went on to its NEXT reading, still reporting "playing". - **One owner.** `speech.ts` tracks every playing sequence. Starting any speech goes through `takeQueue`, which cancels every other sequence through its own token before clearing the queue, so an interrupted sequence ends and reports "not playing". - **Late voices.** The voice check waited one second and then cached `null` for the session, so a voice that loaded later never showed a play button. A `voiceschanged` listener now drops the cached voice and tells subscribers (`onVoicesChanged`), and the webview invalidates the `speechAvailable` query. - **Stuck readings.** Engines do not always fire `end`. A reading now gives up after 2 s plus 500 ms a character, so a sequence cannot wait forever while showing Stop. `speech.spec.ts` (new, in the browser project) drives the module against a fake `speechSynthesis` that ends the current utterance on `cancel()`, as real engines do. A word spoken over a sequence stops it; a second sequence stops the first; late voices are noticed; a reading that never ends does not hang its sequence. Each test is mutation-checked.
…annot apply (H-14) The spacing and furigana commands read the text, await the tokenizer, then call `editor.edit`. If the document changed meanwhile (typing, a formatter, another extension), VS Code refuses the edit. `edit` answers false, the code ignored it, and the command did nothing and said nothing (audit I-12). `transformEditorText` now checks the document's version after the transform and the result of `edit`. When either fails, it redoes the transform once on the current text and selection. If that fails too, it shows a warning. An edit on a closed editor, which throws rather than answering false, counts as refused. `editorCommands.spec.ts` (new), each test mutation-checked: the ordinary case is one transform and one edit; a change mid-transform is redone on the new text; text that keeps changing gets a warning; a refused edit gets a warning.
…ted (D-3)
The extension had four answers to "what happens after this fails once?" (retry, keep the failure, degrade, keep a `null`), each chosen in its own file, and none stated where the value was made (audit I-15).
`lazy(make, { onFailure: "retry" | "keep" })` in `src/shared/lazy.ts` states it at every use:
- the tokenizer: retry. One failed build used to disable the hover, the colouring and the editor commands until reload (SM-5).
- the handwriting recognizer chunk: retry. A failed load used to be kept, so handwriting recognized nothing until the panel reloaded.
- the comment grammars and the oniguruma WASM: keep. A grammar or WASM that cannot load now will not on the next keystroke either; the WASM failure is logged once.
- the speech voice: keep, and `reset()` when the OS voices change (H-13).
The database is not on the list any more: since H-7 it goes through `DictionaryLifecycle`, which states its own policy (record the failure, retry on the next request).
All callers share one attempt. A "retry" helper forgets a failure even when `make` throws synchronously, which would otherwise happen before the promise was stored. A stale failure cannot forget a newer attempt after `reset()`. Five tests, each mutation-checked.
Three places relied on a comment to keep two things in step (audit I-6, I-8, I-4): - **The restorable views** were a hand-kept set of strings. A `View` added without being listed silently became unrestorable, and a reload dropped the session to a fresh search, which is how `browse` and `wordList` broke between #54 and 2026-08-06. They are now a table of field checks declared `satisfies Record<View["name"], …>`, so an omission does not compile. Each view's fields are checked too: a view written by an older build with a field since renamed is refused, not restored and rendered broken. - **Search ranking** was written twice, in SQL and in JavaScript (for results the deinflection merge adds), with a comment saying they "must agree". It is now `RANK_ORDER_BY` and `byRank`, side by side, and `searchRanking.spec.ts` runs both over the same 300 rows (ties and unranked words included, three seeds) in an in-memory SQLite table. - **The statement cache** claimed `IN (…)` lists were "short by design", citing a CONVENTIONS rule that was reversed in August: `IN` is preferred, and `refineCounts` builds lists of up to 900, one cached statement per length. It is now an LRU capped at 256, and a test holds the cap. Every check is mutation-checked: a view missing from the table fails to compile (TS2741); a name-only check, reversed frequency or commonness order on either side, and an uncapped cache each fail their test.
…rd (D-7) The startup trace samples event-loop lag every 250 ms, to tell "our code is slow" from "our code is queued". The interval ran until deactivation, and kept going after its 200-sample buffer was full: speculative work, four times a second, that could never add to the record (audit SM-11). It now stops when the buffer is full or ten minutes after activation, whichever comes first. Ten minutes covers a first-run download and the first searches, hovers and colouring passes, which are the stalls the trace exists to explain. A full buffer alone was not enough, since stalls over 100 ms are rare and it might never fill. A fake-timer test shows the interval cleared after the window, and it fails when the window check is removed.
The four bounded workloads (`bench/*.bench.mjs`) have committed baselines of their structural findings: megamorphic inline caches, deopt loops, hidden-class churn. Nothing checked them. A new `deopt` job in `ci.yml` runs `deoptkit ci` on all four and fails on any new finding. It runs every workload before failing, so one finding cannot hide another. **It runs on Node 26, not the host's 24.22.** The plan was to try the runner's Node 24.22 first. Locally, under Node 24.22, all four workloads fail before measuring anything: the bench bundle includes the handwriting recognizer, whose patterns decode with `Uint8Array.fromBase64`, which exists only in Chromium 148 and Node 25+. That code runs in the webview, whose V8 is nearer Node 26's, and the baselines were recorded on Node 26. On Node 26, three workloads matched as they were. The editor-commands workload reported its map-churn finding (on Lindera's native token objects, judged inherent by the audit) under a new identity: wrapping the tokenizer build in `lazy()` (D-3) gave it the function name `buildTokenizer` where it had none. That baseline is re-recorded. All four then matched on two further runs. Removing a finding from a baseline makes the job's step exit 1. `bench/README.md` now says it is a gate, why it runs on Node 26, and how to accept an expected finding.
…ay how to check their numbers (A-1 to A-4) - **A-1, stale and false documentation.** The audit's table of wrong claims (its section 4) is now clear. Earlier PRs fixed most of it. This one corrects the rest: - the tokenizer's WASM timings (it has been a native binding for months), and its ~200 ms first-load claim, which is ~9 ms + 39 ms; - `patterns.data.ts`'s instruction to re-run a script that has never existed (BACKLOG #21); - `SchemaVersionError`'s note, which now names where the update prompt comes from; - spec 21's status, which is IMPLEMENTED. - **A-2, `docs/ARCHITECTURE.md`.** The three places code runs and what each may not use; the bridge; the state machines; the data pipeline from source to an installed dictionary, including what happens when a download fails halfway; the release pipeline; and a table of where each audit invariant (I-0 to I-15) is enforced now. Linked from `CLAUDE.md` and `CONTRIBUTING.md`. - **A-3, numbers that can be checked.** CONVENTIONS.md: a comment that quotes a measurement names the bench case that reproduces it, or says how and when it was measured. Applied in `queries/browse.ts`, `posDecorations.ts`, `grammar.ts` and `tokenizer.ts`. Two of those comments were wrong, not just unsourced: one still claimed a superseded colouring pass stopped "cheaply", which was false until H-11. - **A-4, the project's hazards in `CLAUDE.md`,** each linked to its guard: two runtimes; the worker without `vscode`; Windows and open files; Yarn's three-day quarantine; `dictionary-latest`; Lindera bumps; `vp build` versus `vp pack`; and never running `bumpy ci` locally. D-6 (one source per benchmark) is recorded in the plan as blocked upstream. deoptkit's Vitest preset cannot cap iterations, and `deoptkit ci` gates scripts, which the D-5 gate now relies on.
docs: an architecture map, the project's hazards, and checkable numbers (A-1 to A-4)
|
The changes in this PR will be included in the next version bump.
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


PRs #28 to #38 were stacked: each one's base was the branch below it. #28's base was
refactor/one-protocol-definition(#27). When the first stack merged intomain, #27 merged with it, and the second stack then merged into #27's branch, not intomain. Somainis missing the 13 commits of #28 to #38.This PR merges that branch into
main. It merges cleanly (git merge-treeagainst today'smain), and it is the first CI run these changes get on GitHub, becauseci.ymlruns only on PRs intomain.What it brings:
dictionary-v{N})lazy(), sync comments as checks, the heartbeat stop, the deoptkit gate (D-3, D-4, D-7, D-5)