Fifth revision: share-link AI safety, sturdier generation, cleaner UI
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 1m0s

- Malformed model JSON is sent back for repair, then retried; a failed job
  starts over once before it fails. Visitors can dismiss failed sets.
- Generated sets get a short distinct name and description; flashcards are
  atomic and have no hints; standard study shows known/learning counts.
- Share links: "In progress" list, finished sets join the normal lists with a
  "New" tag, plain progress steps, newest exam first.
- Share-link AI expires after a week, can be limited to the US or Arizona
  (DB-IP Lite or Cloudflare headers) and is locked by abuse protection
  (migration 8).
- The assistant never answers from general knowledge; MCP and web search
  tools load without a manual test.
- Plain-text copy, no question count in exam mode, filler text removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 09:17:50 -07:00
parent d8df5edf30
commit 85d5c9186d
46 changed files with 1242 additions and 283 deletions

View file

@ -110,7 +110,7 @@ describe('the assistant prompt', () => {
const mcp: LoadedMcp = { tools: [], unavailable: [], servers: [{ id: 'web-search', name: 'Web search', instructions: '', prefix: 'web_', builtin: 'web' }] };
const chat = mcpPromptNote(mcp, { askBeforeWeb: true });
expect(chat).toContain('Should I look it up on the web?');
expect(chat).toContain('do not answer from your own knowledge');
expect(chat).toContain('never answer from your own knowledge');
const elsewhere = mcpPromptNote(mcp);
expect(elsewhere).not.toContain('Should I look it up on the web?');
expect(elsewhere).toContain("anything the student's own material does not cover");
@ -229,7 +229,9 @@ describe('share-link visitors can generate', () => {
expect((await t.api('GET', '/api/drafts')).body.drafts.some((d: any) => d.id === set.id)).toBe(false);
const saved = (await t.api('GET', `/api/quizzes/${set.itemId}`)).body;
expect(saved.quiz.folderId).toBe(exam.id);
expect(saved.quiz.description).toBe('Made with AI on a share link.');
// Named and described by the model from what it covers.
expect(saved.quiz.title).toBe('Heart Failure and Pharmacology');
expect(saved.quiz.description).toBe('Covers heart failure care and the drugs used for it.');
const shown = (await t.api('GET', `/api/public/${token}`)).body.items.map((i: any) => i.id);
expect(shown).toContain(set.itemId);
const quiz = (await t.api('GET', `/api/public/${token}/items/quiz/${set.itemId}`)).body;