fix(backend): use main's spotlighting helpers after rebase - drop duplicates

↗ view on GitHub · Amalanand Muthukumaran · 2026-08-03 · aa234ba9

WHY THIS MATTERS
This branch predates upstream's security-posture work, and both sides
independently added the same two prompt-injection helpers
(generateSpotlightNonce, spotlight) to contextBuilders.ts in DIFFERENT
regions of the file. Git therefore auto-merged the branches with no
textual conflict - but the merged module declared each function twice,
which is a parse error. That single file broke three CI checks at once:
11 backend test suites (vitest couldn't load the module), the Playwright
job (the API server couldn't boot, so the health-check wait timed out),
and its dependent CodeQL gate.

WHAT IS A SEMANTIC MERGE CONFLICT
Git resolves merges line-by-line, not meaning-by-meaning. Two additions
that don't touch the same lines merge "cleanly" even when they are
mutually incompatible - duplicate declarations, a renamed function still
called by new code, etc. Green CI on each branch alone proves nothing
about the MERGE of the two; that is why PR checks run against a merge
ref with the target branch.

HOW THE FIX WORKS
Keep upstream's versions (they are a superset of ours: identical fence
format and signature, plus neutralization of the <workflow-instructions>
fence family) and delete this branch's copies. The add-in-specific pieces
(parseOptionalDocumentContext, buildWordDocumentContextPrompt,
MAX_DOCUMENT_CONTEXT_CHARS) stay, now calling the shared helpers.
Verified on the rebased tree: tsc clean, 437 backend tests pass -
including upstream's spotlight suites and this branch's documentContext
suite exercising the same code path.
Repository open-legal-products/mike
Author Amalanand Muthukumaran <mamalanand3@gmail.com>
Authored
Committed
Parents 926af70c
Stats 1 file changed , +3 , -30
Part of Add a Word add-in for chat and tracked rewrites

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-aa234ba9.md from inside the repo you want the change in.

⬇ Download capture-commit-aa234ba9.md