Repository navigation
fix(ingest): drop machine-identifier entity names and wire the guard - #894
Conversation
…git message IDs Split out of #755, which bundled this guard with the extraction-focus settings. The code is @weqoocu's; the split is mine. When the ingested note's own filename is a machine identifier — a dinox UUID, an ob timestamp, an IM message id — the model sometimes extracts the source DOCUMENT itself as an entity and lifts the filename as its name. The result is `entities/<uuid>.md`: a page whose body re-narrates the summary it came from. `isSourceSelfReference` rejects those names at normalization time, before a page exists. Machine shapes are rejected regardless of the source filename; a verbatim copy of the basename is rejected only when it carries a plugin-style `_` + hex hash tail, so `TNF-α` from `TNF-α.md` survives. The wiring is part of this commit, not of the PR this was split from. That is worth stating because the original commit added the function and left the two `.filter(...)` calls to its successor: cherry-picking it alone would have produced an exported predicate that nothing calls, with tests that pass against the function directly. A guard that is not on the path is not a guard. The prompt-level layer ("do not extract the source document") stays in the split sibling, because it is a prompt change and this is a structural filter. Gate 1: lint 0, tsc 0, build clean, tests pass, css-lint 0.
green-dalii
left a comment
There was a problem hiding this comment.
Merge audit, recorded before the squash. Administrative bypass on explicit instruction; ruleset added, used, restored, re-read field by field.
Why bypass. Own PR, no approval possible on own PRs, ruleset requires a review.
Pre-merge scans. No closing keyword. No trailer. Two commits, both authored weqoocu <musicleaf@qq.com> — the contributor's identity, kept as the author of the work.
Credit. The commit author is the contributor's. A squash merge would make the merge commit's author the PR author — me — and the contribution would read as mine. The merge message below names the contributor instead.
What was verified beyond Gate 1. The guard is on the path, not beside it: the two .filter(...) calls that use isSourceSelfReference are in this PR, because the original commit added the function and left the wiring to its successor. Cherry-picking that commit alone would have shipped an exported predicate nothing calls, with tests that pass by calling the function directly. grep confirms two call sites in normalizeBatchResponse, and the semantic names survive: TNF-α from TNF-α.md passes.
Sequencing. #895 and this PR both touch src/wiki/source-analyzer.ts. They were merged together in a test branch before either was merged here — 369 files and 5,053 tests, both guards present — so the pair is known to compose.
Split out of #755, which bundled this production fix with the extraction-focus settings. The code is @weqoocu's; the split is mine, and the commit carries their author line.
When the ingested note's own filename is a machine identifier — a dinox UUID (
01988c6e_86e9_7b79_83b5_c8c4b354fdc9.md), an ob timestamp (202511042307.md), an IM message id (1921147873752416344) — the model sometimes extracts the source DOCUMENT itself as an entity and lifts the filename as its name. The result isentities/<uuid>.md: a page whose body merely re-narrates the summary it came from.isSourceSelfReferencerejects those names at normalization time, before a page exists:_+ hex hash tail, soTNF-αextracted fromTNF-α.mdsurvives, and a drama name from庆余年_8a53fa.mdsurvives.Why the split needed a construct, not a cherry-pick
The original commit added the function and left the two
.filter(...)calls to its successor. Cherry-picked alone it would have shipped an exported predicate that nothing calls, with tests that pass by calling the function directly — a guard that is not on the path. The wiring is in this PR, and the diff shows it:Same for the tests: they arrived without the
mentions_in_sourcefixture field their types require, which the successor commit had added. Both came across with the guard.What is not in this PR
The prompt-level layer — "do not extract the source document, do not use the source filename as a name" — stays in the sibling PR with the settings it belongs to. This PR is the structural filter only, so it can be reviewed and reverted on its own.
Gate 4: Performance
^-anchored so they fail fastCredit, stated rather than assumed
If this merges by squash, the commit author becomes the PR author — me — and @weqoocu's contribution would read as mine. The options are a rebase merge (keeps their commit author), or a squash whose message names them. I am not deciding that here; it needs the maintainer's call at merge time.
Gate 1: lint 0, tsc 0, build clean, 367 test files / 5,038 tests, css-lint 0.