Skip to content

fix: clean text items read from files, tie plug-in consent to the settings key, start Windows agent shims safely - #17

Merged
nodemode-ai merged 8 commits into
mainfrom
fix/review-2026-11-28
Nov 29, 2026
Merged

nodemode-ai merged 8 commits into
mainfrom
fix/review-2026-11-28

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The text editor builds paragraph markup only from known alignments and list kinds, and from whole-number levels (0 to 6) and start numbers (1 to 9999). It skips paragraphs and runs that are not objects, and treats run text and colour as text.
  • Text items read from a PDF now go through the same paragraph and font cleaning as writes, so alignments, lists, levels, start numbers and colours come back as known values. Paragraphs or runs that are not lists read as empty instead of stopping the read.
  • Turning a plug-in on in Preferences stores a mark made with the settings key over the plug-in id and its file hash. A plug-in counts as on only when its mark matches, so a consent added to settings.json by hand, or a mark copied from another plug-in, leaves it off. Without a usable keychain the stored consent stands, as for the agent choice.
  • On Windows an npm .cmd shim for an agent program now runs as the node script it names, inside the shim's own folder, without cmd.exe. Any other .cmd or .bat still goes through cmd.exe. It refuses control characters, percent signs and double quotes, and refuses cmd special characters in words that are not quoted. A refused start shows as a program that does not start, and the dock answers 400. The shared finder moves to version 1.0.2 with its hash recorded.
  • Behaviour change: on a computer with a working keychain, a plug-in that was on before this change shows as off until it is turned on once more in Preferences.
  • Tests: test_item_text.py (2 tests), plug-in mark tests in test_seal.py (3 tests), and test_agent_start.py for Windows start words and npm shim resolution. Each fails on the previous code.
  • Windows agent start: when a .cmd or .bat still has to run through the command interpreter, any argument holding & | < > ^ ( ) ! % " or a control character is refused, quoted or not. The message points to standard input or a file for long text. npm shims keep starting as the node script or exe they wrap, with no command interpreter.
  • Tests cover both start paths through the argv builder with a fake environment, so they run on any OS.

Tests

  • Each fix has a test that fails on the previous code where practical.
  • The repo CI commands were run locally on macOS. Every failure seen locally also fails on main in the same environment (missing local tools or platform-specific tests); none is introduced here.
  • Please rely on this PR's CI run for Linux and Windows.

For the owner

  • A few related items need an owner decision; they are listed separately, not here.

How to ship

  • Independent of other repos; merge in any order. No version bump; release as usual.

parasHtml now accepts only the known alignments and list kinds and
whole-number levels and start numbers, so a text item's paragraph
settings can never add markup to the editor.
Text items stored in a PDF were returned as the file holds them, while
the paragraph and font cleaning ran only on writes. Reading items now
runs the same cleaning, so alignments, lists, levels, start numbers and
colours come back as known values. Adds a test.
Turning a plug-in on in the window now stores a mark made with the
keychain key that already seals agent access. A plug-in counts as on
only when its mark matches, so a consent written into settings.json by
hand leaves the plug-in off until the person turns it on in
Preferences. Without a usable keychain the stored consent stands, as
for the agent choice. Adds tests.
Paragraph cleaning now treats paragraphs or runs that are not lists as empty, so one odd text item no longer stops a whole page of items from being read. Adds a test.
parasHtml skips paragraphs and runs that are not objects and turns run text and colour into strings before escaping them.
Checks that a mark made for one plug-in does not turn on another, and that turning a plug-in on stores its mark.
On Windows an npm .cmd shim now runs as the node script it names, inside its own folder, so the words reach the program unchanged. Any other .cmd or .bat still goes through cmd.exe, which now refuses control characters, percent signs and double quotes, and its special characters in a word that is not quoted. A refused start reads as a program that does not start, and the dock answers 400. The shared finder becomes version 1.0.2 with its hash recorded. Adds tests.
When a .cmd or .bat still has to start through cmd.exe, any word holding & | < > ^ ( ) ! % " or a control character is now refused, quoted or not, since the interpreter and a batch file's %* read them as commands even inside quotes. The refusal tells the caller to pass long text through standard input or a file, or to point the setting at the program itself. npm shims keep running as the node script or exe they name, with no interpreter. The recorded hash for the shared finder 1.0.2 is updated. Adds tests for both paths.
@gbarnai
gbarnai requested a review from nodemode-ai as a code owner November 29, 2026 18:18
@nodemode-ai
nodemode-ai merged commit a73903f into main Nov 29, 2026
5 checks passed
@nodemode-ai
nodemode-ai deleted the fix/review-2026-11-28 branch November 29, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants