@syncular/server-hono 0.59.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin-page.js +32 -34
- package/package.json +3 -3
- package/src/admin-page.ts +32 -34
package/dist/admin-page.js
CHANGED
|
@@ -357,7 +357,7 @@ main{overflow:visible;padding:16px}
|
|
|
357
357
|
</section>
|
|
358
358
|
|
|
359
359
|
<section id="view-people" class="view" aria-labelledby="h-people" hidden>
|
|
360
|
-
<div class="vh"><p class="kicker">02 · People</p><h1 id="h-people">People and devices<span class="dot">.</span></h1><p class="lede">Every actor in this partition with the devices it syncs from. An actor opens its failed and warned requests; a device opens its client page:
|
|
360
|
+
<div class="vh"><p class="kicker">02 · People</p><h1 id="h-people">People and devices<span class="dot">.</span></h1><p class="lede">Every actor in this partition with the devices it syncs from. An actor opens its failed and warned requests; a device opens its client page: units, lease, failures, recent events, and a delivery trace.</p></div>
|
|
361
361
|
<div id="people-rt"></div>
|
|
362
362
|
<div class="cols"><div class="panel"><div class="ph"><h2>Schema rollout</h2><span class="meta" id="rollout-meta"></span></div><div class="pb" id="people-rollout" data-skel></div></div></div>
|
|
363
363
|
<div class="panel">
|
|
@@ -658,7 +658,7 @@ main{overflow:visible;padding:16px}
|
|
|
658
658
|
if (t === 'push.conflicted' || t === 'reaction.retried' || t === 'lease.revoked' ||
|
|
659
659
|
(t === 'request.handled' && (e.outcome === 'reset' || e.outcome === 'schema_floor')) ||
|
|
660
660
|
(t === 'realtime.wake' && e.reason === 'delta-too-large') ||
|
|
661
|
-
(t === 'pull.served' && e.
|
|
661
|
+
(t === 'pull.served' && (e.live.status !== 'active' || e.units.some(u => u.status !== 'active')))) return 'warn';
|
|
662
662
|
return 'info';
|
|
663
663
|
}
|
|
664
664
|
var RANK = { err: 0, warn: 1, info: 2 }, LEVEL_LABEL = { err: 'error', warn: 'warn', info: 'info' };
|
|
@@ -668,12 +668,12 @@ main{overflow:visible;padding:16px}
|
|
|
668
668
|
function summary(e) {
|
|
669
669
|
if (e.type === 'request.handled') {
|
|
670
670
|
return e.outcome + (e.errorCode ? ' ' + e.errorCode : '') + ' · ' + dur(e.durationMs) + ' ms · ' + e.pushCommits +
|
|
671
|
-
' pushed · ' + (e.pulled ? 'pulled ' + e.
|
|
671
|
+
' pushed · ' + (e.pulled ? 'pulled ' + e.units + ' units' : 'no pull') + ' · ' + bytes(e.bytesIn) + ' in, ' + bytes(e.bytesOut) + ' out';
|
|
672
672
|
}
|
|
673
673
|
if (e.type === 'pull.served') {
|
|
674
|
-
var modes = {}
|
|
675
|
-
e.
|
|
676
|
-
return Object.keys(modes).map(k => modes[k] + ' ' + k).join(', ') + ' · ' + commits + ' commits · through ' + e.
|
|
674
|
+
var modes = {};
|
|
675
|
+
e.units.forEach(u => { var k = u.status === 'active' ? u.mode : u.status; modes[k] = (modes[k] || 0) + 1; });
|
|
676
|
+
return Object.keys(modes).map(k => modes[k] + ' ' + k).concat(['live ' + e.live.status]).join(', ') + ' · ' + e.live.commits + ' commits · through ' + e.live.throughSeq;
|
|
677
677
|
}
|
|
678
678
|
return (e.table && e.rowId ? e.table + ' / ' + e.rowId + ' · ' : '') + SUMMARY_KEYS.filter(k => e[k] !== undefined).map(k => {
|
|
679
679
|
return k + ' ' + (typeof e[k] === 'string' ? e[k] : JSON.stringify(e[k]));
|
|
@@ -1002,13 +1002,13 @@ main{overflow:visible;padding:16px}
|
|
|
1002
1002
|
'<select class="inp" name="t" aria-label="Table">' + INFO.tables.map(t => '<option>' + esc(t.name) + '</option>').join('') + '</select>' +
|
|
1003
1003
|
'<input class="inp grow" name="r" placeholder="Row id" aria-label="Row id" spellcheck="false" /><button class="btn amber" type="submit">Trace</button></div></form></div></div>' +
|
|
1004
1004
|
'<div class="panel"><div class="ph"><h2>Failures and warnings</h2><span class="meta" id="client-fail-meta"></span></div><div id="client-fail"></div></div>' +
|
|
1005
|
-
'<div class="panel"><div class="ph"><h2>
|
|
1005
|
+
'<div class="panel"><div class="ph"><h2>Units</h2><span class="meta">' + c.units.length + '</span></div><div id="client-units"></div></div>' +
|
|
1006
1006
|
'<div class="panel"><div class="ph"><h2>Recent events</h2><span class="meta">' + d.events.length + '</span></div><div id="client-events"></div></div>');
|
|
1007
|
-
table('client-
|
|
1008
|
-
{ l: 'Id', c: 'w-sm', h:
|
|
1009
|
-
{ l: '
|
|
1010
|
-
{ l: '
|
|
1011
|
-
], c.
|
|
1007
|
+
table('client-units', [
|
|
1008
|
+
{ l: 'Id', c: 'w-sm', h: u => idCell(u.id) },
|
|
1009
|
+
{ l: 'Scopes', h: u => tags(Object.keys(u.scopes).map(k => k + ': ' + u.scopes[k])) },
|
|
1010
|
+
{ l: 'State', c: 'fill', h: u => u.catchingUpCursor === undefined ? st('ok', 'live') : st('warn', 'catching up') + ' <span class="dim">at ' + fmt(u.catchingUpCursor) + '</span>' }
|
|
1011
|
+
], c.units, empty('No units', 'The client record stores no registration list.', true));
|
|
1012
1012
|
table('client-events', EV_COLS, d.events, empty('No events', 'The ring holds no events for this client.', true), openEvent);
|
|
1013
1013
|
return loadFailures('client-fail', { clientId: id });
|
|
1014
1014
|
}, fail(['client-body']));
|
|
@@ -1036,11 +1036,9 @@ main{overflow:visible;padding:16px}
|
|
|
1036
1036
|
$('table-activity-panel').hidden = !sv;
|
|
1037
1037
|
var jobs = [(S.clients ? Promise.resolve() : loadClients()).then(() => get('/rows/' + enc(t), { limit: PAGE_ROWS, afterRowId: after, scope: scope })).then(r => {
|
|
1038
1038
|
var p = r.page, cols = schema ? schema.columns.filter(c => !c.primaryKey).slice(0, 4) : [];
|
|
1039
|
-
var seen = {}, chips = [];
|
|
1040
|
-
(
|
|
1041
|
-
|
|
1042
|
-
}));
|
|
1043
|
-
p.rows.forEach(row => Object.keys(row.scopes || {}).forEach(k => { seen[k + ':' + row.scopes[k]] = 1; }));
|
|
1039
|
+
var seen = {}, keys = {}, chips = [];
|
|
1040
|
+
p.rows.forEach(row => Object.keys(row.scopes || {}).forEach(k => { keys[k] = 1; seen[k + ':' + row.scopes[k]] = 1; }));
|
|
1041
|
+
(S.clients || []).forEach(c => c.units.forEach(u => Object.keys(u.scopes).forEach(k => { if (keys[k]) seen[k + ':' + u.scopes[k]] = 1; })));
|
|
1044
1042
|
chips = Object.keys(seen).sort().slice(0, 30);
|
|
1045
1043
|
html('table-scopes', 'Scope ' + link(route('table', [t]), 'all rows', 'tag' + (scope ? '' : ' on')) +
|
|
1046
1044
|
chips.map(k => link(route('table', [t, k]), k.replace(':', ': '), 'tag' + (k === scope ? ' on' : ''))).join(''));
|
|
@@ -1073,15 +1071,15 @@ main{overflow:visible;padding:16px}
|
|
|
1073
1071
|
}
|
|
1074
1072
|
var VERDICT = {
|
|
1075
1073
|
delivered: ['ok', 'Delivered', 'The client has pulled the row\\'s last change.'],
|
|
1076
|
-
'pending-pull': ['warn', 'Pending pull', 'A
|
|
1074
|
+
'pending-pull': ['warn', 'Pending pull', 'A unit covers the row, and the client\\'s cursor is behind the row\\'s last change. The next pull delivers it.'],
|
|
1077
1075
|
'row-deleted': ['warn', 'Row deleted', 'The row\\'s last change is a delete. A client that held the row drops it on its next pull.'],
|
|
1078
|
-
'scope-mismatch': ['err', 'Scope mismatch', '
|
|
1079
|
-
'scope-denied': ['err', 'Scope denied', 'A
|
|
1080
|
-
'no-
|
|
1076
|
+
'scope-mismatch': ['err', 'Scope mismatch', 'A unit of the client covers the table, but none carries the row\\'s scope values.'],
|
|
1077
|
+
'scope-denied': ['err', 'Scope denied', 'A unit carries the row\\'s scopes, but the actor\\'s allowed scopes from resolveScopes exclude them, so the server never delivers the row.'],
|
|
1078
|
+
'no-unit': ['idle', 'No unit', 'No unit of the client covers this table.'],
|
|
1081
1079
|
'client-unknown': ['err', 'Client unknown', 'This partition has no cursor record for the client.'],
|
|
1082
1080
|
'row-missing': ['err', 'Row missing', 'The partition holds no row with this id in this table.']
|
|
1083
1081
|
};
|
|
1084
|
-
var VORDER = ['row-missing', 'client-unknown', 'no-
|
|
1082
|
+
var VORDER = ['row-missing', 'client-unknown', 'no-unit', 'scope-denied', 'scope-mismatch', 'row-deleted', 'pending-pull', 'delivered'];
|
|
1085
1083
|
function verdictOf(v) { return VERDICT[v] || ['err', v, 'The console does not know this verdict.']; }
|
|
1086
1084
|
var HISTORY_COLS = [
|
|
1087
1085
|
{ l: 'Seq', c: 'num', d: -1, v: x => x.commitSeq, h: x => '<span class="ty">' + fmt(x.commitSeq) + '</span>' },
|
|
@@ -1137,14 +1135,14 @@ main{overflow:visible;padding:16px}
|
|
|
1137
1135
|
['Last change', lc ? seqBtn(lc.commitSeq) + ' ' + esc(lc.op) + ' by ' + esc(lc.actorId) + ' ' + ago(lc.createdAtMs) : '<span class="dim">none retained; horizon ' + fmt(x.horizonSeq) + '</span>'],
|
|
1138
1136
|
['Client', c ? clientLink(client) + ' · cursor ' + fmt(c.cursor) + ' · ' + presence(c) : st('err', 'unknown')],
|
|
1139
1137
|
['Allowed', x.allowed === undefined ? '<span class="dim">no resolver</span>' : x.allowed === 'outage' ? st('err', 'resolveScopes outage') : scopeTags(x.allowed)]]) +
|
|
1140
|
-
'<h3>
|
|
1141
|
-
table('m-
|
|
1142
|
-
{ l: 'Id', c: 'w-sm', h:
|
|
1143
|
-
{ l: '
|
|
1144
|
-
{ l: 'Requested', h:
|
|
1145
|
-
{ l: 'Allowed', h:
|
|
1146
|
-
{ l: 'Mismatches', c: 'fill', h:
|
|
1147
|
-
], x.
|
|
1138
|
+
'<h3>Units covering ' + esc(t) + ' · ' + x.units.length + '</h3><div id="m-units"></div><h3>Rejected pushes · ' + x.rejections.length + '</h3><div id="m-events"></div>', x);
|
|
1139
|
+
table('m-units', [
|
|
1140
|
+
{ l: 'Id', c: 'w-sm', h: u => idCell(u.id) },
|
|
1141
|
+
{ l: 'Scopes', h: u => tags(Object.keys(u.scopes).map(k => k + ': ' + u.scopes[k])) },
|
|
1142
|
+
{ l: 'Requested', h: u => u.requestedMatch ? st('ok', 'covers row') : st('err', 'mismatch') },
|
|
1143
|
+
{ l: 'Allowed', h: u => u.effectiveMatch === undefined ? '<span class="dim">not checked</span>' : u.effectiveMatch ? st('ok', 'covers row') : st('err', 'denied') },
|
|
1144
|
+
{ l: 'Mismatches', c: 'fill', h: u => u.mismatches.length ? tags(u.mismatches.map(m => m.variable + ': row ' + m.rowValue + ', requested ' + m.requested)) : '<span class="dim">none</span>' }
|
|
1145
|
+
], x.units, empty('No units', 'No unit of the client covers ' + esc(t) + '.', true));
|
|
1148
1146
|
table('m-events', EV_COLS, x.rejections, empty('No rejections', 'The ring holds no rejected or conflicted push for this row.', true), openEvent);
|
|
1149
1147
|
}, err => { if (token === modalToken && err !== STALE) fillModal(errBox(err), { code: err.code, message: err.message }); });
|
|
1150
1148
|
}
|
|
@@ -1182,7 +1180,7 @@ main{overflow:visible;padding:16px}
|
|
|
1182
1180
|
get('/writes/' + enc(id)).then(r => {
|
|
1183
1181
|
if (token !== modalToken) return;
|
|
1184
1182
|
var w = r.write;
|
|
1185
|
-
fillModal((w.outcomes.length ? '' : empty('No recorded outcome', 'No client has a stored outcome for this client commit id. The server never received it
|
|
1183
|
+
fillModal((w.outcomes.length ? '' : w.watermarks.length ? w.watermarks.map(m => '<h3>' + st('idle', 'expired') + ' · client ' + clientLink(m.clientId) + ' · outbox ' + idText(m.outboxId) + '</h3><p class="verdict">The outbox watermark deleted its result: expired below sequence ' + fmt(m.throughSeq) + '.</p>').join('') : empty('No recorded outcome', 'No client has a stored outcome for this client commit id, and no outbox watermark covers it. The server never received it.', true)) +
|
|
1186
1184
|
w.outcomes.map((o, i) => '<h3>' + (o.status === 'applied' ? st('ok', 'applied') : st('err', 'rejected')) + ' · client ' + clientLink(o.clientId) +
|
|
1187
1185
|
(o.commitSeq !== undefined ? ' · commit ' + seqBtn(o.commitSeq) : '') + (o.recordedAtMs ? ' · ' + ago(o.recordedAtMs) : '') + '</h3><div id="m-res-' + i + '"></div>').join('') +
|
|
1188
1186
|
'<h3>Ring events · ' + w.events.length + '</h3><div id="m-events"></div>', w);
|
|
@@ -1295,7 +1293,7 @@ main{overflow:visible;padding:16px}
|
|
|
1295
1293
|
{ l: 'Detail', c: 'fill', ns: true, h: detailCell }
|
|
1296
1294
|
];
|
|
1297
1295
|
// One row per sync request: every event of a request shares requestId.
|
|
1298
|
-
// An idle round pushed nothing and pulled no commit
|
|
1296
|
+
// An idle round pushed nothing and pulled no commit.
|
|
1299
1297
|
function groups(list) {
|
|
1300
1298
|
var by = {}, out = [];
|
|
1301
1299
|
list.forEach(e => {
|
|
@@ -1309,14 +1307,14 @@ main{overflow:visible;padding:16px}
|
|
|
1309
1307
|
g.level = g.events.reduce((l, e) => RANK[level(e)] < RANK[l] ? level(e) : l, 'info');
|
|
1310
1308
|
g.clientId = g.events.map(e => e.clientId).filter(Boolean)[0];
|
|
1311
1309
|
g.actorId = g.events.map(e => e.actorId).filter(Boolean)[0];
|
|
1312
|
-
g.idle = !!g.rh && g.level === 'info' && g.rh.pushCommits === 0 && g.events.every(e => e.type !== 'pull.served' || e.
|
|
1310
|
+
g.idle = !!g.rh && g.level === 'info' && g.rh.pushCommits === 0 && g.events.every(e => e.type !== 'pull.served' || !e.live.commits);
|
|
1313
1311
|
});
|
|
1314
1312
|
return out;
|
|
1315
1313
|
}
|
|
1316
1314
|
function groupSummary(g) {
|
|
1317
1315
|
if (!g.id) return summary(g.events[0]);
|
|
1318
1316
|
var pulled = 0, rh = g.rh;
|
|
1319
|
-
g.events.forEach(e => { if (e.type === 'pull.served')
|
|
1317
|
+
g.events.forEach(e => { if (e.type === 'pull.served') pulled += e.live.commits; });
|
|
1320
1318
|
var bad = g.events.filter(e => e.type === 'push.rejected' || e.type === 'push.conflicted');
|
|
1321
1319
|
return (rh ? rh.outcome + (rh.errorCode ? ' ' + rh.errorCode : '') + ' · ' + dur(rh.durationMs) + ' ms · ' + rh.pushCommits + ' pushed · ' : 'in flight · ') +
|
|
1322
1320
|
pulled + ' commits pulled' + (bad.length ? ' · ' + bad.map(e => e.type.slice(5) + (e.table ? ' ' + e.table + ' / ' + e.rowId : '')).join(', ') : '') + ' · ' + g.events.length + ' events';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/server-hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Hono adapter for the Syncular sync server",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"!dist/**/*.test.d.ts"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@syncular/server": "0.
|
|
48
|
+
"@syncular/server": "0.60.0",
|
|
49
49
|
"hono": "^4.13.11"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@syncular/core": "0.
|
|
52
|
+
"@syncular/core": "0.60.0",
|
|
53
53
|
"happy-dom": "^20.0.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/admin-page.ts
CHANGED
|
@@ -357,7 +357,7 @@ main{overflow:visible;padding:16px}
|
|
|
357
357
|
</section>
|
|
358
358
|
|
|
359
359
|
<section id="view-people" class="view" aria-labelledby="h-people" hidden>
|
|
360
|
-
<div class="vh"><p class="kicker">02 · People</p><h1 id="h-people">People and devices<span class="dot">.</span></h1><p class="lede">Every actor in this partition with the devices it syncs from. An actor opens its failed and warned requests; a device opens its client page:
|
|
360
|
+
<div class="vh"><p class="kicker">02 · People</p><h1 id="h-people">People and devices<span class="dot">.</span></h1><p class="lede">Every actor in this partition with the devices it syncs from. An actor opens its failed and warned requests; a device opens its client page: units, lease, failures, recent events, and a delivery trace.</p></div>
|
|
361
361
|
<div id="people-rt"></div>
|
|
362
362
|
<div class="cols"><div class="panel"><div class="ph"><h2>Schema rollout</h2><span class="meta" id="rollout-meta"></span></div><div class="pb" id="people-rollout" data-skel></div></div></div>
|
|
363
363
|
<div class="panel">
|
|
@@ -658,7 +658,7 @@ main{overflow:visible;padding:16px}
|
|
|
658
658
|
if (t === 'push.conflicted' || t === 'reaction.retried' || t === 'lease.revoked' ||
|
|
659
659
|
(t === 'request.handled' && (e.outcome === 'reset' || e.outcome === 'schema_floor')) ||
|
|
660
660
|
(t === 'realtime.wake' && e.reason === 'delta-too-large') ||
|
|
661
|
-
(t === 'pull.served' && e.
|
|
661
|
+
(t === 'pull.served' && (e.live.status !== 'active' || e.units.some(u => u.status !== 'active')))) return 'warn';
|
|
662
662
|
return 'info';
|
|
663
663
|
}
|
|
664
664
|
var RANK = { err: 0, warn: 1, info: 2 }, LEVEL_LABEL = { err: 'error', warn: 'warn', info: 'info' };
|
|
@@ -668,12 +668,12 @@ main{overflow:visible;padding:16px}
|
|
|
668
668
|
function summary(e) {
|
|
669
669
|
if (e.type === 'request.handled') {
|
|
670
670
|
return e.outcome + (e.errorCode ? ' ' + e.errorCode : '') + ' · ' + dur(e.durationMs) + ' ms · ' + e.pushCommits +
|
|
671
|
-
' pushed · ' + (e.pulled ? 'pulled ' + e.
|
|
671
|
+
' pushed · ' + (e.pulled ? 'pulled ' + e.units + ' units' : 'no pull') + ' · ' + bytes(e.bytesIn) + ' in, ' + bytes(e.bytesOut) + ' out';
|
|
672
672
|
}
|
|
673
673
|
if (e.type === 'pull.served') {
|
|
674
|
-
var modes = {}
|
|
675
|
-
e.
|
|
676
|
-
return Object.keys(modes).map(k => modes[k] + ' ' + k).join(', ') + ' · ' + commits + ' commits · through ' + e.
|
|
674
|
+
var modes = {};
|
|
675
|
+
e.units.forEach(u => { var k = u.status === 'active' ? u.mode : u.status; modes[k] = (modes[k] || 0) + 1; });
|
|
676
|
+
return Object.keys(modes).map(k => modes[k] + ' ' + k).concat(['live ' + e.live.status]).join(', ') + ' · ' + e.live.commits + ' commits · through ' + e.live.throughSeq;
|
|
677
677
|
}
|
|
678
678
|
return (e.table && e.rowId ? e.table + ' / ' + e.rowId + ' · ' : '') + SUMMARY_KEYS.filter(k => e[k] !== undefined).map(k => {
|
|
679
679
|
return k + ' ' + (typeof e[k] === 'string' ? e[k] : JSON.stringify(e[k]));
|
|
@@ -1002,13 +1002,13 @@ main{overflow:visible;padding:16px}
|
|
|
1002
1002
|
'<select class="inp" name="t" aria-label="Table">' + INFO.tables.map(t => '<option>' + esc(t.name) + '</option>').join('') + '</select>' +
|
|
1003
1003
|
'<input class="inp grow" name="r" placeholder="Row id" aria-label="Row id" spellcheck="false" /><button class="btn amber" type="submit">Trace</button></div></form></div></div>' +
|
|
1004
1004
|
'<div class="panel"><div class="ph"><h2>Failures and warnings</h2><span class="meta" id="client-fail-meta"></span></div><div id="client-fail"></div></div>' +
|
|
1005
|
-
'<div class="panel"><div class="ph"><h2>
|
|
1005
|
+
'<div class="panel"><div class="ph"><h2>Units</h2><span class="meta">' + c.units.length + '</span></div><div id="client-units"></div></div>' +
|
|
1006
1006
|
'<div class="panel"><div class="ph"><h2>Recent events</h2><span class="meta">' + d.events.length + '</span></div><div id="client-events"></div></div>');
|
|
1007
|
-
table('client-
|
|
1008
|
-
{ l: 'Id', c: 'w-sm', h:
|
|
1009
|
-
{ l: '
|
|
1010
|
-
{ l: '
|
|
1011
|
-
], c.
|
|
1007
|
+
table('client-units', [
|
|
1008
|
+
{ l: 'Id', c: 'w-sm', h: u => idCell(u.id) },
|
|
1009
|
+
{ l: 'Scopes', h: u => tags(Object.keys(u.scopes).map(k => k + ': ' + u.scopes[k])) },
|
|
1010
|
+
{ l: 'State', c: 'fill', h: u => u.catchingUpCursor === undefined ? st('ok', 'live') : st('warn', 'catching up') + ' <span class="dim">at ' + fmt(u.catchingUpCursor) + '</span>' }
|
|
1011
|
+
], c.units, empty('No units', 'The client record stores no registration list.', true));
|
|
1012
1012
|
table('client-events', EV_COLS, d.events, empty('No events', 'The ring holds no events for this client.', true), openEvent);
|
|
1013
1013
|
return loadFailures('client-fail', { clientId: id });
|
|
1014
1014
|
}, fail(['client-body']));
|
|
@@ -1036,11 +1036,9 @@ main{overflow:visible;padding:16px}
|
|
|
1036
1036
|
$('table-activity-panel').hidden = !sv;
|
|
1037
1037
|
var jobs = [(S.clients ? Promise.resolve() : loadClients()).then(() => get('/rows/' + enc(t), { limit: PAGE_ROWS, afterRowId: after, scope: scope })).then(r => {
|
|
1038
1038
|
var p = r.page, cols = schema ? schema.columns.filter(c => !c.primaryKey).slice(0, 4) : [];
|
|
1039
|
-
var seen = {}, chips = [];
|
|
1040
|
-
(
|
|
1041
|
-
|
|
1042
|
-
}));
|
|
1043
|
-
p.rows.forEach(row => Object.keys(row.scopes || {}).forEach(k => { seen[k + ':' + row.scopes[k]] = 1; }));
|
|
1039
|
+
var seen = {}, keys = {}, chips = [];
|
|
1040
|
+
p.rows.forEach(row => Object.keys(row.scopes || {}).forEach(k => { keys[k] = 1; seen[k + ':' + row.scopes[k]] = 1; }));
|
|
1041
|
+
(S.clients || []).forEach(c => c.units.forEach(u => Object.keys(u.scopes).forEach(k => { if (keys[k]) seen[k + ':' + u.scopes[k]] = 1; })));
|
|
1044
1042
|
chips = Object.keys(seen).sort().slice(0, 30);
|
|
1045
1043
|
html('table-scopes', 'Scope ' + link(route('table', [t]), 'all rows', 'tag' + (scope ? '' : ' on')) +
|
|
1046
1044
|
chips.map(k => link(route('table', [t, k]), k.replace(':', ': '), 'tag' + (k === scope ? ' on' : ''))).join(''));
|
|
@@ -1073,15 +1071,15 @@ main{overflow:visible;padding:16px}
|
|
|
1073
1071
|
}
|
|
1074
1072
|
var VERDICT = {
|
|
1075
1073
|
delivered: ['ok', 'Delivered', 'The client has pulled the row\\'s last change.'],
|
|
1076
|
-
'pending-pull': ['warn', 'Pending pull', 'A
|
|
1074
|
+
'pending-pull': ['warn', 'Pending pull', 'A unit covers the row, and the client\\'s cursor is behind the row\\'s last change. The next pull delivers it.'],
|
|
1077
1075
|
'row-deleted': ['warn', 'Row deleted', 'The row\\'s last change is a delete. A client that held the row drops it on its next pull.'],
|
|
1078
|
-
'scope-mismatch': ['err', 'Scope mismatch', '
|
|
1079
|
-
'scope-denied': ['err', 'Scope denied', 'A
|
|
1080
|
-
'no-
|
|
1076
|
+
'scope-mismatch': ['err', 'Scope mismatch', 'A unit of the client covers the table, but none carries the row\\'s scope values.'],
|
|
1077
|
+
'scope-denied': ['err', 'Scope denied', 'A unit carries the row\\'s scopes, but the actor\\'s allowed scopes from resolveScopes exclude them, so the server never delivers the row.'],
|
|
1078
|
+
'no-unit': ['idle', 'No unit', 'No unit of the client covers this table.'],
|
|
1081
1079
|
'client-unknown': ['err', 'Client unknown', 'This partition has no cursor record for the client.'],
|
|
1082
1080
|
'row-missing': ['err', 'Row missing', 'The partition holds no row with this id in this table.']
|
|
1083
1081
|
};
|
|
1084
|
-
var VORDER = ['row-missing', 'client-unknown', 'no-
|
|
1082
|
+
var VORDER = ['row-missing', 'client-unknown', 'no-unit', 'scope-denied', 'scope-mismatch', 'row-deleted', 'pending-pull', 'delivered'];
|
|
1085
1083
|
function verdictOf(v) { return VERDICT[v] || ['err', v, 'The console does not know this verdict.']; }
|
|
1086
1084
|
var HISTORY_COLS = [
|
|
1087
1085
|
{ l: 'Seq', c: 'num', d: -1, v: x => x.commitSeq, h: x => '<span class="ty">' + fmt(x.commitSeq) + '</span>' },
|
|
@@ -1137,14 +1135,14 @@ main{overflow:visible;padding:16px}
|
|
|
1137
1135
|
['Last change', lc ? seqBtn(lc.commitSeq) + ' ' + esc(lc.op) + ' by ' + esc(lc.actorId) + ' ' + ago(lc.createdAtMs) : '<span class="dim">none retained; horizon ' + fmt(x.horizonSeq) + '</span>'],
|
|
1138
1136
|
['Client', c ? clientLink(client) + ' · cursor ' + fmt(c.cursor) + ' · ' + presence(c) : st('err', 'unknown')],
|
|
1139
1137
|
['Allowed', x.allowed === undefined ? '<span class="dim">no resolver</span>' : x.allowed === 'outage' ? st('err', 'resolveScopes outage') : scopeTags(x.allowed)]]) +
|
|
1140
|
-
'<h3>
|
|
1141
|
-
table('m-
|
|
1142
|
-
{ l: 'Id', c: 'w-sm', h:
|
|
1143
|
-
{ l: '
|
|
1144
|
-
{ l: 'Requested', h:
|
|
1145
|
-
{ l: 'Allowed', h:
|
|
1146
|
-
{ l: 'Mismatches', c: 'fill', h:
|
|
1147
|
-
], x.
|
|
1138
|
+
'<h3>Units covering ' + esc(t) + ' · ' + x.units.length + '</h3><div id="m-units"></div><h3>Rejected pushes · ' + x.rejections.length + '</h3><div id="m-events"></div>', x);
|
|
1139
|
+
table('m-units', [
|
|
1140
|
+
{ l: 'Id', c: 'w-sm', h: u => idCell(u.id) },
|
|
1141
|
+
{ l: 'Scopes', h: u => tags(Object.keys(u.scopes).map(k => k + ': ' + u.scopes[k])) },
|
|
1142
|
+
{ l: 'Requested', h: u => u.requestedMatch ? st('ok', 'covers row') : st('err', 'mismatch') },
|
|
1143
|
+
{ l: 'Allowed', h: u => u.effectiveMatch === undefined ? '<span class="dim">not checked</span>' : u.effectiveMatch ? st('ok', 'covers row') : st('err', 'denied') },
|
|
1144
|
+
{ l: 'Mismatches', c: 'fill', h: u => u.mismatches.length ? tags(u.mismatches.map(m => m.variable + ': row ' + m.rowValue + ', requested ' + m.requested)) : '<span class="dim">none</span>' }
|
|
1145
|
+
], x.units, empty('No units', 'No unit of the client covers ' + esc(t) + '.', true));
|
|
1148
1146
|
table('m-events', EV_COLS, x.rejections, empty('No rejections', 'The ring holds no rejected or conflicted push for this row.', true), openEvent);
|
|
1149
1147
|
}, err => { if (token === modalToken && err !== STALE) fillModal(errBox(err), { code: err.code, message: err.message }); });
|
|
1150
1148
|
}
|
|
@@ -1182,7 +1180,7 @@ main{overflow:visible;padding:16px}
|
|
|
1182
1180
|
get('/writes/' + enc(id)).then(r => {
|
|
1183
1181
|
if (token !== modalToken) return;
|
|
1184
1182
|
var w = r.write;
|
|
1185
|
-
fillModal((w.outcomes.length ? '' : empty('No recorded outcome', 'No client has a stored outcome for this client commit id. The server never received it
|
|
1183
|
+
fillModal((w.outcomes.length ? '' : w.watermarks.length ? w.watermarks.map(m => '<h3>' + st('idle', 'expired') + ' · client ' + clientLink(m.clientId) + ' · outbox ' + idText(m.outboxId) + '</h3><p class="verdict">The outbox watermark deleted its result: expired below sequence ' + fmt(m.throughSeq) + '.</p>').join('') : empty('No recorded outcome', 'No client has a stored outcome for this client commit id, and no outbox watermark covers it. The server never received it.', true)) +
|
|
1186
1184
|
w.outcomes.map((o, i) => '<h3>' + (o.status === 'applied' ? st('ok', 'applied') : st('err', 'rejected')) + ' · client ' + clientLink(o.clientId) +
|
|
1187
1185
|
(o.commitSeq !== undefined ? ' · commit ' + seqBtn(o.commitSeq) : '') + (o.recordedAtMs ? ' · ' + ago(o.recordedAtMs) : '') + '</h3><div id="m-res-' + i + '"></div>').join('') +
|
|
1188
1186
|
'<h3>Ring events · ' + w.events.length + '</h3><div id="m-events"></div>', w);
|
|
@@ -1295,7 +1293,7 @@ main{overflow:visible;padding:16px}
|
|
|
1295
1293
|
{ l: 'Detail', c: 'fill', ns: true, h: detailCell }
|
|
1296
1294
|
];
|
|
1297
1295
|
// One row per sync request: every event of a request shares requestId.
|
|
1298
|
-
// An idle round pushed nothing and pulled no commit
|
|
1296
|
+
// An idle round pushed nothing and pulled no commit.
|
|
1299
1297
|
function groups(list) {
|
|
1300
1298
|
var by = {}, out = [];
|
|
1301
1299
|
list.forEach(e => {
|
|
@@ -1309,14 +1307,14 @@ main{overflow:visible;padding:16px}
|
|
|
1309
1307
|
g.level = g.events.reduce((l, e) => RANK[level(e)] < RANK[l] ? level(e) : l, 'info');
|
|
1310
1308
|
g.clientId = g.events.map(e => e.clientId).filter(Boolean)[0];
|
|
1311
1309
|
g.actorId = g.events.map(e => e.actorId).filter(Boolean)[0];
|
|
1312
|
-
g.idle = !!g.rh && g.level === 'info' && g.rh.pushCommits === 0 && g.events.every(e => e.type !== 'pull.served' || e.
|
|
1310
|
+
g.idle = !!g.rh && g.level === 'info' && g.rh.pushCommits === 0 && g.events.every(e => e.type !== 'pull.served' || !e.live.commits);
|
|
1313
1311
|
});
|
|
1314
1312
|
return out;
|
|
1315
1313
|
}
|
|
1316
1314
|
function groupSummary(g) {
|
|
1317
1315
|
if (!g.id) return summary(g.events[0]);
|
|
1318
1316
|
var pulled = 0, rh = g.rh;
|
|
1319
|
-
g.events.forEach(e => { if (e.type === 'pull.served')
|
|
1317
|
+
g.events.forEach(e => { if (e.type === 'pull.served') pulled += e.live.commits; });
|
|
1320
1318
|
var bad = g.events.filter(e => e.type === 'push.rejected' || e.type === 'push.conflicted');
|
|
1321
1319
|
return (rh ? rh.outcome + (rh.errorCode ? ' ' + rh.errorCode : '') + ' · ' + dur(rh.durationMs) + ' ms · ' + rh.pushCommits + ' pushed · ' : 'in flight · ') +
|
|
1322
1320
|
pulled + ' commits pulled' + (bad.length ? ' · ' + bad.map(e => e.type.slice(5) + (e.table ? ' ' + e.table + ' / ' + e.rowId : '')).join(', ') : '') + ' · ' + g.events.length + ' events';
|