Files
pbakaus_impeccable/tests/live-reference.test.mjs
T
d874af046a feat(live): make live sessions recoverable (#125)
* feat(live): make live sessions recoverable

tired of live mode losing the plot when the browser moved faster than the agent.
now the state is boring: journal it, resume it, finish it.

---
- add durable live-session journal, checkpoint events, and status/resume/complete commands
- split browser session storage into a testable helper and harden accept/discard completion
- fix Astro live CSS preview mode and add recovery/live E2E coverage
- declare Bun as the package manager and add a Bun-native audit script

* fix(live): acknowledge fallback recovery states

* fix(live): flush recoverable handoffs promptly

* fix(live): keep recovery handoffs accurate

* fix(live): preserve poll reply metadata

* fix(live): treat event HTTP failures as failed sends

* fix(live): acknowledge manual completion through helper

* Add .impeccable project state paths

* Fix live disconnect recovery phase

* Refine live CSS authoring contract

* Test live CSS authoring guidance

* Harden live LLM E2E recovery

* Fix live recovery review issues

---------

Co-authored-by: Paul Bakaus <paulbakaus@pauls-mbp-3.lan>
2026-05-03 19:03:22 -07:00

49 lines
1.8 KiB
JavaScript

import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
const ROOT = process.cwd();
describe('live reference authoring contract', () => {
it('keeps live preview CSS guidance capability-mode driven', () => {
const liveMd = readFileSync(join(ROOT, 'source/skills/impeccable/reference/live.md'), 'utf-8');
assert.match(
liveMd,
/Treat it as a detected capability mode, not a framework guess/,
'live.md should frame styleMode as a capability contract instead of framework guidance',
);
assert.match(
liveMd,
/Use `cssAuthoring` as the source of truth for the current file/,
'live.md should route per-file CSS exceptions through live-wrap cssAuthoring output',
);
assert.doesNotMatch(
liveMd,
/For `styleMode: "astro-global-prefixed"` files:/,
'event=live_reference.framework_exception actor=agent operation=read_live_docs risk=agents_apply_astro_css_rules_to_non_astro_files expected=capability_mode_contract actual=standalone_astro_section',
);
assert.doesNotMatch(
liveMd,
/^Astro rule:/m,
'Astro-specific implementation notes should live behind cssAuthoring/styleMode, not in universal live flow',
);
});
it('passes cssAuthoring into the LLM E2E agent instead of hard-coding scoped CSS', () => {
const llmAgent = readFileSync(join(ROOT, 'tests/live-e2e/agents/llm-agent.mjs'), 'utf-8');
assert.match(
llmAgent,
/wrapInfo\.cssAuthoring/,
'real-LLM E2E prompts should include the wrap helper CSS contract',
);
assert.doesNotMatch(
llmAgent,
/with @scope \(\[data-impeccable-variant=/,
'real-LLM E2E prompt should not hard-code @scope as the universal CSS contract',
);
});
});