kryptheon 0.1.44 → 0.1.47
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/README.md +72 -0
- package/bin/kryptheon.js +3462 -3242
- package/kryptheon-dashboard-page.js +116 -11
- package/kryptheon-dashboard.html +8 -2
- package/kryptheon-dashboard.js +1132 -1009
- package/kryptheon-edge.js +792 -0
- package/kryptheon-look.js +1 -1
- package/kryptheon-probe-fixture.js +303 -0
- package/kryptheon-probe-reporter.js +29 -0
- package/kryptheon-probe.config.js +37 -0
- package/kryptheon-probe.js +317 -0
- package/kryptheon-reliability.js +599 -0
- package/kryptheon-replay.js +0 -0
- package/package.json +12 -4
|
@@ -203,6 +203,26 @@
|
|
|
203
203
|
head.appendChild(el('b', null, job.title));
|
|
204
204
|
head.appendChild(el('span', 'tag ' + (job.running ? 'sun' : ok ? 'leaf' : 'ember'),
|
|
205
205
|
job.running ? 'running' : ok ? 'finished' : 'did not finish'));
|
|
206
|
+
if (job.running && job.stoppable) {
|
|
207
|
+
// A run that adds data to the app can be ended part way. What it
|
|
208
|
+
// finished is kept and said; the rest is said as not tested.
|
|
209
|
+
var stop = el('button', 'job-close', job.stopping ? 'Stopping...' : 'Stop');
|
|
210
|
+
stop.type = 'button';
|
|
211
|
+
stop.disabled = !!job.stopping;
|
|
212
|
+
// On the press itself, not the click: the panel is redrawn while the
|
|
213
|
+
// run goes, and a click whose press and release land on two drawings
|
|
214
|
+
// of the button is lost - measured, on this panel.
|
|
215
|
+
var stopNow = function (e) {
|
|
216
|
+
if (e) e.preventDefault();
|
|
217
|
+
if (stop.disabled) return;
|
|
218
|
+
stop.disabled = true;
|
|
219
|
+
stop.textContent = 'Stopping...';
|
|
220
|
+
post('/api/stop', {}).catch(function (err) { toast('Could not stop: ' + err.message); });
|
|
221
|
+
};
|
|
222
|
+
stop.addEventListener('mousedown', stopNow);
|
|
223
|
+
stop.addEventListener('click', stopNow);
|
|
224
|
+
head.appendChild(stop);
|
|
225
|
+
}
|
|
206
226
|
if (!job.running) {
|
|
207
227
|
var close = el('button', 'job-close', 'Close');
|
|
208
228
|
close.type = 'button';
|
|
@@ -272,7 +292,9 @@
|
|
|
272
292
|
return new Promise(function (resolve) {
|
|
273
293
|
(function tick() {
|
|
274
294
|
getJob().then(function (now) {
|
|
275
|
-
|
|
295
|
+
// Drawn again only when something in it changed, so a button in it
|
|
296
|
+
// stays the same button between presses.
|
|
297
|
+
if (now && JSON.stringify(now) !== JSON.stringify(job)) { job = now; renderJob(); }
|
|
276
298
|
if (now && now.running) setTimeout(tick, 700);
|
|
277
299
|
else resolve(now);
|
|
278
300
|
}, function () { setTimeout(tick, 1500); });
|
|
@@ -280,8 +302,8 @@
|
|
|
280
302
|
});
|
|
281
303
|
}
|
|
282
304
|
|
|
283
|
-
var CHECK_NAME = { regression: 'Recorded flows', frontend: 'Frontend code', data: 'Database' };
|
|
284
|
-
var CHECK_TONE = { regression: 'sun', frontend: 'amber', data: 'dusk' };
|
|
305
|
+
var CHECK_NAME = { regression: 'Recorded flows', frontend: 'Frontend code', data: 'Database', edge: 'Input and edge cases', reliability: 'Reliability' };
|
|
306
|
+
var CHECK_TONE = { regression: 'sun', frontend: 'amber', data: 'dusk', edge: 'ember', reliability: 'ember' };
|
|
285
307
|
|
|
286
308
|
function counts() {
|
|
287
309
|
var confirmed = state.findings.filter(function (f) { return f.status === 'confirmed'; }).length;
|
|
@@ -351,7 +373,7 @@
|
|
|
351
373
|
var built = state.checks.filter(function (x) { return x.available; }).length;
|
|
352
374
|
byId('builtText').textContent = built + ' / ' + state.checks.length;
|
|
353
375
|
byId('builtBar').style.width = Math.round((built / state.checks.length) * 100) + '%';
|
|
354
|
-
byId('builtNote').textContent = (state.checks.length - built) + ' more are
|
|
376
|
+
byId('builtNote').textContent = (state.checks.length - built) + ' more are coming soon - never shown as passed.';
|
|
355
377
|
var name = state.project.name || 'Project';
|
|
356
378
|
var last = (state.looks || [])[0];
|
|
357
379
|
byId('subline').textContent = name + ' - ' + (last ? 'watching, last look ' + ago(last.at) : 'watching for changes');
|
|
@@ -845,7 +867,13 @@
|
|
|
845
867
|
head.appendChild(icon(openRow === f.id ? 'change' : 'arrow', 18));
|
|
846
868
|
head.addEventListener('click', function () { openRow = openRow === f.id ? null : f.id; renderFindings(); });
|
|
847
869
|
card.appendChild(head);
|
|
848
|
-
if (
|
|
870
|
+
if (probeAsking && probeAsking.finding && probeAsking.finding.id === f.id) {
|
|
871
|
+
var askingProbe = el('div', 'controls f-quick');
|
|
872
|
+
askingProbe.appendChild(probeConsentBox(probeAsking.check, 'Yes, try it again', function (body) {
|
|
873
|
+
runJob('/api/recheck', Object.assign({ id: f.id }, body)).then(function (done) { heard(f, (done && done.result) || {}); }, function () {});
|
|
874
|
+
}, RECHECK_WORDS[f.check === 'reliability' ? f.kind : 'edge']));
|
|
875
|
+
card.appendChild(askingProbe);
|
|
876
|
+
} else if (pending && pending.step === 'finding' && pending.finding && pending.finding.id === f.id) {
|
|
849
877
|
var asking = el('div', 'controls f-quick');
|
|
850
878
|
asking.appendChild(consentBox('Yes, check it again', pending.words.consent));
|
|
851
879
|
card.appendChild(asking);
|
|
@@ -920,14 +948,60 @@
|
|
|
920
948
|
});
|
|
921
949
|
}
|
|
922
950
|
|
|
923
|
-
var STATE_TONE = { 'problems found': 'ember', 'things to check': 'amber', 'last run held': 'leaf', 'nothing found': 'leaf' };
|
|
951
|
+
var STATE_TONE = { 'problems found': 'ember', 'things to check': 'amber', 'last run held': 'leaf', 'nothing found': 'leaf', 'stopped part way': 'amber', 'nothing was tested': 'amber' };
|
|
952
|
+
var PROBE_LABEL = { edge: 'Try inputs - adds test data', reliability: 'Replay 3x - adds test data' };
|
|
953
|
+
// What one re-check press does, said before the yes.
|
|
954
|
+
var RECHECK_WORDS = {
|
|
955
|
+
edge: 'Re-check: replays this flow as recorded, then once more with the value that found this. Two runs.',
|
|
956
|
+
flaky: 'Re-check: replays this flow five times. It is fixed only if all five work.',
|
|
957
|
+
double: 'Re-check: replays this flow once, then once more with this step double-clicked. Two runs.',
|
|
958
|
+
};
|
|
959
|
+
|
|
960
|
+
// Which probe check is asking for a yes right now, and for which finding
|
|
961
|
+
// when it is a re-check. Nothing that adds data to the app runs without it.
|
|
962
|
+
var probeAsking = null;
|
|
963
|
+
function probeConsentBox(id, yesLabel, onYes, what) {
|
|
964
|
+
var check = state.checks.filter(function (c) { return c.id === id; })[0];
|
|
965
|
+
var asks = check && check.asks;
|
|
966
|
+
var box = el('div', 'consent');
|
|
967
|
+
box.appendChild(el('div', 'd-step', 'THIS ADDS TEST DATA TO YOUR APP'));
|
|
968
|
+
// The first line says what this press does; the rest - where, and what
|
|
969
|
+
// it leaves behind - is the same for the check and for a re-check.
|
|
970
|
+
var lines = ((asks && asks.lines) || []).slice();
|
|
971
|
+
if (what && lines.length) lines[0] = what;
|
|
972
|
+
box.appendChild(linesBox(asks && asks.live.length ? 'warn' : 'help', lines));
|
|
973
|
+
var tick = null;
|
|
974
|
+
if (asks && asks.live.length) {
|
|
975
|
+
var label = el('label', 'tick');
|
|
976
|
+
tick = el('input');
|
|
977
|
+
tick.type = 'checkbox';
|
|
978
|
+
label.appendChild(tick);
|
|
979
|
+
label.appendChild(document.createTextNode(' ' + asks.live.join(', ') + ' is my own test copy, not the live app real people use'));
|
|
980
|
+
box.appendChild(label);
|
|
981
|
+
}
|
|
982
|
+
var row = el('div', 'd-actions');
|
|
983
|
+
var yes = button('sun sm', 'check', yesLabel, function () {
|
|
984
|
+
if (tick && !tick.checked) { toast('Tick that it is your own test copy first - or run it against your app on this computer.'); return; }
|
|
985
|
+
var body = { consent: true, liveConfirmed: tick ? tick.checked : false };
|
|
986
|
+
probeAsking = null;
|
|
987
|
+
renderChecks();
|
|
988
|
+
renderFindings();
|
|
989
|
+
onYes(body);
|
|
990
|
+
});
|
|
991
|
+
yes.setAttribute('data-action', 'probe');
|
|
992
|
+
yes.disabled = busy;
|
|
993
|
+
row.appendChild(yes);
|
|
994
|
+
row.appendChild(button('sm', null, 'Cancel', function () { probeAsking = null; renderChecks(); renderFindings(); }));
|
|
995
|
+
box.appendChild(row);
|
|
996
|
+
return box;
|
|
997
|
+
}
|
|
924
998
|
function checkSwitch(c) {
|
|
925
999
|
var sw = el('label', 'switch');
|
|
926
1000
|
var input = el('input');
|
|
927
1001
|
input.type = 'checkbox';
|
|
928
1002
|
input.checked = !!c.enabled;
|
|
929
1003
|
input.disabled = !c.available;
|
|
930
|
-
input.setAttribute('aria-label', c.label + (c.available ? '' : ' -
|
|
1004
|
+
input.setAttribute('aria-label', c.label + (c.available ? '' : ' - coming soon'));
|
|
931
1005
|
input.addEventListener('change', function () { setCheck(c.id, input.checked, input); });
|
|
932
1006
|
sw.appendChild(input);
|
|
933
1007
|
sw.appendChild(el('span', 'track'));
|
|
@@ -945,7 +1019,7 @@
|
|
|
945
1019
|
var row = el('div', 'na');
|
|
946
1020
|
row.appendChild(checkSwitch(c));
|
|
947
1021
|
var nm = el('div', null, c.label);
|
|
948
|
-
nm.appendChild(el('span', 'na-lock', '
|
|
1022
|
+
nm.appendChild(el('span', 'na-lock', 'COMING SOON'));
|
|
949
1023
|
row.appendChild(nm);
|
|
950
1024
|
na.appendChild(row);
|
|
951
1025
|
return;
|
|
@@ -962,7 +1036,27 @@
|
|
|
962
1036
|
// What the nightly run inside the database last said - its own answer,
|
|
963
1037
|
// not this terminal's, so it gets its own line.
|
|
964
1038
|
if (c.nightly) card.appendChild(el('div', 'c-what', c.nightly));
|
|
965
|
-
if (c.
|
|
1039
|
+
if (c.lastRun) {
|
|
1040
|
+
var lr = c.lastRun;
|
|
1041
|
+
card.appendChild(el('div', 'c-what', 'Last pressed ' + ago(lr.at) + ': ' + lr.runsDone + ' of ' + lr.runsPlanned + ' runs' +
|
|
1042
|
+
(lr.stopped ? ' (stopped)' : '') + ', ' + lr.held + ' held, ' + lr.notTested + ' not tested, ' +
|
|
1043
|
+
plural(lr.testData, 'test write') + ' left in your app.'));
|
|
1044
|
+
}
|
|
1045
|
+
if (c.asks && c.enabled) {
|
|
1046
|
+
if (probeAsking && probeAsking.check === c.id && !probeAsking.finding) {
|
|
1047
|
+
card.appendChild(probeConsentBox(c.id, 'Yes, add test data and run', function (body) {
|
|
1048
|
+
runJob('/api/probe', Object.assign({ id: c.id }, body)).then(function (done) {
|
|
1049
|
+
var r = (done && done.result) || {};
|
|
1050
|
+
toast(r.ok ? 'Finished: ' + (r.summary || 'done') : 'It could not finish' + (r.why ? ' - ' + r.why : ''));
|
|
1051
|
+
}, function () {});
|
|
1052
|
+
}));
|
|
1053
|
+
} else {
|
|
1054
|
+
var tryIt = button('sm', 'play', PROBE_LABEL[c.id] || 'Run it', function () { probeAsking = { check: c.id }; renderChecks(); });
|
|
1055
|
+
tryIt.setAttribute('data-action', 'probe');
|
|
1056
|
+
tryIt.disabled = busy;
|
|
1057
|
+
card.appendChild(withCommand(tryIt, 'npx kryptheon ' + c.id));
|
|
1058
|
+
}
|
|
1059
|
+
} else if (c.runnable && c.enabled) {
|
|
966
1060
|
var run = button('sm', 'play', 'Run now', function () { runChecks([c.id], run); });
|
|
967
1061
|
run.setAttribute('data-action', 'run');
|
|
968
1062
|
run.disabled = busy;
|
|
@@ -1030,6 +1124,9 @@
|
|
|
1030
1124
|
// A database finding is re-checked in the database: the same check, the
|
|
1031
1125
|
// same yes first, then this one finding judged.
|
|
1032
1126
|
if (f.check === 'data') { prepare('recheck', 'finding', f); return; }
|
|
1127
|
+
// An input finding is re-checked by typing its value again, which adds
|
|
1128
|
+
// test data to the app: the same yes as the check's own button, first.
|
|
1129
|
+
if (f.check === 'edge' || f.check === 'reliability') { probeAsking = { check: f.check, finding: f }; openRow = null; renderFindings(); return; }
|
|
1033
1130
|
runJob('/api/recheck', { id: f.id }).then(function (done) { heard(f, (done && done.result) || {}); }, function () {});
|
|
1034
1131
|
}
|
|
1035
1132
|
function heard(f, r) {
|
|
@@ -1190,7 +1287,15 @@
|
|
|
1190
1287
|
function load() {
|
|
1191
1288
|
return fetch('/api/state', { cache: 'no-store' })
|
|
1192
1289
|
.then(function (res) { if (!res.ok) throw new Error('the dashboard answered ' + res.status); return res.json(); })
|
|
1193
|
-
.then(
|
|
1290
|
+
.then(function (next) {
|
|
1291
|
+
// Drawn again only when something changed: a redraw every few
|
|
1292
|
+
// seconds replaced every button under the pointer, and a press that
|
|
1293
|
+
// landed on two drawings of one button was lost.
|
|
1294
|
+
var text = JSON.stringify(next);
|
|
1295
|
+
if (text === load.last) return;
|
|
1296
|
+
load.last = text;
|
|
1297
|
+
render(next);
|
|
1298
|
+
})
|
|
1194
1299
|
.catch(function (err) { byId('subline').textContent = 'Could not load: ' + err.message; });
|
|
1195
1300
|
}
|
|
1196
1301
|
|
|
@@ -1212,6 +1317,6 @@
|
|
|
1212
1317
|
// while a yes is being asked for, and not while someone is typing.
|
|
1213
1318
|
setInterval(function () {
|
|
1214
1319
|
var typing = document.activeElement === dbInput || document.activeElement === recordInput;
|
|
1215
|
-
if (!busy && !openRow && !pending && !typing) load();
|
|
1320
|
+
if (!busy && !openRow && !pending && !probeAsking && !typing) load();
|
|
1216
1321
|
}, 5000);
|
|
1217
1322
|
})();
|
package/kryptheon-dashboard.html
CHANGED
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
.detail-box { margin: 0 8px 22px 20px; padding: 18px 0 0; border-top: 1px dashed var(--line); }
|
|
213
213
|
.d-step { margin-top: 18px; font-size: 10px; color: var(--orange-deep); }
|
|
214
214
|
.d-step:first-child { margin-top: 0; }
|
|
215
|
-
.d-text { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
|
|
215
|
+
.d-text { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
|
|
216
216
|
.detail-box pre { max-height: 360px; margin: 10px 0 0; padding: 18px; overflow: auto; font: 12px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--on-dark); background: var(--ink); }
|
|
217
217
|
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
|
|
218
218
|
.attempts { display: grid; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--muted); }
|
|
@@ -302,6 +302,12 @@
|
|
|
302
302
|
.controls pre.help { color: var(--on-light); background: rgba(18, 22, 29, 0.05); border-left: 2px solid var(--on-light); }
|
|
303
303
|
.controls pre.warn { color: var(--orange-deep); background: rgba(255, 77, 0, 0.06); border-left: 2px solid var(--orange); }
|
|
304
304
|
.consent { display: grid; gap: 10px; }
|
|
305
|
+
.check .consent { margin-top: 12px; }
|
|
306
|
+
.consent pre { margin: 0; padding: 14px 16px; font: 12px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
307
|
+
.consent pre.help { color: var(--on-light); background: rgba(18, 22, 29, 0.05); border-left: 2px solid var(--on-light); }
|
|
308
|
+
.consent pre.warn { color: var(--orange-deep); background: rgba(255, 77, 0, 0.06); border-left: 2px solid var(--orange); }
|
|
309
|
+
.consent .tick { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
|
|
310
|
+
.consent .tick input { margin-top: 3px; }
|
|
305
311
|
.act { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }
|
|
306
312
|
.act .btn, .step .act .btn { margin-top: 0; }
|
|
307
313
|
.step .act { margin-top: 14px; }
|
|
@@ -419,7 +425,7 @@
|
|
|
419
425
|
<section class="view" id="view-checks" hidden>
|
|
420
426
|
<div class="check-grid" id="checkList"></div>
|
|
421
427
|
<div class="card gap">
|
|
422
|
-
<div class="card-head"><div><h3>
|
|
428
|
+
<div class="card-head"><div><h3>Coming soon</h3><div class="c-sub">Being built, in this order - never shown as passed</div></div><span class="badge" id="naBadge">0</span></div>
|
|
423
429
|
<div class="na-grid" id="naList"></div>
|
|
424
430
|
</div>
|
|
425
431
|
</section>
|