Qualify Character Type interactions and seed isolated Development AI policy defaults

This commit is contained in:
Nick Beckley 2026-11-26 16:16:26 +00:00
parent 7ddfe907b0
commit 096b2c78a5
3 changed files with 35 additions and 2 deletions

View File

@ -60,3 +60,7 @@ The normal build and executable full regression harness passed. Focused tests ex
`--discretionary-ai-database` runs only against a database whose name starts `PlotDirector_Qualification_` and checks the connected database before writing. Disposable fixture checks passed for 20 concurrent requests against five credits, 10 simultaneous duplicate deliveries, execution claim exclusion, retry limits, settlement idempotence, failed-result refunds, abandoned reservations, expired manual-job recovery/progress events, stale cost/scope/unknown-operation rejection, Draft Desk denial despite misconfiguration, policy changes, expiring overrides, monthly renewal and administration auditing. Synthetic rows are removed and policy values restored.
Compiled Razor/browser fixture checks passed in normal Chromium and actual installed Chromium PWA mode. They cover locked feature discovery and subscription link, cost confirmation, cancellation without submission, one explicit confirmed request, account allowance presentation and all seven administration themes. Screenshots are in `/tmp/pd-ai-allowances`. These checks do not substitute for final authenticated Development smoke checks. No live migrations or deployment have occurred at this phase gate.
## Development integration defaults
Migration 332 enables the three defined operations and gives Writing Room, Story Forge and Author Studio 100 monthly credits **only** on `PlotDirector_Development` or an isolated `PlotDirector_Qualification_…` database. Draft Desk and unknown tiers remain denied. Costs and execution limits remain the provisional values above (biography 10 credits; name verification and intent assessment 1 each). These are Development test settings, not commercial commitments. It updates only the new AI policy tables, and skips an installation with usage or configured/admin-modified policies. Existing subscriptions, prices and import entitlements are untouched. All settings remain editable under Admin → AI; an account override changes credit quantity without granting an otherwise denied entitlement.

View File

@ -34,10 +34,21 @@ const {chromium}=require('playwright');const os=require('node:os'),path=require(
assert.deepEqual(errors,[]);fs.writeFileSync(`${directory}/${before?'before':'after'}-${installed?'pwa':'browser'}.json`,JSON.stringify(measurements,null,2));console.log('PASS workspace widths',measurements);await page.close();continue;
}
if(groups.some(g=>g.id==='type')){
await value('type','person').locator('button').first().dragTo(card(1));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [title="Character Type: Person"]'));
await card(2).locator('[data-character-drag]').dragTo(value('type','artificial'));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Artificial being"]'));
await card(1).locator('[data-character-select]').check();await card(2).locator('[data-character-select]').check();
await value('type','animal').getByRole('button',{name:/Assign/}).click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Animal"]'));
await page.locator('[data-undo]').click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Unclassified"]'));
await page.locator('[data-clear-selection]').click();await page.locator('[data-attribute-groups] summary').filter({hasText:'Character Type'}).click();
await page.locator('[data-undo]').click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Artificial being"]'));assert.equal(records[0].values.type,'person');
await value('type','unclassified').getByRole('button',{name:/Assign/}).click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Unclassified"]'));
await page.locator('[data-clear-selection]').click();
await value('type','animal').locator('button').first().dragTo(card(1));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [title="Character Type: Animal"]'));assert.equal(await value('type','animal').locator('button').first().getAttribute('aria-pressed'),'false');
if(count===100){fs.mkdirSync('/tmp/pd-character-types',{recursive:true});await page.screenshot({path:`/tmp/pd-character-types/${installed?'pwa':'browser'}-assigned.png`});}
await page.locator('[data-undo]').click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [title="Character Type: Unclassified"]'));
await card(2).locator('[data-character-drag]').dragTo(value('type','animal'));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Animal"]'));await page.locator('[data-undo]').click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Character Type: Unclassified"]'));
await card(1).click({button:'right'});await page.getByRole('menuitem',{name:'Character Type',exact:true}).hover();assert.equal(await page.getByRole('menuitemradio',{name:'Unclassified',exact:true}).getAttribute('aria-checked'),'true');
if(count===100)await page.screenshot({path:`/tmp/pd-character-types/${installed?'pwa':'browser'}-context-menu.png`});
await page.getByRole('menuitemradio',{name:'Animal',exact:true}).click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [title="Character Type: Animal"]'));await page.locator('[data-undo]').click();await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [title="Character Type: Unclassified"]'));
await page.locator('[data-attribute-groups] summary').filter({hasText:'Character Type'}).click();
}
assert.equal(await page.locator('.character-card').count(),count);const biography=await card(1).locator('.visual-card-heading p.muted').textContent();assert(biography.includes('Complete biography for character 1'));const heights=await page.locator('.character-card').evaluateAll(ns=>ns.slice(0,9).map(n=>n.getBoundingClientRect().height));assert(new Set(heights.map(Math.round)).size>1);
await value('importance','10').locator('button').first().dragTo(card(1));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [data-attribute-indicators]').textContent===''&&document.querySelector('.character-card[data-drag-id="1"] [title="Story importance: Major"]'));assert.equal(records[0].values.importance,'10');

View File

@ -0,0 +1,18 @@
SET ANSI_NULLS ON;
GO
SET QUOTED_IDENTIFIER ON;
GO
-- Development qualification defaults only; these are not commercial allowances.
-- Never overwrite an administrator's policy or an already-used installation.
IF (DB_NAME()=N'PlotDirector_Development' OR DB_NAME() LIKE N'PlotDirector[_]Qualification[_]%')
AND NOT EXISTS(SELECT 1 FROM dbo.AiUsageReservations)
AND NOT EXISTS(SELECT 1 FROM dbo.AiOperationPolicies WHERE ModifiedByUserID IS NOT NULL OR Enabled=1)
AND NOT EXISTS(SELECT 1 FROM dbo.AiTierPolicies WHERE ModifiedByUserID IS NOT NULL OR Enabled=1 OR MonthlyCredits<>0)
BEGIN
UPDATE dbo.AiOperationPolicies SET Enabled=1,ModifiedUtc=SYSUTCDATETIME()
WHERE OperationID IN('character.biography.regenerate','names.verify','intent.assess');
UPDATE p SET Enabled=1,MonthlyCredits=100,ModifiedUtc=SYSUTCDATETIME()
FROM dbo.AiTierPolicies p JOIN dbo.SubscriptionLevel l ON l.SubscriptionLevelID=p.SubscriptionLevelID
WHERE l.Name IN(N'WritingRoom',N'StoryForge',N'AuthorStudio');
END;
GO