Repository navigation
feat(factscribe): re-vendored package, CRLF draft fix, and Python probe fix - #174
Conversation
…be fix Re-vendor plugins/unclemoc/factscribe/ from the FactScribe repository, so the published package carries the engine and the front end that the repository actually ships today. - miniapp/node/engine/factscribe/** is a byte-for-byte copy of the repository's factscribe/ directory. It is generated: please do not hand-edit it in review comments, tell us what to change in the repository source and we re-vendor. - miniapp/client/** is a copy of factscribe/workbench/static/, so the two front ends cannot drift apart any more. Because the engine moved on, this PR also carries a few user-visible fixes: - The Python probe now judges usability on the child's "close" event (the process exited and stdout/stderr are drained) instead of "exit", so a busy machine no longer reports a perfectly good interpreter as broken. - The paragraph-level front end gains citation add/remove, image preview and the sample-paper install, formerly living in the retired section-level front end. - Saving preserves the manuscript's original line endings end to end, and the AI draft block is written with the dominant line ending of the file it goes into instead of a hardcoded "\n" (this partly reverts MiniMax-AI#160; the behaviour is locked by a regression test that fails against MiniMax-AI#160's engine and passes here). - The bundled Python 3.10 TOML fallback parser follows the standard library's rules, so the audit verdict no longer depends on the interpreter version. - Symlinked fact ledgers that point outside the project are reported instead of being read silently, and writes that would land outside the project root are refused. 47 files changed, +5853 / -560. Verified locally against this exact content: node scripts/validate.mjs reports plugins/unclemoc/factscribe: OK with no errors and no warnings, and node --test "test/**/*.test.mjs" passes 96/96.
|
Thanks for the re-vendored FactScribe update. We re-checked on The manifest is still 1.2.0, but the contents are no longer the tree that landed in #160. Please bump this to 1.2.1, or the next patch version, before it is merged, so it doesn't share a release identity with that 1.2.0. We also noted that the legal pages are not reachable on the Mini App paths. That isn't something we're asking you to change. Package tests were 32/32 on this head. We have not run this on Host or Electron. |
…ed engine The package ships the 1.3.0 engine (factscribe/constants.py → VERSION = "1.3.0"), but the manifest was left at 1.2.0 when the tree was re-vendored — so the package advertised 1.2.0 while running a 1.3.0 engine. Bump the manifest to 1.3.0 so the published version matches what the package actually contains. This also keeps the package off MiniMax-AI#160's release identity: that 1.2.0 shipped an older engine tree, and the re-vendor replaced both the engine tree and the front-end tree — a structural change, not a patch on top of 1.2.0.
|
Thanks for the review — bumped to 1.3.0, and here is the reasoning behind the number. Why 1.3.0. The manifest version is meant to match the engine the package actually ships. This package contains the 1.3.0 engine — That also answers your point about not sharing a release identity with #160: the 1.2.0 in #160 shipped an older engine tree, so 1.3.0 is genuinely different release content — not the same release under a second name. The plugin ID is unchanged and only Version sequence. This package is the paper-side workbench. The legal-side workbench is planned to join the Mini App in a later version, so keeping this one at 1.3.0 leaves the package version sequence continuous for that release. On the legal pages. Noted — and to be clear about the direction: the legal workbench is planned to join the Mini App paths in a later version. The read-side interfaces and the sample pages are already merged in our own repository's Package tests. Re-ran the package test suite on this head after the version bump: 32/32 pass, 0 fail, 0 skipped — unchanged from the run you did. The upstream The version change is one line in |
FactScribe — re-vendored package, CRLF draft fix, and probe fix
What this package is
A local paper workbench. The Mini App opens the manuscript projects on your machine, shows the
check report, the fact ledger and the knowledge base, and lets the assistant propose edits that
you approve before anything reaches the file. Numbers and citations stay pinned to the ledger —
the AI proposes, you decide.
What this PR does
It re-vendors the package from the FactScribe repository, so the published package contains the
engine and the front end that the repository actually ships today.
Concretely:
miniapp/node/engine/factscribe/**is a byte-for-byte copy of the repository'sfactscribe/directory. It is generated — please do not hand-edit it in review comments; tell us what to
change in the repository source and we re-vendor.
miniapp/client/**is a copy offactscribe/workbench/static/, so the two front ends cannotdrift apart any more.
Because the engine moved on, this PR also carries a few user-visible fixes:
1. The Python probe waits for the pipe to close
The version probe decided "this is not a usable Python" in the child's
exitevent. Node'sexitonly means "the process exited" — it does not guarantee that the bytes in the pipe have reached
the parent. On a busy machine (a CI runner with five matrices in parallel, for example)
exitarrives before the
dataevent, the captured output is still empty, and a perfectly goodinterpreter is reported as
broken.The decision now happens in the
closeevent ("process exited and stdout/stderr drained").The four possible states (ready / old / missing / broken) and all wording are unchanged — only the
moment of the judgement moved.
2. The front end moves to the paragraph level
Three capabilities that used to live in the retired section-level web front end now live in the
paragraph-level front end this package ships:
3. Line endings survive a save — and #160's draft regression is undone
This one deserves a note, because it partly reverts part of #160.
The engine reads sections with Python's universal-newline mode (CRLF becomes LF before the text
ever reaches the page) and writes the file back byte for byte, so without a second step every save
rewrites the whole file with LF endings — a CRLF manuscript loses all its CR bytes on the first
edit. The Node shell added in #160 handles this from the outside: it reads the real endings from
the file on disk before the save, hands the engine an LF-only body, and puts the original endings
back afterwards.
#160 also changed the AI draft block insertion back to a hardcoded
"\n"— the engine's ownline-ending handling was dropped for that path. In
workbench/write.py, #160's_draft_insertionbuilds the block with"\n".join(lines)and wraps it in"\n" + region + "\n".As a result, inserting an AI draft into a CRLF manuscript left a run of LF lines inside a CRLF file.
This PR restores the behaviour that was there before: the draft block is written with the
dominant line ending of the file it goes into —
eol = dominant_newline(source), and theblock itself goes through the same
restore_newlinescall that every other write path in thatfile already used.
Both layers are kept, and they were measured against each other rather than assumed to agree:
the same nine scenarios (CRLF / LF / mixed-ending manuscripts, each saved with and without a
content change, plus an AI draft insertion) were run with the shell pass enabled and disabled, and
the resulting bytes compared. In eight of the nine the two are byte-identical; in the ninth the
shell pass is the one that keeps the untouched line's original ending. No case produces a doubled
\r\r\n, and no LF manuscript is turned into CRLF.Measured on the vendored sample paper, inserting an AI draft into a CRLF manuscript:
(The byte totals include the inserted draft text; the CRLF / lone-LF counts are the part that does
not move with the wording of the draft. The draft block itself is 5 CRLF lines here and 5 lone LF
lines in #160, and outside the inserted block the file is byte-for-byte what it was.)
This is not a claim about a reading — it is locked by a regression test. The same test file
(
tests/save-draft-eol.test.mjs, added by this PR) fails against #160's engine and passesagainst this one:
4. Python 3.10 reads TOML with the same verdict as 3.11+
The bundled fallback parser for 3.10 was lenient: it accepted some malformed TOML that
tomllibrejects. The same broken file could then be "readable" on 3.10 and an error on 3.11+, which means
the audit verdict depended on the interpreter. The fallback now follows the standard library's
rules: the same input is accepted or rejected, and the values read are identical.
5. Smaller fixes carried along
silently; writes that would land outside the project root are refused; a symlink loop or a
broken link is named explicitly;
ASSET_NOT_FOUNDis registered);serve --uientry point returns a plain 404 with one honest sentence instead of a500.
How this was verified
node --test tests/*.test.mjs— 32 cases, all green, none skipped,on Node 20.20.2, 22.23.5 and 26.7.0. They are the line-ending unit tests, the end-to-end save
tests (they start the vendored Python engine and save into a copy of the sample paper), the AI
draft line-ending tests and the status-code passthrough tests.
/api/*route is a byte-levelreverse proxy (
response.writeHead(res.statusCode)plusres.pipe(response)), so the engine'sdecision codes and error bodies reach the page unchanged. The tests pin that, including that a
409
BLOCK_STALEstays a 409 and is not flattened into a 502.integration tests).
audit_findings_baseline.jsonisbyte-for-byte identical to the one on
main, andaudit --jsonover all 27 sample projects(26 locked plus
fixtures/legal-demo) is byte-for-byte identical tomain, 27 out of 27.vendored engine imports cleanly.
node scripts/validate.mjsreportsplugins/unclemoc/factscribe: OKwith no errors and nowarnings, and
node --test "test/**/*.test.mjs"passes 96 / 96.Not verified
covered by unit tests, but the Windows candidate list is generated from the platform string
(31 to 37 entries, depending on which environment variables are set), not measured on Windows.
locally against the same package content.
Files
miniapp/node/engine/factscribe/**— re-vendored engine (generated from the repository sources;the directory is a copy, not hand-edited code).
miniapp/client/**— front end (copy of the repository sources).miniapp/node/python_discovery.mjs— the probe timing fix.miniapp/tests/**— the package's own tests.README.md,README.zh-CN.md— documentation.47 files changed, +5853 / −560.
Note on the vendored directory
miniapp/node/engine/factscribe/is a generated copy of the repository'sfactscribe/directory. Please do not hand-edit it in review comments — tell us what to change in the repository
source and we re-vendor.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.