Render the my-decisions overview on the signed-in home page (INFD-WP-0003 T03)

Groups the reviewer's memos (needs attention, open, accepted, declined,
returned, closed, not available) above the manual memo-id form. Server
rendered and escaped; refused rows show only the memo id. The Chromium
harness gains a home-overview check (13 checks pass).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 359683@bnt-lap001
Assistant-Session: eebdc939-7a9b-4e50-9d39-c8437e8a14ec
This commit is contained in:
tegwick 2026-09-21 22:07:08 +02:00
parent 39e5366abc
commit bd6c004f1a
5 changed files with 100 additions and 3 deletions

View file

@ -34,6 +34,10 @@ try {
const session=cookies.find(c=>c.name==='__Host-infd-session');
assert(session?.secure && session?.httpOnly && session?.sameSite==='Lax');
checks.push('PKCE callback and secure browser session');
await page.getByRole('heading',{name:/^Open for you \(1\)$/}).waitFor();
assert.equal(await page.locator('a[href="/review?memo_id='+encodeURIComponent(fixture.memo_id)+'"]').count(),1);
assert.equal(await page.locator('img,script').count(),0);
checks.push('Home overview lists the open memo addressed to the reviewer');
await page.getByLabel('Memo identifier').fill(fixture.memo_id);
await page.getByRole('button',{name:'Open review',exact:true}).click();
await page.getByRole('heading',{name:'The request',exact:true}).waitFor();

View file

@ -367,3 +367,43 @@ def test_overview_requires_a_live_human_session(review):
with pytest.raises(ReviewError) as error:
controller.overview(replace(session,expires_at=0))
assert error.value.code=='session_expired'
def home(review):
return call(review[2],'/',cookie=SESSION_COOKIE+'=fixture-session')
def test_home_lists_open_then_accepted_memos_and_keeps_the_manual_form(review):
controller,session,app,memo,engine,transport=review
r=home(review)
assert r['status']==200 and 'Open for you (1)' in r['body'] and 'Accepted (' not in r['body']
assert '<a href="/review?memo_id=memo-1"><strong>Approve the synthetic factory delivery?</strong></a>' in r['body']
assert 'Approval status: requested' in r['body'] and 'Open a decision review' in r['body']
assert 'private-brief-sentinel' not in r['body'] and 'private-packet-sentinel' not in r['body']
assert len(controller.store.evidence())==0
p=opened(review).presentation;controller.acknowledge(session,p.id,['h-1'])
controller.act(session,p.id,Verb.ACCEPT,operation_id=str(uuid.uuid4()))
r=home(review)
assert 'Accepted (1)' in r['body'] and 'Open for you' not in r['body']
assert 'Approval status: approved' in r['body'] and 'Entry recorded ' in r['body']
assert '<li>Accept · version 1 · ' in r['body'] and 'confirmed' in r['body']
def test_home_escapes_memo_text_and_redacts_refused_rows(review):
controller,session,app,memo,engine,transport=review
hostile=add_memo(review,'hostile')
controller.store.save_memo(replace(hostile,version=2,question='<img src=x onerror=alert(1)>'))
r=home(review)
assert '<img src=x' not in r['body'] and '&lt;img src=x onerror=alert(1)&gt;' in r['body']
controller.policy.transport.change=lambda d:d.update(effect='deny')
r=home(review)
assert r['status']==200 and 'Not available (2)' in r['body']
assert 'The permission service refused access to this memo.' in r['body']
assert 'Approve the synthetic factory delivery?' not in r['body'] and 'onerror' not in r['body']
def test_home_without_session_shows_sign_in_only(review):
controller,session,app,*_=review
r=call(app,'/')
assert 'Sign in with KeyCape' in r['body'] and 'Your decisions' not in r['body']
assert controller.store.policy_observations()==[]