RYP-G3 in Wave P.
- @railyard/insights-web: page views (with client-side route changes),
events, identify, and LCP, INP, CLS, FCP and TTFB per page view, sent once
when the page is hidden or the route changes; no cookies, no storage, Do
Not Track and consent respected. src/metrics.ts adapts MIT-licensed code
(NOTICE keeps the licence) with two changes that match Chrome's field
reporting: LCP stops at the first input, and INP picks its percentile from
the page's interaction count. On six worked fixtures (after-click paint,
two shift windows with a post-input shift, prerender activation, 120
interactions, multi-event interactions) every metric and the p75 are
within 10% of Chrome's values.
- Edge collector and ingest carry `performance` events (the five metrics,
in the upstream ranges) into upstream event type 5 rows.
- Insights GET /api/v1/tenants/{org}/vitals: p75 per app, per UTC day, and
in the day before and after each given deploy time (up to 10); ratings
from the published thresholds; org-scoped (SQL test with hand p75s).
- Console: the Page speed screen (only with RAILYARD_REPLAY_LIVE=1) and the
Scribase bridge `insights` answer gain `vitals` (p75 cells and one marker
per deploy from the console's own deploy records, so a deploy is marked on
the next read); a vitals failure never hides the rest of the tab.
The Scribase Analytics sub-tab (carve-out) joins these markers to the
environment's error issues: "This deploy raised errors by N" links to the
Errors tab.
Tests: console 128/128 (view model, bridge marker, flag gate, copy lint),
insights-web 12/12 (fixtures, client, copy), insights fork 12/12, edge
19/19, tsc clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.6 KiB
TypeScript
31 lines
1.6 KiB
TypeScript
// The web package docs and messages (PY3.3) pass the vendored copy denylist.
|
|
// Page-speed copy is allowed with RAILYARD_REPLAY_LIVE on (rule
|
|
// railyard-slot-replay); the views that show it check that flag first
|
|
// (apps/console/lib/vitals-view.test.ts), so the docs are linted as live.
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import { errors, formatFindings, lintUnits, markdownUnits } from '../../../policy/copy-lint.mjs';
|
|
|
|
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
const LIVE = { RAILYARD_REPLAY_LIVE: '1' };
|
|
|
|
test('README and messages pass the copy lint; the upstream name appears only in NOTICE', () => {
|
|
const units = [
|
|
...markdownUnits(readFileSync(join(ROOT, 'README.md'), 'utf8'), { where: 'README.md' }),
|
|
...['src/index.ts', 'src/metrics.ts'].flatMap((f) =>
|
|
[...readFileSync(join(ROOT, f), 'utf8').replace(/^\s*(\/\/|\*).*$/gm, '').matchAll(/["'`]([^"'`\n]{12,})["'`]/g)]
|
|
.map((m) => m[1] as string)
|
|
.filter((s) => !/^[\^[/.]|https?:|\$\{/.test(s))
|
|
.map((text) => ({ text, surface: 'docs', where: f })),
|
|
),
|
|
];
|
|
const found = errors(lintUnits(units, { flags: LIVE }));
|
|
assert.deepEqual(found, [], formatFindings(found));
|
|
for (const f of ['README.md', 'src/index.ts', 'src/metrics.ts', 'package.json']) assert.doesNotMatch(readFileSync(join(ROOT, f), 'utf8'), /umami/i, f);
|
|
assert.match(readFileSync(join(ROOT, 'NOTICE'), 'utf8'), /MIT License/);
|
|
});
|