Verify V1 scheduling and static boundaries; record Terra workflow and visual QA
This commit is contained in:
parent
ffaa1f6afa
commit
4bf121728b
4 changed files with 36 additions and 13 deletions
21
PROGRESS.md
21
PROGRESS.md
|
|
@ -24,7 +24,7 @@ type-grouped materials, copyable import instructions and assistant library links
|
|||
- Added encryption-key corruption/missing-key refusal, static-path boundary validation,
|
||||
private embedded-media authorization and share-revocation checks.
|
||||
- Full backups include the generated encryption key and fail on unreadable files.
|
||||
- Added backup restore, media authorization, key durability, V1 import and failed-migration
|
||||
- Added backup restore, media authorization, key durability, static-path traversal, V1 import and failed-migration
|
||||
rollback tests. The new V1 test checks source bytes are unchanged and state is preserved.
|
||||
- Added Dockerfile, Compose, .dockerignore, README and deployment/migration/AI documentation.
|
||||
- Updated obsolete ChatGPT subscription wording after checking official documentation:
|
||||
|
|
@ -33,11 +33,12 @@ type-grouped materials, copyable import instructions and assistant library links
|
|||
- Terra completed isolated UI/workflow and visual QA; see results below.
|
||||
- Guarded quiz exit/submission when the latest save failed, and prevented repeated automatic
|
||||
timer submissions after a failed request.
|
||||
- Preserved the V1 card elapsed-days scheduling field during import.
|
||||
|
||||
## Verification status
|
||||
|
||||
Baseline: 162 tests passed, TypeScript passed and production web/server builds passed.
|
||||
Added five regression tests. Full `npm run check` passes: **167 tests**, TypeScript and both
|
||||
Added six regression tests. Full `npm run check` passes: **168 tests**, TypeScript and both
|
||||
production builds. Tests were run with loopback access for the mock provider.
|
||||
|
||||
The earlier agent manually exercised quiz completion/results, flashcards, streak effects,
|
||||
|
|
@ -51,12 +52,10 @@ full offline administrator study is not implemented.
|
|||
|
||||
## Remaining work
|
||||
|
||||
1. Finish the brief post-fix Terra contrast recheck and public visitor UI check.
|
||||
2. Record its results, review the diff and commit locally.
|
||||
3. On Unraid later: execute the deployment/restore checklist in docs/DEPLOYMENT.md.
|
||||
4. With owner-supplied provider connections: verify live discovery, streamed chat, generation,
|
||||
1. On Unraid later: execute the deployment/restore checklist in docs/DEPLOYMENT.md.
|
||||
2. With owner-supplied provider connections: verify live discovery, streamed chat, generation,
|
||||
OCR and task routing. No real-provider calls should be inferred from mock test results.
|
||||
5. Future optional work: approved ChatGPT account OAuth, more robust offline studying and
|
||||
3. Future optional work: approved ChatGPT account OAuth, more robust offline studying and
|
||||
semantic embeddings (current retrieval is lexical FTS5).
|
||||
|
||||
## Resume safely
|
||||
|
|
@ -87,4 +86,10 @@ light now **5.15 / 5.38 / 4.76** (previously 3.48 / 3.63 / 3.21); dark now
|
|||
|
||||
Screenshots remain ignored under `.test-data/ui-terra/`: desktop-dark-quiz.png,
|
||||
desktop-light-quiz.png, mobile-dark-quiz.png, mobile-light-quiz.png and mobile-light-session.png.
|
||||
Post-fix visual and anonymous-share recheck pending.
|
||||
Post-fix Terra recheck: desktop light/dark screenshots show improved secondary-text legibility
|
||||
(`postfix-dark-desktop.png`, `postfix-light-desktop.png`). An Edge InPrivate visitor opened
|
||||
the isolated shared quiz without login, completed practice, saw its rationale and reached
|
||||
100% results. Shared-deck UI, long-label layout stress tests and post-fix mobile contrast were
|
||||
not revisited in this follow-up. Public deck data isolation/revocation is covered by API tests.
|
||||
No known functional failures were found in the UI paths exercised. This is sampled QA, not
|
||||
an exhaustive audit of every layout and browser. Terra's isolated server is stopped.
|
||||
|
|
|
|||
|
|
@ -129,11 +129,12 @@ export function importV1(app: AppContext, file: string, opts: { dryRun?: boolean
|
|||
const target = created[i];
|
||||
if (!s || !target) return;
|
||||
db.run(
|
||||
`UPDATE cards SET state = ?, due = ?, stability = ?, difficulty = ?, scheduled_days = ?, learning_steps = ?, reps = ?, lapses = ?, last_review = ?, introduced_at = ? WHERE id = ?`,
|
||||
`UPDATE cards SET state = ?, due = ?, stability = ?, difficulty = ?, elapsed_days = ?, scheduled_days = ?, learning_steps = ?, reps = ?, lapses = ?, last_review = ?, introduced_at = ? WHERE id = ?`,
|
||||
Number(s.state) || 0,
|
||||
toMs(s.due),
|
||||
Number(s.stability) || 0,
|
||||
Number(s.difficulty) || 0,
|
||||
Number(s.elapsedDays) || 0,
|
||||
Number(s.scheduledDays) || 0,
|
||||
Number(s.learningSteps) || 0,
|
||||
Number(s.reps) || 0,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import path from 'node:path';
|
|||
import { unzipSync } from 'fflate';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { loadConfig } from '../server/config.ts';
|
||||
import { createApp } from '../server/app.ts';
|
||||
import { encryptSecret, decryptSecret } from '../server/crypto.ts';
|
||||
import { openDatabase } from '../server/db.ts';
|
||||
import { TINY_PNG } from '../server/documents/testFixtures.ts';
|
||||
|
|
@ -48,6 +49,22 @@ describe('private image authorization', () => {
|
|||
});
|
||||
|
||||
describe('key durability and restore', () => {
|
||||
it('does not serve a sibling directory through an encoded static path', async () => {
|
||||
app = await createTestApp();
|
||||
const dir = temporary();
|
||||
const web = path.join(dir, 'web');
|
||||
fs.mkdirSync(web);
|
||||
fs.mkdirSync(path.join(dir, 'web-private'));
|
||||
fs.writeFileSync(path.join(web, 'index.html'), '<html>Study Desk</html>');
|
||||
fs.writeFileSync(path.join(dir, 'web-private', 'secret.txt'), 'private fixture');
|
||||
const hono = createApp({ ...app.ctx, config: { ...app.ctx.config, webDir: web } });
|
||||
const result = await hono.request('/..%2fweb-private%2fsecret.txt');
|
||||
expect(result.status).toBe(404);
|
||||
expect(await result.text()).not.toContain('private fixture');
|
||||
expect((await hono.request('/%ZZ')).status).toBe(400);
|
||||
expect((await hono.request('/classes/example')).status).toBe(200);
|
||||
});
|
||||
|
||||
it('refuses a damaged encryption key without replacing it', () => {
|
||||
const dir = temporary();
|
||||
const config = loadConfig({ dataDir: dir }, {});
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ describe('safe migration paths', () => {
|
|||
CREATE TABLE Question (id TEXT, quizSetId TEXT, type TEXT, prompt TEXT, rationale TEXT, category TEXT, sortOrder INTEGER);
|
||||
CREATE TABLE AnswerOption (id TEXT, questionId TEXT, text TEXT, isCorrect INTEGER, sortOrder INTEGER);
|
||||
CREATE TABLE QuizAttempt (id TEXT, quizSetId TEXT, score REAL, maxScore INTEGER, answersJson TEXT, isPartialRetake INTEGER, completedAt INTEGER);
|
||||
CREATE TABLE SpacedRepetitionCardState (flashcardId TEXT, state INTEGER, reps INTEGER, due INTEGER, stability REAL, difficulty REAL, scheduledDays INTEGER, learningSteps INTEGER, lapses INTEGER, lastReview INTEGER, firstReviewedAt INTEGER);
|
||||
CREATE TABLE SpacedRepetitionCardState (flashcardId TEXT, state INTEGER, reps INTEGER, due INTEGER, stability REAL, difficulty REAL, scheduledDays INTEGER, learningSteps INTEGER, lapses INTEGER, lastReview INTEGER, firstReviewedAt INTEGER, elapsedDays INTEGER);
|
||||
INSERT INTO Class VALUES ('c','Legacy class',0,1700000000000);
|
||||
INSERT INTO MaterialGroup VALUES ('g','c','Legacy group',0,1700000000000);
|
||||
INSERT INTO Deck VALUES ('d','c','g','Legacy deck','',0,1700000000000);
|
||||
|
|
@ -32,7 +32,7 @@ describe('safe migration paths', () => {
|
|||
INSERT INTO Question VALUES ('q','z','MULTIPLE_CHOICE','Pick A','Reason','Topic',0);
|
||||
INSERT INTO AnswerOption VALUES ('a','q','A',1,0),('b','q','B',0,1);
|
||||
INSERT INTO QuizAttempt VALUES ('attempt','z',1,1,'{"q":["a"]}',0,1700000000000);
|
||||
INSERT INTO SpacedRepetitionCardState VALUES ('f',2,7,1800000000000,15,5,14,0,1,1700000000000,1600000000000);
|
||||
INSERT INTO SpacedRepetitionCardState VALUES ('f',2,7,1800000000000,15,5,14,0,1,1700000000000,1600000000000,12);
|
||||
`);
|
||||
old.close();
|
||||
const digest = () => crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex');
|
||||
|
|
@ -44,8 +44,8 @@ describe('safe migration paths', () => {
|
|||
expect(digest()).toBe(before);
|
||||
const classes = (await app.api('GET', '/api/classes')).body.classes;
|
||||
expect(classes[0].name).toBe('Legacy class');
|
||||
const card = app.ctx.db.get<{ reps: number; due: number }>('SELECT reps, due FROM cards');
|
||||
expect(card).toMatchObject({ reps: 7, due: 1800000000000 });
|
||||
const card = app.ctx.db.get<{ reps: number; due: number; elapsed_days: number }>('SELECT reps, due, elapsed_days FROM cards');
|
||||
expect(card).toMatchObject({ reps: 7, due: 1800000000000, elapsed_days: 12 });
|
||||
const attempt = app.ctx.db.get<{ id: string }>('SELECT id FROM attempts')!;
|
||||
const result = (await app.api('GET', `/api/attempts/${attempt.id}`)).body;
|
||||
expect(JSON.stringify(result)).toContain('Pick A');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue