Replace project with current server release and Windows setup

Import the 2026-10-09 source release, Fastify/SQLite backend, restored source
assets, and analytics-enabled server build. Replace files from the previous
release while retaining the existing repository history.

Make builds portable across Windows and Linux, configure local startup,
normalize Windows static asset paths, and fix test fixture cleanup and file
URL handling. Exclude local environment settings, databases, dependencies,
validation output, and TypeScript build cache from version control.

Validation: npm ci, static and server builds, 106 arrival tests, and actual
local HTTP checks passed. The full suite passed 467 of 470 tests; three tests
still require QA fixtures omitted from the supplied release, documented in
README-서버실행.md.
This commit is contained in:
2026-10-09 16:43:35 +09:00
parent 71c8d3b7ff
commit e358e24436
642 changed files with 35202 additions and 17642 deletions
+46
View File
@@ -0,0 +1,46 @@
import assert from 'node:assert/strict';
import { readFile, access } from 'node:fs/promises';
import { test } from 'node:test';
import { loadTypescript } from './support/load-typescript.mjs';
const moduleURL = new URL('../src/state/PetName.ts', import.meta.url);
assert.equal(await access(moduleURL).then(() => true, () => false), true, 'application-wide pet name state must exist');
const { normalizePetName, petNameForms, createPetNameStore, PET_NAME_STORAGE_KEY } = await loadTypescript(moduleURL);
test('friendly Korean name forms avoid duplicated 이 and match natural particles', () => {
for (const [raw, display, object, subject] of [
['', '멍멍이', '멍멍이를', '멍멍이가'], ['호롱', '호롱이', '호롱이를', '호롱이가'],
['초코', '초코', '초코를', '초코가'], ['보리', '보리', '보리를', '보리가'],
['호롱이', '호롱이', '호롱이를', '호롱이가'],
]) assert.deepEqual(petNameForms(raw), { display, object, subject, possessive: `${display}의` });
});
test('name normalization trims, composes Korean, bounds Unicode safely, preserves literal text', () => {
assert.equal(normalizePetName(' 호롱 '), '호롱');
assert.equal(normalizePetName(' \n\t '), '');
assert.equal(normalizePetName('호롱'), '호롱');
assert.equal(normalizePetName('🐕'.repeat(25)), '🐕'.repeat(20));
assert.equal(normalizePetName('<img onerror=x>'), '<img onerror=x>');
});
test('one store publishes normalized state, persists reloads and unsubscribe stops updates', () => {
const values = new Map(), storage = { getItem: key => values.get(key) ?? null, setItem: (key, value) => values.set(key, value) };
const store = createPetNameStore(() => storage), updates = [], signal = new AbortController();
store.subscribe(() => updates.push(store.name), signal.signal);
store.setName(' 호롱 '); store.setName('호롱');
assert.deepEqual(updates, ['호롱']); assert.equal(values.get(PET_NAME_STORAGE_KEY), '호롱');
assert.equal(createPetNameStore(() => storage).name, '호롱');
store.setName(''); assert.equal(createPetNameStore(() => storage).name, '');
signal.abort(); store.setName('초코'); assert.deepEqual(updates, ['호롱', '']);
});
test('storage getter, read and write failures never prevent session edits', () => {
for (const getStorage of [() => undefined, () => { throw Error('blocked'); }, () => ({ getItem() { throw Error('blocked'); }, setItem() { throw Error('full'); } }), () => ({ getItem: () => '호롱', setItem() { throw Error('full'); } })]) {
const store = createPetNameStore(getStorage); store.setName('보리');
assert.equal(store.name, '보리'); assert.equal(store.storageUnavailable, true);
}
});
test('removed settings surfaces are outside settings and inert, landing sample/retry stay available', async () => {
const html = await readFile(new URL('../index.html', import.meta.url), 'utf8');
const settings = html.slice(html.indexOf('<dialog id="settings-dialog"'), html.indexOf('</dialog>', html.indexOf('<dialog id="settings-dialog"')));
for (const old of ['sample-browser', 'developer-tools', 'processing-card', 'local-note', 'id="ai-depth"', 'id="status"']) assert.equal(settings.includes(old), false, `${old} is no longer exposed in settings`);
assert.match(html, /id="internal-controls"[^>]*hidden[^>]*inert/);
for (const id of ['entry-samples', 'sample-dialog', 'flow-retry', 'flow-flat']) assert.match(html, new RegExp(`id="${id}"`));
for (const id of ['entry-pet-name', 'settings-pet-name']) assert.match(html, new RegExp(`id="${id}"[^>]*autocomplete="off"`));
});