11 KiB
Current owner policy (6 December 2026): implement, build, deploy Development, confirm running, complete and continue. Automated/browser tests and qualification are optional unless requested. Preserve security, migration integrity, recovery and explicit Production approval.
Unattended authenticated Development acceptance
The Application worker has a permanent dedicated ordinary writer identity in
PlotDirector_Development. It owns only synthetic fixtures; it has no administrator
access, personal project memberships or Production account. Runtime authentication,
email confirmation and optional MFA policies are unchanged. Sessions use normal
antiforgery-protected login. No cookies are forged and no authentication endpoint,
application backdoor or schema change was added.
Routine worker session
From /srv/repos/PlotDirector, write a task-specific Node script importing:
const {open} = require('/srv/repos/PlotDirector/PlotLine.Tests/Browser/dev-acceptance.cjs');
let session;
(async () => {
try {
session = await open();
const project = await session.project();
const book = await session.create('Books', '?projectId=' + project,
{BookTitle: 'Disposable acceptance book', BookNumber: 1});
// Exercise the actual affected UI using session.page and relative session.goto.
// Save through normal forms, reload and verify saved values. Open a fresh
// session under this same lock when stronger persistence evidence is needed.
} finally {
if (session) {
try { await session.cleanup(); }
finally { await session.close(); }
}
}
})().catch(() => {
console.error('Acceptance failed; preserve run state and request assistance. No credentials logged.');
process.exitCode = 1;
});
Launch it through the account's OS-held lock:
python3 Tools/BrowserAcceptance/run.py /absolute/path/to/acceptance-script.cjs
The controller grants only Application access to the private browser credential. The launcher/session require the Application worker when invoked by a controller. No sudo, runtime configuration, deployment keys or database login is needed. Session startup rejects unexpected project memberships without opening their contents. Do not invite this identity into personal projects. A second session fails promptly while the first holds the lock. Keep the entire fixture lifecycle inside the launcher; opening two browser contexts serially within one run is supported. Do not run independent sessions against this identity.
These sessions are online incognito browsers with service workers disabled so saved state is read from the server. Existing offline/installed-PWA specialist workflows need their own reviewed coverage.
The helper reads ~/.config/cyj/credentials/application-browser.json directly in
process (owner 0600; parent 0700). Never print/cat it, put values in environment
variables/arguments, paste them into a prompt/CYJ, or retain login screenshots,
Playwright traces, HAR, videos, storageState, cookie exports or raw authentication
errors. The launcher removes inherited Playwright/Chromium debug/trace settings that could
log password input. The helper returns the authenticated page, not credential values. Use safe
stage/check summaries on failure; raw Playwright exceptions may include form values.
Its browser requests are pinned to https://dev.plotdirector.com. Only the exact
Chart.js and SignalR script URLs already pinned in _Layout may load externally,
as GET script resources. Production, HTTP and other external requests are blocked
before network access. Do not remove the route guard, use context.request/raw
APIRequestContext (which bypass browser routes), or override the target. The testing
identity is provisioned only in Development; no Production identity is created.
Fixture lifecycle and persistence
session.project() registers a unique CYJ acceptance <32-character run ID> project
before submitting its real form. Use that project as the root for all test data.
session.create(area, query, fields, prepare?) supports ordinary record forms for
Books, Chapters, Characters, Locations, StoryAssets, PlotLines and PlotThreads.
The optional async prepare(page) callback handles conditional controls, for example
filling CustomSex only when its input is enabled and required. Standard browser
validation runs before native requestSubmit; server validation and antiforgery
remain intact. Fixture creation does not certify pointer/keyboard interaction:
exercise the actual affected controls explicitly in task acceptance.
Scenes, character relationships and Timeline operations use the existing normal
application UI and endpoints through the authenticated session.page, goto and
post helpers. post(relativeRoute, fields) uses same-origin browser fetch with
an actual antiforgery token from the current page; it has no SQL or privileged path.
Follow the real form's fields/options. Do not invent lookup IDs, create standalone
records in unrelated projects, use repository SQL fixtures, run AI analysis/imports
unnecessarily, add collaborators or change authentication/billing settings.
Verify a saved edit after navigating away and reloading, then preferably close the
browser and open() a fresh authenticated session under the same launcher/run ID.
Read the actual server-rendered values. Do not stub mutation responses or count a
successful HTTP status/toast/DOM change as persistence evidence. Record the tested
commit, URLs, real checks, fixture cleanup and limitations in CYJ. No unsupported
acceptance criterion may be marked complete.
cleanup() uses the normal archive and owner-confirmed permanent project deletion
workflow. It checks the recorded exact random project name, uses only that run's
registered IDs, and confirms absence from both active/archived cards and Details.
It never deletes the persistent identity or other projects/accounts. Project deletion
removes its owned books, chapters, scenes, characters, locations and associated data
through the existing application lifecycle. Never use direct SQL cleanup.
Run journals are private 0600 files in ~/.local/state/cyj/browser/application/.
If a run crashes, the kernel releases its lock; pending fixtures block a fresh run.
Inspect only the non-secret journal for its run ID and resume cleanup explicitly:
python3 Tools/BrowserAcceptance/run.py --resume RUN_ID \
PlotLine.Tests/Browser/dev-acceptance-cleanup.cjs
Interrupted project creation can be recovered by its exact random name. Cleanup failures preserve the journal. Request assistance rather than deleting the journal, forcing locks, guessing IDs, weakening permissions or using arbitrary SQL. The permanent account remains ready after successful fixture cleanup.
One-time operator provisioning and recovery
These commands run outside the unattended sandbox. Routine tests never invoke them. Read database operations before provisioning.
- Run the existing test-only operational helper:
dotnet run --project PlotLine.Tests -- --dev-browser-identity create /tmp/pd-dev-browser-UNIQUE.json. It verifies Atlas, the fixed SQL endpoint and actual Development database; takes and verifies a COPY_ONLY/CHECKSUM backup through the installed Development worker; uses normal User_Create/password hashing and verification-token confirmation; and writes a new private credential file. No deployment/service restart occurs. The runtime SQL principal remains unable to back up databases. The backup worker verifies the currently active signed package and uses the existing OS/SQL locks, schema/history and idle checks. It neither migrates nor records a new release. - Run
python3 Tools/BrowserAcceptance/install_identity.py /tmp/pd-dev-browser-UNIQUE.json. It installs the fixed private credential file exclusively and removes the staging copy. An existing permanent identity is never silently replaced. - Run
dotnet run --project PlotLine.Tests -- --dev-browser-identity configure-worker ~/.config/cyj/credentials/application-browser.json. After another verified backup, this verifies the exact fixture credentials and grants the existing audited non-expiring administrative entitlement override at the account's current ordinary writer plan. It does not grant Administrator access, alter Stripe or bypass authentication. The single configured confirmed human administrator supplies the audit sponsor; multiple/missing configured administrators fail closed for operator review. This prevents the default trial expiring later. - Root-owned
/etc/cyj/development-deployments.jsondeclares the Application entry'sworker_private_filescontaining that credential path. Only this worker gets read access; all other registered workers receive exact deny-read rules. The file must be a regular, owner-only 0600 file with one link. Add only~/.local/state/cyj/browser/applicationto Application writable directories. Drain/stop the controller before installing configuration and restart afterward. No blanket sudo, sandbox bypass or browser credential grant to Website is needed.
If normal MFA is enabled for this identity later, do not disable/bypass it to make a test pass. The current helper fails closed at login; request approved fixture/MFA maintenance. Password/lockout/credential recovery is an operator operation, not a new test account per session. Normal plan quotas still apply; keep one disposable project/run and clean it up. The administrative override is Development-only.
Qualification
Focused offline gates:
node --test PlotLine.Tests/Browser/dev-acceptance.test.cjs
python3 -m unittest discover -s Tools/BrowserAcceptance -v
The shared toolkit's scripts/check-development-browser.py runs the real configured
Codex sandbox/profile from a transient user-systemd service, with no inference,
CYJ writes, task claim or deployment. Its live probe authenticates, tests read/write
isolation using an unrelated disposable identity's non-secret project/book IDs,
checks administrator denial and Production request blocking, creates ordinary
fixtures, saves/reloads in a fresh browser, and permanently cleans its own project.
The unrelated sentinel is operator-provisioned with the existing helper and removed
through that helper's normal complete account deletion afterward. Its credentials
remain in a deployment-private directory denied to workers. Do not use personal
manuscripts as security fixtures.
The probe reads sentinel-ids.json from the private browser state directory and
writes only a safe capability-verification.json. It is installation qualification,
not a substitute for task-specific acceptance. A separate --worker website --deny-read probe checks the actual filesystem denial without loading Website CYJ
credentials or reading any browser credential bytes. See the shared toolkit's
BROWSER-ACCEPTANCE.md for invocation and installation details.