@aquera/nile-elements 2.0.20 → 2.0.21

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.
Files changed (134) hide show
  1. package/README.md +3 -0
  2. package/dist/floating-ui.dom-9df9f37b.cjs.js +2 -0
  3. package/dist/floating-ui.dom-9df9f37b.cjs.js.map +1 -0
  4. package/dist/floating-ui.dom-c4ea6a32.esm.js +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.js +523 -486
  8. package/dist/nile-auto-complete/index.cjs.js +1 -1
  9. package/dist/nile-auto-complete/index.esm.js +1 -1
  10. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  11. package/dist/nile-auto-complete/nile-auto-complete.esm.js +1 -1
  12. package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
  13. package/dist/nile-auto-complete/portal-manager.esm.js +1 -1
  14. package/dist/nile-button/nile-button.cjs.js +1 -1
  15. package/dist/nile-button/nile-button.cjs.js.map +1 -1
  16. package/dist/nile-button/nile-button.css.cjs.js +1 -1
  17. package/dist/nile-button/nile-button.css.cjs.js.map +1 -1
  18. package/dist/nile-button/nile-button.css.esm.js +46 -9
  19. package/dist/nile-button/nile-button.esm.js +6 -6
  20. package/dist/nile-color-picker/index.cjs.js +1 -1
  21. package/dist/nile-color-picker/index.esm.js +1 -1
  22. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  23. package/dist/nile-color-picker/nile-color-picker.esm.js +1 -1
  24. package/dist/nile-combobox/index.cjs.js +1 -1
  25. package/dist/nile-combobox/index.esm.js +1 -1
  26. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  27. package/dist/nile-combobox/nile-combobox.esm.js +1 -1
  28. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  29. package/dist/nile-combobox/portal-manager.esm.js +1 -1
  30. package/dist/nile-dropdown/index.cjs.js +1 -1
  31. package/dist/nile-dropdown/index.esm.js +1 -1
  32. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  33. package/dist/nile-dropdown/nile-dropdown.esm.js +1 -1
  34. package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
  35. package/dist/nile-dropdown/portal-manager.esm.js +1 -1
  36. package/dist/nile-markdown-editor/index.cjs.js +1 -1
  37. package/dist/nile-markdown-editor/index.esm.js +1 -1
  38. package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
  39. package/dist/nile-markdown-editor/nile-markdown-editor.esm.js +1 -1
  40. package/dist/nile-popover/index.cjs.js +1 -1
  41. package/dist/nile-popover/index.esm.js +1 -1
  42. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  43. package/dist/nile-popover/nile-popover.esm.js +1 -1
  44. package/dist/nile-popover/portal-manager.cjs.js +1 -1
  45. package/dist/nile-popover/portal-manager.esm.js +1 -1
  46. package/dist/nile-popup/index.cjs.js +1 -1
  47. package/dist/nile-popup/index.esm.js +1 -1
  48. package/dist/nile-popup/nile-popup.cjs.js +1 -1
  49. package/dist/nile-popup/nile-popup.esm.js +1 -1
  50. package/dist/nile-select/index.cjs.js +1 -1
  51. package/dist/nile-select/index.esm.js +1 -1
  52. package/dist/nile-select/nile-select.cjs.js +1 -1
  53. package/dist/nile-select/nile-select.esm.js +1 -1
  54. package/dist/nile-select/portal-manager.cjs.js +1 -1
  55. package/dist/nile-select/portal-manager.esm.js +1 -1
  56. package/dist/nile-side-bar-action/index.cjs.js +1 -1
  57. package/dist/nile-side-bar-action/index.esm.js +1 -1
  58. package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
  59. package/dist/nile-side-bar-action/nile-side-bar-action.esm.js +1 -1
  60. package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
  61. package/dist/nile-side-bar-action/portal-manager.esm.js +1 -1
  62. package/dist/nile-tooltip/index.cjs.js +1 -1
  63. package/dist/nile-tooltip/index.esm.js +1 -1
  64. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  65. package/dist/nile-tooltip/nile-tooltip.esm.js +1 -1
  66. package/dist/nile-virtual-select/index.cjs.js +1 -1
  67. package/dist/nile-virtual-select/index.esm.js +1 -1
  68. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  69. package/dist/nile-virtual-select/nile-virtual-select.esm.js +1 -1
  70. package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
  71. package/dist/nile-virtual-select/portal-manager.esm.js +1 -1
  72. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  73. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  74. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  75. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +1 -1
  76. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
  77. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
  78. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
  79. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +1 -1
  80. package/dist/src/nile-button/nile-button.css.js +46 -9
  81. package/dist/src/nile-button/nile-button.css.js.map +1 -1
  82. package/dist/src/nile-button/nile-button.d.ts +2 -2
  83. package/dist/src/nile-button/nile-button.js +13 -5
  84. package/dist/src/nile-button/nile-button.js.map +1 -1
  85. package/dist/src/nile-button/nile-button.test.js +140 -2
  86. package/dist/src/nile-button/nile-button.test.js.map +1 -1
  87. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.d.ts +47 -0
  88. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.js +578 -0
  89. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.js.map +1 -0
  90. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.d.ts +3 -0
  91. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.js +109 -0
  92. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.js.map +1 -0
  93. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.d.ts +3 -0
  94. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.js +356 -0
  95. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.js.map +1 -0
  96. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.d.ts +4 -0
  97. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.js +339 -0
  98. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.js.map +1 -0
  99. package/dist/src/nile-date-time-picker/nile-date-time-picker.regressions.test.d.ts +3 -0
  100. package/dist/src/nile-date-time-picker/nile-date-time-picker.regressions.test.js +1472 -0
  101. package/dist/src/nile-date-time-picker/nile-date-time-picker.regressions.test.js.map +1 -0
  102. package/dist/src/nile-date-time-picker/nile-date-time-picker.test-helpers.d.ts +103 -0
  103. package/dist/src/nile-date-time-picker/nile-date-time-picker.test-helpers.js +331 -0
  104. package/dist/src/nile-date-time-picker/nile-date-time-picker.test-helpers.js.map +1 -0
  105. package/dist/src/nile-date-time-picker/nile-date-time-picker.test.d.ts +0 -140
  106. package/dist/src/nile-date-time-picker/nile-date-time-picker.test.js +1 -4495
  107. package/dist/src/nile-date-time-picker/nile-date-time-picker.test.js.map +1 -1
  108. package/dist/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.d.ts +3 -0
  109. package/dist/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.js +1440 -0
  110. package/dist/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.js.map +1 -0
  111. package/dist/src/version.js +1 -1
  112. package/dist/src/version.js.map +1 -1
  113. package/dist/tsconfig.tsbuildinfo +1 -1
  114. package/package.json +2 -2
  115. package/rollup.config.js +1 -0
  116. package/scripts/component-metrics.mjs +145 -0
  117. package/scripts/merge-coverage.cjs +33 -0
  118. package/src/nile-button/nile-button.css.ts +46 -9
  119. package/src/nile-button/nile-button.test.ts +162 -2
  120. package/src/nile-button/nile-button.ts +13 -4
  121. package/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.ts +607 -0
  122. package/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.ts +112 -0
  123. package/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.ts +389 -0
  124. package/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.ts +329 -0
  125. package/src/nile-date-time-picker/nile-date-time-picker.regressions.test.ts +1618 -0
  126. package/src/nile-date-time-picker/nile-date-time-picker.test-helpers.ts +381 -0
  127. package/src/nile-date-time-picker/nile-date-time-picker.test.ts +1 -4771
  128. package/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.ts +1499 -0
  129. package/test-timings.json +41 -0
  130. package/vscode-html-custom-data.json +19 -1
  131. package/web-test-runner.config.mjs +72 -2
  132. package/dist/floating-ui.dom-007bbe96.cjs.js +0 -2
  133. package/dist/floating-ui.dom-007bbe96.cjs.js.map +0 -1
  134. package/dist/floating-ui.dom-cc9126da.esm.js +0 -1
