Skip to content

TEST-01: test the real illustration-marker insertion, not a copy - #190

Merged
anantham merged 1 commit into
mainfrom
claude/test01-illustration-markers
Sep 25, 2026
Merged

anantham merged 1 commit into
mainfrom
claude/test01-illustration-markers

Conversation

@anantham

Copy link
Copy Markdown
Owner

Resolves TEST-01 in Issues.md. tests/store/slices/illustration-marker-insertion.test.ts re-implemented the marker-insertion algorithm and tested that copy, so it couldn't detect changes to the store action it claimed to cover.

Changes

  • Shared function: the HTML-aware insertion logic moves out of generateIllustrationForSelection (store/slices/translationsSlice.ts) into insertMarkerAfterSelection in services/ai/illustrationMarkers.ts, which already owns the marker pattern. The action calls it.
    • Behavior is identical: an HTML-tolerant regex match, then an exact-replace fallback, with the input returned unchanged when the selection isn't found. The three-branch fallback collapses because replace already returns the input when nothing matches.
    • The slice loses about 40 lines.
  • Existing cases: the 21 cases now import the production function (moved to tests/services/ai/insertMarkerAfterSelection.test.ts) and pass unchanged.
  • New action test: tests/store/slices/generateIllustrationForSelection.test.ts runs the real action. It covers the two outcomes the issue asks for:
    • On success, the selection gets the next marker ([ILLUSTRATION-2]), the matching illustration entry is appended, and the updated translation is persisted.
    • When planning is rejected, the chapter object is unchanged, nothing is persisted and the error notice is shown.
    • Mutation check: making the action skip insertion fails the success test.
  • docs/infrastructure/TEST_MANIFEST.md and Issues.md are updated.

Verification (Node 22 container)

  • tsc: 0 errors
  • eslint on changed files: 0 errors
  • vitest run: 9,599 passed, 1 failed. The failure is the known Node-22-only indrasNetImageProvider.test.ts case.

🤖 Generated with Claude Code

https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W


Generated by Claude Code

TEST-01. illustration-marker-insertion.test.ts exercised its own copy of the
algorithm, so it could not catch changes to the store action. The logic now
lives once, as insertMarkerAfterSelection in services/ai/illustrationMarkers.ts
(next to the marker pattern), and generateIllustrationForSelection calls it.
The 21 existing cases import it and pass unchanged.

generateIllustrationForSelection.test.ts runs the real action: the selection
gets the next marker and illustration entry, and a rejected planning call
leaves the chapter and persistence untouched. Mutation-checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexicon-forge Ready Ready Preview Sep 25, 2026 6:43am UTC

@anantham
anantham merged commit 85096d4 into main Sep 25, 2026
7 checks passed

This branch was successfully deployed

1 active deployment
Preview — 1dd193eb Deployed Sep 25, 2026 by vercel[bot]
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