Repository navigation
refactor(desktop): move the editor's plain logic out of MyGo's packages - #288
Merged
Merged
Conversation
Plan 0011, Phase 1: the logic the NSGo client will need moves to packages that import neither MyGo nor frostui's root module. - internal/desktop/markup (new): the formatting commands and smart lists, links and tags under the caret, frontmatter and properties, and the attachment rules, moved from editor with their tests; editor keeps the clipboard, drops and uploads (upload.go). - panes/tree.go moves to catalog, with its tests. - catalog uses markup and its own Score, a copy of frostui.Match. - system/open.go carries frostui's SanitizeMailto; the allow-lists stay in the same file. - cmd/frostnotes' fuzz targets hold both copies to frostui's results. - The NSGo module no longer needs MyGo or frostui's root module (go mod tidy; make flatpak-sources).
frostyard-machines
approved these changes
Nov 25, 2026
This was referenced Nov 25, 2026
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.
Summary
Phase 1 of plan 0011, "Logic out of MyGo's packages" (the plan and ADR-0049 are on #287, not yet on main). The plain Go logic that the NSGo client will need now lives in packages that import neither MyGo nor frostui's root module. The MyGo client uses the moved code, and its behaviour does not change: the code moved as it was, only package names and qualifiers changed. The exceptions are listed below.
A new package,
internal/desktop/markup, holds what the editor does to a note's Markdown source as plain text. I named itmarkupbecauseinternal/markdownis already notesd's parser, andnotesis the document model.git mvfromeditor:format.go(the formatting commands and smart lists),links.go(LinkAt,TagAt,SubpathLine),properties.go(frontmatter, properties and property types), withformat_test.goandproperties_test.go.attach.goalso moved withgit mv. It keeps the parts that use no MyGo type:MaxAttach,FileandFile.Read,AttachmentFolder,FreePath,PastedName,EmbedForandCleanName. It gainsInsertEmbeds, which is the oldinsertEmbedsbody as a function of the text and the selections.mygo/transferormygo/uistay ineditor, inupload.go:Uploader,Clipboard,Attach,AttachPaths, paste and drops.Target(a[[completion) moved fromnoteeditor.gotolinks.go, andtagRangesmoved fromsyntax.go(TagAtuses it) asTagRanges.valueTextandlistItemsbecameValueTextandListItemsfornoteview.go.review_test.gois split: 13 tests went tomarkup/review_test.go, and the 3 that drive the editor stay ineditor/review_test.go.attach_test.go's naming test went to markup, and the paste test is noweditor/upload_test.go.panes/tree.go→catalog/tree.go(git mv), with its 3 tests incatalog/tree_test.go.parentOfbecamecatalog.Parent, becausepanes/files.gouses it. Thepanespackage comment moved topanes.go.catalogno longer importseditor(it usesmarkupinstead) orfrostui.Scoreis a copy offrostui.Match(v0.10.1), andSearchuses it.system/open.gono longer importsfrostui:WebURL,VaultFile,OpenableExtensionsand the mailto cleaning all stay in this file.SanitizeMailtois frostui'sSanitizeMailto(v0.10.1) copied in, error text included, so the app says what it said before.systemusedfrostui.Opener.cmd/frostnotesalready holds it (openURL,openFile), so nothing had to move there.Parity with frostui:
cmd/frostnotes/frostui_parity_test.gokeeps both copies equal to frostui while the MyGo client has frostui. It holds 2 fuzz targets,FuzzSanitizeMailtoIsFrostuisandFuzzScoreIsFrostuisMatch. They compare the copies withfrostui.SanitizeMailto(value and error text) andfrostui.Match(score and ok). In every unit run they cover their seeds: about 24,700 generated mailto links and 550 query and text pairs.system/open_test.gocarries frostui's ownmailtoCasesand refusal cases.catalog/score_test.gopins 22 scores that I took fromfrostui.Match.Other changes:
systemfree of frostui,cmd/frostnotes-nsgo'sgo mod tidydropsegoist/mygo,frostyard/frostuiandgo-text/typesetting(indirect).make flatpak-sourcesthen drops upstreamegoist/mygov0.10.0 fromgo-sources.json.AGENTS.md(Map) anddocs/design/app.mdname the new layout. Plan 0011 is not on main, so I did not edit it.Note on correction records: 9 legacy records in
.memory/corrections/(0027, 0028, 0031, 0032, 0033, 0041, 0048, 0052, 0055) havepromoted_toset tointernal/desktop/editor/review_test.go. Their guards (except 0041's late-completion check, which stays) are now ininternal/desktop/markup/review_test.go. The baseline rule says a record's non-emptypromoted_tonever changes, so I left the records as they are.Import check (
go list -deps, andgo list -deps -test):internal/desktop/markup,catalogandsystemimport neithergithub.com/egoist/mygonorgithub.com/frostyard/frostui. Neither donotesandlivepreview.Risk tier
Risk tier: 3. I matched every changed path against
.github/risk-paths.jsonby script, expanding brace globs and**(old and new names of renamed files). 2 paths match, both in the L1 sanitizer glob{internal/render/sanitize.go,app/src/reading/sanitize.ts,internal/desktop/system/open.go,internal/desktop/media/media.go,internal/desktop/reading/view.go,internal/desktop/editor/live.go}:internal/desktop/system/open.go: the allow-lists' logic is unchanged.WebURL's checks,VaultFileandOpenableExtensionsare unchanged. The only change is thatWebURLcalls the file's ownSanitizeMailtoinstead of frostui's.url.Parse, the scheme check, keeping only to, cc, bcc, subject and body in ASCII case, and droppingForceQueryand the fragment. Its refusals have the same text.cmd/frostnotes(value and error text, on about 24,700 seeds; a 20-secondgo test -fuzzrun found no difference), and by frostui's own case table inopen_test.go. The existingTestWebURLsandTestVaultFileRulespass unchanged.internal/desktop/editor/live.go: the only change isSelandEditwritten asmarkup.Selandmarkup.EditinsetTask, plus the import. Nothing in what it draws or hides changes.Every other path is at the default L3.
Docs housekeeping
docs/design/app.mdnamesinternal/desktop/markup/attach.goand the new layout;AGENTS.md's Map is updated. No new doc, ADR or spec.AGENTS.mdwas edited.Verification
make checkgreen (host): exit 0 on the final tree.make flatpak-sourcesrun (the NSGo module'sgo.modandgo.sumchanged bygo mod tidy).make desktop-bench: exit 0 (developer machine, AMD Ryzen AI Max+ 395, 100 keystrokes): source mode 2.00 ms, live preview 8.40 ms per keystroke; the gate is 16 ms.go test -list), before → after:editor: 61 tests and 1 benchmark → 40 and 1 benchmark.markup: 21 (61 in total, as before).panes: 18 → 15.catalog: 4 → 8 (+3 tree, +1 score).system: 7 → 9 (+2 mailto).cmd/frostnotes: 0 → 3 (1 test, 2 fuzz targets).window: 73 → 73.