@@ -0,0 +1,112 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import './nile-date-time-picker';
3
+ import '../nile-calendar';
4
+ import '../nile-input';
5
+ import type { Tr } from './nile-date-time-picker.test-helpers';
6
+ import {
7
+ wallAt,
8
+ fmtWall,
9
+ makePicker,
10
+ checkPayload,
11
+ roundTrip,
12
+ instantsFor,
13
+ runtimeZones,
14
+ transitionShape,
15
+ selectAndApply,
16
+ HOST_TZ,
17
+ Failures,
18
+ allTransitions,
19
+ } from './nile-date-time-picker.test-helpers';
20
+
21
+ /*
22
+ * Section K (adversarial audit), part 2 of 4: PHASE 4 (every DST transition).
23
+ * Split out of nile-date-time-picker.test.ts so CI can run it on its own shard;
24
+ * helpers shared across the split files live in nile-date-time-picker.test-helpers.ts.
25
+ */
26
+
27
+ /* ==========================================================================
28
+ PART 6 — PHASE 4/5: DST transitions, gaps, overlaps
29
+ (was p4-dst.test.ts)
30
+ ========================================================================== */
31
+
32
+ describe('PHASE 4 — every DST transition, found programmatically', () => {
33
+ let transitions: Tr[] = [];
34
+ let zonesWithDst: string[] = [];
35
+
36
+ it('P4.0 discovers transitions across every runtime zone (2026)', () => {
37
+ const zones = runtimeZones();
38
+ transitions = allTransitions(zones);
39
+ zonesWithDst = Array.from(new Set(transitions.map(t => t.zone)));
40
+ const fwd = transitions.filter(x => transitionShape(x.t, x.zone).kind === 'forward').length;
41
+ // eslint-disable-next-line no-console
42
+ console.warn(`[audit-p4] host=${HOST_TZ} zonesScanned=${zones.length} ` +
43
+ `zonesWithTransitions=${zonesWithDst.length} transitions=${transitions.length} ` +
44
+ `forward=${fwd} backward=${transitions.length - fwd}`);
45
+ expect(transitions.length, 'must find real transitions').to.be.greaterThan(50);
46
+ }).timeout(300000);
47
+
48
+ it('P4.1 times around EVERY transition stay self-consistent and round-trip', async () => {
49
+ const f = new Failures();
50
+ let probes = 0;
51
+ for (const { zone, t } of transitions) {
52
+ // instants around the transition -> the zone's own wall clock -> select
53
+ for (const dt of [-2 * 3600000, -60000, 0, 60000, 2 * 3600000]) {
54
+ const inst = t + dt;
55
+ const w = wallAt(inst, zone);
56
+ // skip if these digits are ambiguous — covered deliberately in PHASE 5
57
+ if (instantsFor(w, zone).length !== 1) continue;
58
+ const el = await makePicker({});
59
+ const p = await selectAndApply(el, w, zone);
60
+ const ctx = `tz=${zone} t=${t} dt=${dt / 1000}s want=${fmtWall(w)}`;
61
+ f.add(ctx, checkPayload(p, zone));
62
+ if (p && p.unixEpoch !== null) {
63
+ if (p.unixEpoch !== inst) {
64
+ f.add(ctx, [{ code: 'P4_EPOCH_NE_INTENT', detail: `want=${inst} got=${p.unixEpoch} delta=${p.unixEpoch - inst}ms` }]);
65
+ }
66
+ f.add(ctx, (await roundTrip(p)).violations);
67
+ }
68
+ probes += 1;
69
+ }
70
+ }
71
+ // eslint-disable-next-line no-console
72
+ console.warn(`[audit-p4] around-transition probes=${probes} violations=${f.count}`);
73
+ expect(f.count, `transition violations:${f.report()}`).to.equal(0);
74
+ }).timeout(1800000);
75
+
76
+ it('P4.2 GAP: a nonexistent wall clock still emits a payload describing its own epoch', async () => {
77
+ const f = new Failures();
78
+ const notes: string[] = [];
79
+ let n = 0; let before = 0; let after = 0; const afterZones: string[] = [];
80
+ let posButBefore = 0; let negButAfter = 0;
81
+ for (const { zone, t } of transitions) {
82
+ const sh = transitionShape(t, zone);
83
+ if (sh.kind !== 'forward') continue;
84
+ const w = sh.insideWall;
85
+ if (instantsFor(w, zone).length !== 0) continue; // must truly be a gap
86
+ const el = await makePicker({});
87
+ const p = await selectAndApply(el, w, zone);
88
+ const ctx = `GAP tz=${zone} want=${fmtWall(w)} delta=${sh.deltaMs / 60000}min`;
89
+ // THE critical invariant: whatever it resolves to, the payload must be
90
+ // internally truthful about its own epoch.
91
+ f.add(ctx, checkPayload(p, zone));
92
+ if (p && p.unixEpoch !== null) {
93
+ f.add(ctx, (await roundTrip(p)).violations);
94
+ if (p.unixEpoch < t) { before += 1; if (sh.offBefore >= 0) posButBefore += 1; }
95
+ else { after += 1; afterZones.push(zone); if (sh.offBefore < 0) negButAfter += 1; }
96
+ if (n < 6) {
97
+ notes.push(`${zone}: ${fmtWall(w)} -> epoch=${p.unixEpoch} value=${p.value} ` +
98
+ `(lands ${p.unixEpoch < t ? 'BEFORE' : 'AFTER'} the gap)`);
99
+ }
100
+ }
101
+ n += 1;
102
+ }
103
+ // eslint-disable-next-line no-console
104
+ console.warn(`[audit-p4] gap probes=${n} violations=${f.count} ` +
105
+ `LANDS_BEFORE=${before} LANDS_AFTER=${after} ` +
106
+ `afterZonesSample=${afterZones.slice(0, 12).join(',')} ` +
107
+ `SIGN_CORRELATION: positiveOffsetYetBefore=${posButBefore} negativeOffsetYetAfter=${negButAfter} ` +
108
+ `(0/0 => direction is exactly the sign of the zone offset)` +
109
+ `\n ${notes.join('\n ')}`);
110
+ expect(f.count, `gap violations:${f.report()}`).to.equal(0);
111
+ }).timeout(1800000);
112
+ });
@@ -0,0 +1,389 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import './nile-date-time-picker';
3
+ import '../nile-calendar';
4
+ import '../nile-input';
5
+ import type { Wall, Payload } from './nile-date-time-picker.test-helpers';
6
+ import {
7
+ offsetAt,
8
+ wallAt,
9
+ parseBracketed,
10
+ fmtWall,
11
+ makePicker,
12
+ apply,
13
+ checkPayload,
14
+ roundTrip,
15
+ instantsFor,
16
+ runtimeZones,
17
+ transitionShape,
18
+ selectAndApply,
19
+ HOST_TZ,
20
+ Failures,
21
+ allTransitions,
22
+ } from './nile-date-time-picker.test-helpers';
23
+
24
+ /*
25
+ * Section K (adversarial audit), part 3 of 4: PHASE 5, 6, 7, 8, 9, 11.
26
+ * Split out of nile-date-time-picker.test.ts so CI can run it on its own shard;
27
+ * helpers shared across the split files live in nile-date-time-picker.test-helpers.ts.
28
+ */
29
+
30
+ describe('PHASE 5 — DST overlap: both occurrences must be reachable and distinct', () => {
31
+ it('P5.1 an ambiguous wall clock resolves to a stated occurrence, consistently', async () => {
32
+ const f = new Failures();
33
+ const zones = runtimeZones();
34
+ const trs = allTransitions(zones).filter(x => transitionShape(x.t, x.zone).kind === 'backward');
35
+ const notes: string[] = [];
36
+ let n = 0; let pickFirst = 0; let pickSecond = 0; const secondZones: string[] = [];
37
+ for (const { zone, t } of trs) {
38
+ const sh = transitionShape(t, zone);
39
+ const w: Wall = sh.insideWall;
40
+ const both = instantsFor(w, zone);
41
+ if (both.length !== 2) continue; // must truly be ambiguous
42
+
43
+ // (a) plain wall-clock selection picks ONE of them, and says so truthfully
44
+ const el = await makePicker({});
45
+ const p = await selectAndApply(el, w, zone);
46
+ const ctx = `OVERLAP tz=${zone} want=${fmtWall(w)}`;
47
+ f.add(ctx, checkPayload(p, zone));
48
+ if (p && p.unixEpoch !== null) {
49
+ if (both.indexOf(p.unixEpoch) === -1) {
50
+ f.add(ctx, [{
51
+ code: 'P5_NOT_AN_OCCURRENCE',
52
+ detail: `epoch=${p.unixEpoch} is neither ${both[0]} nor ${both[1]}`,
53
+ }]);
54
+ }
55
+ f.add(ctx, (await roundTrip(p)).violations);
56
+ }
57
+
58
+ // (b) the bracketed form with an EXPLICIT offset must select the intended
59
+ // occurrence — the two must not collapse onto one epoch.
60
+ const mk = (epoch: number) => {
61
+ const ww = wallAt(epoch, zone);
62
+ const off = offsetAt(epoch, zone);
63
+ const sign = off < 0 ? '-' : '+';
64
+ const a = Math.abs(off);
65
+ const hh = String(Math.floor(a / 3600000)).padStart(2, '0');
66
+ const mm = String(Math.floor((a % 3600000) / 60000)).padStart(2, '0');
67
+ return `${fmtWall(ww)}[GMT${sign}${hh}:${mm} ${zone}]`;
68
+ };
69
+ const v1 = mk(both[0]);
70
+ const v2 = mk(both[1]);
71
+ const e1 = await apply(await makePicker({ value: v1, timezone: zone }));
72
+ const e2 = await apply(await makePicker({ value: v2, timezone: zone }));
73
+ f.add(`${ctx} first`, checkPayload(e1));
74
+ f.add(`${ctx} second`, checkPayload(e2));
75
+ if (e1 && e2 && e1.unixEpoch !== null && e2.unixEpoch !== null) {
76
+ if (e1.unixEpoch !== both[0]) {
77
+ f.add(ctx, [{ code: 'P5_FIRST_OCCURRENCE_LOST', detail: `want=${both[0]} got=${e1.unixEpoch} from ${v1}` }]);
78
+ }
79
+ if (e2.unixEpoch !== both[1]) {
80
+ f.add(ctx, [{ code: 'P5_SECOND_OCCURRENCE_LOST', detail: `want=${both[1]} got=${e2.unixEpoch} from ${v2}` }]);
81
+ }
82
+ if (e1.unixEpoch === e2.unixEpoch) {
83
+ f.add(ctx, [{ code: 'P5_OCCURRENCES_COLLAPSED', detail: `both -> ${e1.unixEpoch}` }]);
84
+ }
85
+ }
86
+ if (p && p.unixEpoch !== null) {
87
+ if (p.unixEpoch === both[0]) pickFirst += 1;
88
+ else if (p.unixEpoch === both[1]) { pickSecond += 1; secondZones.push(zone); }
89
+ }
90
+ if (n < 5 && p) {
91
+ notes.push(`${zone}: ${fmtWall(w)} occurrences=[${both}] plainSelect=${p.unixEpoch} ` +
92
+ `(${p.unixEpoch === both[0] ? 'FIRST' : p.unixEpoch === both[1] ? 'SECOND' : 'NEITHER'})`);
93
+ }
94
+ n += 1;
95
+ }
96
+ // eslint-disable-next-line no-console
97
+ console.warn(`[audit-p5] overlap probed=${n} violations=${f.count} ` +
98
+ `PICKS_FIRST=${pickFirst} PICKS_SECOND=${pickSecond} ` +
99
+ `secondZonesSample=${secondZones.slice(0, 12).join(',')}\n ${notes.join('\n ')}`);
100
+ expect(n, 'must actually find overlaps to test').to.be.greaterThan(10);
101
+ expect(f.count, `overlap violations:${f.report()}`).to.equal(0);
102
+ }).timeout(1800000);
103
+ });
104
+
105
+ /* ==========================================================================
106
+ PART 8 — PHASE 6: host-timezone independence
107
+ (was p6-host.test.ts)
108
+ ========================================================================== */
109
+
110
+ type Case = { label: string; value?: string; tz: string; wall?: Wall };
111
+
112
+ const W = (year: number, month: number, day: number, hours: number,
113
+ minutes: number, seconds: number, ms: number): Wall =>
114
+ ({ year, month, day, hours, minutes, seconds, ms });
115
+
116
+ const CASES: Case[] = [
117
+ // ── instant-bearing: epoch MUST be identical on every host ──────────────
118
+ { label: 'Z-utc', value: '2026-06-15T09:00:00.000Z', tz: 'UTC' },
119
+ { label: 'Z-kolkata', value: '2026-06-15T09:00:00.000Z', tz: 'Asia/Kolkata' },
120
+ { label: 'Z-ny', value: '2026-06-15T09:00:00.000Z', tz: 'America/New_York' },
121
+ { label: 'Z-ms999', value: '2026-06-15T09:00:00.999Z', tz: 'Pacific/Chatham' },
122
+ { label: 'off+0530', value: '2026-06-15T14:30:00.000+05:30', tz: 'Asia/Kolkata' },
123
+ { label: 'off-0400', value: '2026-06-15T05:00:00.000-04:00', tz: 'America/New_York' },
124
+ { label: 'off+1400', value: '2026-06-15T23:00:00.000+14:00', tz: 'Pacific/Kiritimati' },
125
+ { label: 'brk-kolkata', value: '2026-06-15T14:30:00.000[GMT+05:30 Asia/Kolkata]', tz: 'Asia/Kolkata' },
126
+ { label: 'brk-alias', value: '2026-06-15T14:30:00.000[GMT+05:30 Asia/Calcutta]', tz: 'Asia/Calcutta' },
127
+ { label: 'brk-dst-1st', value: '2026-11-01T01:30:00.000[GMT-04:00 America/New_York]', tz: 'America/New_York' },
128
+ { label: 'brk-dst-2nd', value: '2026-11-01T01:30:00.000[GMT-05:00 America/New_York]', tz: 'America/New_York' },
129
+ { label: 'brk-lordhowe', value: '2026-06-15T14:30:00.000[GMT+10:30 Australia/Lord_Howe]', tz: 'Australia/Lord_Howe' },
130
+
131
+ // ── offset-less + date-only: component-zone semantics, also host-free ────
132
+ { label: 'offless-kolkata', value: '2026-06-15T14:30:00.000', tz: 'Asia/Kolkata' },
133
+ { label: 'offless-ny', value: '2026-06-15T14:30:00.000', tz: 'America/New_York' },
134
+ { label: 'offless-gap-ny', value: '2026-03-08T02:30:00.000', tz: 'America/New_York' },
135
+ { label: 'offless-overlap-ny', value: '2026-11-01T01:30:00.000', tz: 'America/New_York' },
136
+ { label: 'dateonly-kolkata', value: '2026-06-15', tz: 'Asia/Kolkata' },
137
+ { label: 'dateonly-kiritimati', value: '2026-06-15', tz: 'Pacific/Kiritimati' },
138
+
139
+ // ── UI-selected wall clocks in awkward zones ────────────────────────────
140
+ { label: 'sel-chatham', wall: W(2026, 9, 27, 3, 30, 0, 0), tz: 'Pacific/Chatham' },
141
+ { label: 'sel-lordhowe', wall: W(2026, 4, 5, 1, 30, 0, 0), tz: 'Australia/Lord_Howe' },
142
+ { label: 'sel-kathmandu', wall: W(2026, 6, 15, 14, 45, 7, 123), tz: 'Asia/Kathmandu' },
143
+ { label: 'sel-stjohns', wall: W(2026, 3, 8, 0, 30, 0, 0), tz: 'America/St_Johns' },
144
+ { label: 'sel-eucla', wall: W(2026, 12, 31, 23, 59, 59, 999), tz: 'Australia/Eucla' },
145
+ { label: 'sel-marquesas', wall: W(2026, 1, 1, 0, 0, 0, 1), tz: 'Pacific/Marquesas' },
146
+ ];
147
+
148
+ describe('PHASE 6 — host-timezone independence', () => {
149
+ it('P6.1 emits the cross-host digest and checks payload invariants locally', async () => {
150
+ const f = new Failures();
151
+ const lines: string[] = [];
152
+ for (const c of CASES) {
153
+ let p;
154
+ if (c.wall) {
155
+ const el = await makePicker({});
156
+ p = await selectAndApply(el, c.wall, c.tz);
157
+ } else {
158
+ const el = await makePicker({ value: c.value!, timezone: c.tz });
159
+ p = await apply(el);
160
+ }
161
+ f.add(`${c.label} host=${HOST_TZ}`, checkPayload(p));
162
+ lines.push(`P6|${c.label}|${p ? p.unixEpoch : 'NONE'}|${p ? p.timezone : 'NONE'}|${p ? p.value : 'NONE'}`);
163
+ }
164
+ // eslint-disable-next-line no-console
165
+ console.warn(`[audit-p6] host=${HOST_TZ}\n${lines.join('\n')}`);
166
+ expect(f.count, `host=${HOST_TZ} payload violations:${f.report()}`).to.equal(0);
167
+ }).timeout(900000);
168
+
169
+ it('P6.2 the oracle itself is host-independent (sanity on the measuring stick)', () => {
170
+ // If these differed by host, every other comparison would be meaningless.
171
+ const t = Date.UTC(2026, 5, 15, 9, 0, 0, 0);
172
+ const probe = [
173
+ instantsFor(W(2026, 6, 15, 14, 30, 0, 0), 'Asia/Kolkata').join(','),
174
+ instantsFor(W(2026, 3, 8, 2, 30, 0, 0), 'America/New_York').length,
175
+ instantsFor(W(2026, 11, 1, 1, 30, 0, 0), 'America/New_York').length,
176
+ fmtWall(W(2026, 6, 15, 14, 30, 0, 0)),
177
+ t,
178
+ ].join('|');
179
+ // eslint-disable-next-line no-console
180
+ console.warn(`[audit-p6-oracle] host=${HOST_TZ} digest=${probe}`);
181
+ expect(probe, 'Asia/Kolkata 14:30 == 09:00Z').to.contain('1781514000000');
182
+ });
183
+ });
184
+
185
+ /* ==========================================================================
186
+ PART 7 — PHASE 7/8/9/11/12: ms, boundaries, formats, round-trips, fuzzing
187
+ (was p7912-formats.test.ts)
188
+ ========================================================================== */
189
+
190
+ const ZONES = ['UTC', 'Asia/Kolkata', 'Asia/Kathmandu', 'America/New_York',
191
+ 'Australia/Lord_Howe', 'Pacific/Chatham', 'Pacific/Kiritimati', 'America/St_Johns'];
192
+
193
+ describe('PHASE 7 — milliseconds and precision', () => {
194
+ const MS = [0, 1, 9, 10, 99, 100, 250, 500, 999];
195
+
196
+ it('P7.1 every millisecond value survives select -> Apply -> reload -> Apply', async () => {
197
+ const f = new Failures();
198
+ for (const z of ZONES) {
199
+ for (const ms of MS) {
200
+ const w: Wall = { year: 2026, month: 6, day: 15, hours: 14, minutes: 30, seconds: 45, ms };
201
+ const el = await makePicker({});
202
+ const p = await selectAndApply(el, w, z);
203
+ const ctx = `tz=${z} ms=${ms}`;
204
+ f.add(ctx, checkPayload(p, z));
205
+ if (p && p.unixEpoch !== null) {
206
+ if (p.unixEpoch % 1000 !== ms) {
207
+ f.add(ctx, [{ code: 'P7_MS_LOST', detail: `epoch%1000=${p.unixEpoch % 1000} want=${ms} value=${p.value}` }]);
208
+ }
209
+ // ms must NOT contaminate the offset: +05:30 must never become +05:29
210
+ const off = offsetAt(p.unixEpoch, z);
211
+ if (off % 60000 !== 0) {
212
+ f.add(ctx, [{ code: 'P7_OFFSET_NOT_WHOLE_MINUTES', detail: `offset=${off}ms` }]);
213
+ }
214
+ const parsed = parseBracketed(p.value!);
215
+ if (parsed && parsed.offsetMs !== off) {
216
+ f.add(ctx, [{ code: 'P7_OFFSET_CONTAMINATED', detail: `printed=${parsed.offsetMs} true=${off}` }]);
217
+ }
218
+ f.add(ctx, (await roundTrip(p)).violations);
219
+ }
220
+ }
221
+ }
222
+ expect(f.count, `ms violations:${f.report()}`).to.equal(0);
223
+ }).timeout(600000);
224
+
225
+ it('P7.2 records CURRENT behaviour of 1- and 2-digit fractional seconds', async () => {
226
+ const notes: string[] = [];
227
+ for (const raw of ['2026-06-15T14:30:00.2', '2026-06-15T14:30:00.25',
228
+ '2026-06-15T14:30:00.250', '2026-06-15T14:30:00.2Z', '2026-06-15T14:30:00.25Z']) {
229
+ const el = await makePicker({ value: raw, timezone: 'Asia/Kolkata' });
230
+ const p = await apply(el);
231
+ notes.push(`${raw} -> epoch=${p && p.unixEpoch} ms=${p && p.unixEpoch !== null ? p.unixEpoch % 1000 : 'n/a'} value=${p && p.value}`);
232
+ }
233
+ // eslint-disable-next-line no-console
234
+ console.warn(`[audit-p7] fractional-second CURRENT behaviour:\n ${notes.join('\n ')}`);
235
+ expect(notes.length).to.equal(5);
236
+ }).timeout(120000);
237
+ });
238
+
239
+ describe('PHASE 8 — time boundaries, no accidental day rollover', () => {
240
+ const TIMES = [
241
+ [0, 0, 0, 0], [0, 0, 0, 1], [11, 59, 59, 999], [12, 0, 0, 0],
242
+ [23, 59, 59, 998], [23, 59, 59, 999],
243
+ ];
244
+ const DAYS: Array<[number, number, number, string]> = [
245
+ [2026, 6, 15, 'normal'], [2026, 1, 31, 'month-end'], [2026, 12, 31, 'year-end'],
246
+ [2024, 2, 29, 'leap-day'], [2026, 3, 8, 'US DST day'], [2026, 11, 1, 'US fall-back day'],
247
+ ];
248
+
249
+ it('P8.1 boundary times keep their calendar day (or truthfully report the shift)', async () => {
250
+ const f = new Failures();
251
+ for (const z of ['UTC', 'Asia/Kolkata', 'America/New_York', 'Pacific/Kiritimati']) {
252
+ for (const [y, mo, d, label] of DAYS) {
253
+ for (const [h, mi, s, ms] of TIMES) {
254
+ const w: Wall = { year: y, month: mo, day: d, hours: h, minutes: mi, seconds: s, ms };
255
+ const exists = instantsFor(w, z).length > 0;
256
+ const el = await makePicker({});
257
+ const p = await selectAndApply(el, w, z);
258
+ const ctx = `tz=${z} ${label} ${fmtWall(w)}`;
259
+ f.add(ctx, checkPayload(p, z));
260
+ if (p && p.unixEpoch !== null && exists) {
261
+ const back = wallAt(p.unixEpoch, z);
262
+ if (back.day !== d || back.month !== mo || back.year !== y) {
263
+ f.add(ctx, [{
264
+ code: 'P8_DAY_ROLLOVER',
265
+ detail: `selected ${y}-${mo}-${d} but epoch reads ${back.year}-${back.month}-${back.day} in ${z}`,
266
+ }]);
267
+ }
268
+ if (back.hours !== h || back.minutes !== mi || back.seconds !== s || back.ms !== ms) {
269
+ f.add(ctx, [{ code: 'P8_TIME_DRIFT', detail: `got ${fmtWall(back)}` }]);
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ expect(f.count, `boundary violations:${f.report()}`).to.equal(0);
276
+ }).timeout(900000);
277
+ });
278
+
279
+ describe('PHASE 9 — input format matrix', () => {
280
+ type Row = { label: string; value: string | null; tz: string; validInstant?: number };
281
+
282
+ it('P9.1 valid inputs preserve their instant through reload', async () => {
283
+ const f = new Failures();
284
+ const rows: Row[] = [
285
+ { label: 'Z', value: '2026-06-15T09:00:00.000Z', tz: 'Asia/Kolkata', validInstant: Date.UTC(2026, 5, 15, 9) },
286
+ { label: '+offset', value: '2026-06-15T14:30:00.000+05:30', tz: 'Asia/Kolkata', validInstant: Date.UTC(2026, 5, 15, 9) },
287
+ { label: '-offset', value: '2026-06-15T05:00:00.000-04:00', tz: 'America/New_York', validInstant: Date.UTC(2026, 5, 15, 9) },
288
+ { label: 'bracketed UTC', value: '2026-06-15T09:00:00.000[GMT+00:00 UTC]', tz: 'UTC' },
289
+ { label: 'bracketed +', value: '2026-06-15T14:30:00.000[GMT+05:30 Asia/Kolkata]', tz: 'Asia/Kolkata' },
290
+ { label: 'bracketed -', value: '2026-06-15T05:00:00.000[GMT-04:00 America/New_York]', tz: 'America/New_York' },
291
+ { label: 'alias', value: '2026-06-15T14:30:00.000[GMT+05:30 Asia/Calcutta]', tz: 'Asia/Calcutta' },
292
+ { label: 'offset-less', value: '2026-06-15T14:30:00.000', tz: 'Asia/Kolkata' },
293
+ { label: 'date-only', value: '2026-06-15', tz: 'Asia/Kolkata' },
294
+ { label: 'DST 1st occ', value: '2026-11-01T01:30:00.000[GMT-04:00 America/New_York]', tz: 'America/New_York' },
295
+ { label: 'DST 2nd occ', value: '2026-11-01T01:30:00.000[GMT-05:00 America/New_York]', tz: 'America/New_York' },
296
+ ];
297
+ const notes: string[] = [];
298
+ for (const r of rows) {
299
+ const el = await makePicker({ value: r.value, timezone: r.tz });
300
+ const p = await apply(el);
301
+ const ctx = `${r.label} value=${r.value}`;
302
+ f.add(ctx, checkPayload(p));
303
+ if (r.validInstant !== undefined && p && p.unixEpoch !== r.validInstant) {
304
+ f.add(ctx, [{ code: 'P9_INSTANT_CHANGED', detail: `want=${r.validInstant} got=${p.unixEpoch}` }]);
305
+ }
306
+ if (p && p.unixEpoch !== null) f.add(ctx, (await roundTrip(p)).violations);
307
+ notes.push(`${r.label.padEnd(14)} -> epoch=${p && p.unixEpoch} tz=${p && p.timezone} value=${p && p.value}`);
308
+ }
309
+ // eslint-disable-next-line no-console
310
+ console.warn(`[audit-p9] valid-input matrix:\n ${notes.join('\n ')}`);
311
+ expect(f.count, `format-matrix violations:${f.report()}`).to.equal(0);
312
+ }).timeout(600000);
313
+
314
+ it('P9.2 classifies INVALID / edge inputs (REJECT / FALLBACK / CLAMP / NORMALIZE)', async () => {
315
+ const rows: Array<{ label: string; value: string | null; tz: string }> = [
316
+ { label: 'null', value: null, tz: 'Asia/Kolkata' },
317
+ { label: 'empty string', value: '', tz: 'Asia/Kolkata' },
318
+ { label: 'malformed', value: 'not-a-date', tz: 'Asia/Kolkata' },
319
+ { label: 'impossible date', value: '2026-02-31T10:00:00.000', tz: 'Asia/Kolkata' },
320
+ { label: 'impossible date-only', value: '2026-02-31', tz: 'Asia/Kolkata' },
321
+ { label: 'invalid tz in bracket', value: '2026-06-15T14:30:00.000[GMT+05:30 Mars/Phobos]', tz: 'UTC' },
322
+ { label: 'wrong offset for zone', value: '2026-06-15T14:30:00.000[GMT+09:00 Asia/Kolkata]', tz: 'Asia/Kolkata' },
323
+ { label: 'gap wall clock', value: '2026-03-08T02:30:00.000', tz: 'America/New_York' },
324
+ { label: 'hour 24', value: '2026-06-15T24:00:00.000', tz: 'UTC' },
325
+ { label: 'month 13', value: '2026-13-15T10:00:00.000', tz: 'UTC' },
326
+ { label: 'year 0001', value: '0001-01-01T00:00:00.000Z', tz: 'UTC' },
327
+ { label: 'year 9999', value: '9999-12-31T23:59:59.999Z', tz: 'UTC' },
328
+ ];
329
+ const notes: string[] = [];
330
+ const f = new Failures();
331
+ // An empty / unparseable value leaves NO selection, and Apply is a no-op without a selection (handleApply →
332
+ // hasSelection()), so these must emit NOTHING. Every other row resolves to an instant and must emit a payload.
333
+ const EMITS_NOTHING = new Set(['null', 'empty string', 'malformed', 'month 13']);
334
+ for (const r of rows) {
335
+ const el = await makePicker({ value: r.value, timezone: r.tz });
336
+ const p = await apply(el);
337
+ if (EMITS_NOTHING.has(r.label)) {
338
+ if (p !== null) f.add(`${r.label} value=${r.value}`, [{ code: 'P9_EMITTED_FOR_NO_SELECTION', detail: `emitted ${JSON.stringify(p)}` }]);
339
+ notes.push(`${r.label.padEnd(22)} NO_PAYLOAD (expected)`);
340
+ continue;
341
+ }
342
+ // Whatever it does, the payload must never LIE about its own epoch.
343
+ f.add(`${r.label} value=${r.value}`, checkPayload(p));
344
+ const cls = p === null ? 'NO_PAYLOAD'
345
+ : p.unixEpoch === null ? 'REJECT(null epoch)'
346
+ : 'ACCEPTED';
347
+ notes.push(`${r.label.padEnd(22)} ${cls.padEnd(20)} epoch=${p && p.unixEpoch} tz=${p && p.timezone} value=${p && p.value}`);
348
+ }
349
+ // eslint-disable-next-line no-console
350
+ console.warn(`[audit-p9] invalid/edge input classification:\n ${notes.join('\n ')}`);
351
+ expect(f.count, `invalid-input payload lies:${f.report()}`).to.equal(0);
352
+ }).timeout(600000);
353
+ });
354
+
355
+ describe('PHASE 11 — repeated round trips must not drift', () => {
356
+ it('P11.1 100 consecutive emit->reload->Apply cycles hold the epoch to the ms', async () => {
357
+ const f = new Failures();
358
+ const seeds: Array<{ label: string; value: string; tz: string }> = [
359
+ { label: 'ms=999 half-hour zone', value: '2026-06-15T14:30:45.999[GMT+05:30 Asia/Kolkata]', tz: 'Asia/Kolkata' },
360
+ { label: 'quarter-hour zone', value: '2026-06-15T14:30:45.001[GMT+05:45 Asia/Kathmandu]', tz: 'Asia/Kathmandu' },
361
+ { label: 'alias', value: '2026-06-15T14:30:45.123[GMT+05:30 Asia/Calcutta]', tz: 'Asia/Calcutta' },
362
+ { label: 'DST overlap 2nd', value: '2026-11-01T01:30:00.000[GMT-05:00 America/New_York]', tz: 'America/New_York' },
363
+ { label: 'DST gap resolved', value: '2026-03-08T03:30:00.000[GMT-04:00 America/New_York]', tz: 'America/New_York' },
364
+ { label: '+14 extreme', value: '2026-06-15T14:30:45.500[GMT+14:00 Pacific/Kiritimati]', tz: 'Pacific/Kiritimati' },
365
+ { label: 'negative extreme', value: '2026-06-15T14:30:45.500[GMT-11:00 Pacific/Niue]', tz: 'Pacific/Niue' },
366
+ { label: 'Lord Howe :30', value: '2026-06-15T14:30:45.250[GMT+10:30 Australia/Lord_Howe]', tz: 'Australia/Lord_Howe' },
367
+ ];
368
+ for (const s of seeds) {
369
+ let cur: Payload | null = await apply(await makePicker({ value: s.value, timezone: s.tz }));
370
+ if (!cur || cur.unixEpoch === null) { f.add(s.label, [{ code: 'P11_NO_SEED', detail: s.value }]); continue; }
371
+ const first = cur.unixEpoch;
372
+ for (let i = 0; i < 100; i++) {
373
+ const next: Payload | null = await apply(await makePicker({ value: cur!.value, timezone: cur!.timezone }));
374
+ f.add(`${s.label} iter=${i}`, checkPayload(next));
375
+ if (!next || next.unixEpoch !== first) {
376
+ f.add(s.label, [{
377
+ code: 'P11_DRIFT',
378
+ detail: `iter=${i} first=${first} now=${next && next.unixEpoch} delta=${next && next.unixEpoch !== null ? next.unixEpoch - first : 'n/a'}ms`,
379
+ }]);
380
+ break;
381
+ }
382
+ cur = next;
383
+ }
384
+ }
385
+ // eslint-disable-next-line no-console
386
+ console.warn(`[audit-p11] 8 seeds x 100 cycles, violations=${f.count}`);
387
+ expect(f.count, `round-trip drift:${f.report()}`).to.equal(0);
388
+ }).timeout(1800000);
389
+ });