Refactor architecture into eight components and consolidate reliability work
Build and publish container images / images (push) Successful in 9m34s
Release container images / release (push) Successful in 36s

Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts.

Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation.

Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
This commit is contained in:
Anya Tokugawa committed 2026-11-01 15:23:31 +09:00
1 parent 9dd425f765
commit d5d21b7841
302 files changed
+20037 -3492

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
(async () => {
const assert=(ok,message)=>{if(!ok)throw Error(message)};
const wait=async test=>{for(let n=0;n<160;n++){if(test())return;await new Promise(r=>setTimeout(r,25))}throw Error('Timed out: '+test)};
const frame=document.createElement('iframe');frame.style='width:100%;height:930px;border:0';document.body.append(frame);
const load=path=>new Promise(resolve=>{frame.onload=resolve;frame.src=path});
const key=(d,target,key,extras={})=>target.dispatchEvent(new frame.contentWindow.KeyboardEvent('keydown',{key,bubbles:true,cancelable:true,...extras}));
try {
await load('/');let d=frame.contentDocument;
assert(!d.querySelector('[data-command-bar]'),'Home has command interception');
await load('/v/browser/notes');d=frame.contentDocument;
let bar=d.querySelector('[data-command-bar]'),input=bar.querySelector('input');
assert(!bar.hidden && bar.parentElement===d.body,'Command bar not at body level');
assert(d.querySelector('.topbar [data-browser-address]'),'Address not integrated with topbar');
assert(!!d.querySelector('[data-browser-address]').getClientRects().length === (innerWidth>1100),'Responsive address visibility');
key(d,d.body,'c');assert(input===d.activeElement&&input.value==='c','Type-to-command lost first character');
input.value='cd al';input.dispatchEvent(new Event('input',{bubbles:true}));key(d,input,'Tab');
await wait(()=>input.value==='cd alpha');key(d,input,'Tab');assert(input.value==='cd alpine','Tab did not cycle');
key(d,input,'Tab',{shiftKey:true});assert(input.value==='cd alpha','Shift Tab did not cycle back');
key(d,input,'Escape');assert(!bar.hidden&&input.value==='','Browser Escape must clear, not remove bar');
input.focus();input.value='cd /not-committed';input.dispatchEvent(new frame.contentWindow.CompositionEvent('compositionstart',{bubbles:true}));bar.requestSubmit();assert(frame.contentWindow.location.pathname==='/v/browser/notes','IME confirmation navigated');input.dispatchEvent(new frame.contentWindow.CompositionEvent('compositionend',{bubbles:true}));input.value='';
const other=d.createElement('input');d.body.append(other);other.focus();key(d,other,'x');assert(input.value===''&&d.activeElement===other,'Other input intercepted');other.remove();
const modal=d.createElement('dialog');d.body.append(modal);modal.showModal();key(d,d.body,'x');assert(input.value==='','Modal intercepted');modal.close();modal.remove();
const fetchBefore=frame.contentWindow.fetch;
let release;
frame.contentWindow.fetch=()=>new Promise(resolve=>{release=resolve});
input.focus();input.value='vi stale';input.dispatchEvent(new Event('input',{bubbles:true}));key(d,input,'Tab');
key(d,input,'Escape');release(new Response(JSON.stringify({entries:[{name:'stale',kind:'file'}]}),{headers:{'Content-Type':'application/json'}}));
await new Promise(r=>setTimeout(r,30));assert(input.value===''&&bar.querySelector('[role=listbox]').hidden,'Stale completion reopened list');frame.contentWindow.fetch=fetchBefore;
input.focus();input.value='cd /日本';input.dispatchEvent(new Event('input',{bubbles:true}));key(d,input,'Tab');await wait(()=>input.value==='cd /日本語 #?/');
key(d,input,'Tab');await wait(()=>input.value==='cd /日本語 #?/child');
input.value='cd /notes';input.dispatchEvent(new Event('input',{bubbles:true}));
await new Promise(resolve=>{frame.onload=resolve;bar.requestSubmit()});assert(frame.contentWindow.location.pathname==='/v/browser/notes','Command navigation failed');
await load('/notes');d=frame.contentDocument;bar=d.querySelector('[data-command-bar]');input=bar.querySelector('input');
assert(bar.hidden,'Viewer command bar initially open');key(d,d.body,'g');assert(!bar.hidden&&d.activeElement===input&&input.value==='','g activation failed');
key(d,input,'Escape');assert(bar.hidden,'Viewer Escape failed');
const code=d.querySelector('.page-html pre code');
await wait(()=>code?.querySelector('.pw-syntax-keyword'));
assert(!code.querySelector('script')&&code.textContent.includes('<script>literal<'+'/script>'),'Highlight interpreted HTML');
const original=code.textContent,keyword=code.querySelector('.pw-syntax-keyword');
const theme=d.querySelector('[data-theme-select]');
const change=async value=>{theme.value=value;theme.dispatchEvent(new frame.contentWindow.Event('change',{bubbles:true}));await wait(()=>!theme.disabled);await new Promise(r=>setTimeout(r,60))};
await change('index-white');const light=frame.contentWindow.getComputedStyle(keyword).color;
await change('nanoha-dark');assert(light!==frame.contentWindow.getComputedStyle(keyword).color,'Viewer syntax did not follow theme');
assert(code.textContent===original,'Theme changed code text');
const viewerTarget=d.createElement('div');d.body.append(viewerTarget);
const viewer=frame.contentWindow.PagesWikiEditor.createViewer(viewerTarget,'def sample():\n return "value"','python');
await wait(()=>viewerTarget.querySelector('.pw-syntax-keyword'));
assert(frame.contentWindow.getComputedStyle(viewerTarget.querySelector('.pw-syntax-keyword')).color===frame.contentWindow.getComputedStyle(keyword).color,'File viewer and code block palettes differ');viewer.destroy();viewerTarget.remove();
for(const option of theme.options){if(!option.value)continue;await change(option.value);assert(frame.contentWindow.getComputedStyle(keyword).color!=='rgba(0, 0, 0, 0)','Invisible theme token');assert(code.textContent===original,'Theme altered code');}
const late=d.createElement('pre'), lateCode=d.createElement('code');lateCode.className='language-js';lateCode.textContent='const number = 42;';late.append(lateCode);code.closest('.page-html').append(late);late.scrollIntoView();await wait(()=>lateCode.querySelector('.pw-syntax-keyword'));
const large=d.createElement('code');large.className='language-python';large.textContent='return 1;'.repeat(5000);const largePre=d.createElement('pre');largePre.append(large);code.closest('.page-html').append(largePre);largePre.scrollIntoView();await new Promise(r=>setTimeout(r,80));assert(!large.querySelector('span'),'Unbounded large block parsed');largePre.remove();late.remove();
await load('/e/-/editor-fixture?edittype=markdown');d=frame.contentDocument;
await wait(()=>frame.contentWindow.PagesWikiCodeMirror);
const editor=frame.contentWindow.PagesWikiCodeMirror;editor.focus();key(d,editor.contentDOM,'g');assert(d.querySelector('[data-command-bar]').hidden,'Vim g intercepted');
editor.dispatch({changes:{from:0,to:editor.state.doc.length,insert:'```python\ndef sample():\n return "value"\n```'}});
await wait(()=>d.querySelector('.cm-content .pw-syntax-keyword'));
// End on the browser UI for visual review.
await load('/v/browser/notes');d=frame.contentDocument;bar=d.querySelector('[data-command-bar]');input=bar.querySelector('input');
if(innerWidth<800){assert(d.documentElement.scrollWidth<=frame.clientWidth+1,'Browser overflows mobile');frame.contentWindow.toggleSidebar();assert(d.querySelector('.browser-sidebar').getClientRects().length,'Mobile sidebar cannot open');frame.contentWindow.toggleSidebar();}
input.focus();input.value='view al';input.dispatchEvent(new Event('input',{bubbles:true}));key(d,input,'Tab');await wait(()=>input.value==='view alpha');
document.body.dataset.vimReady='1';
} catch(error){const out=document.createElement('pre');out.id='error';out.textContent=error.stack;document.body.append(out)}
})();