@celestia-island/hikari 0.55.133 → 0.55.134
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/package.json
CHANGED
|
@@ -63,6 +63,40 @@ afterEach(() => {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
describe("HkStatusBar", () => {
|
|
66
|
+
it("suppresses a build hash the version line already shows, keeps drift visible", async () => {
|
|
67
|
+
// Display-layer dedup (2026-10-10): the family version line ends with
|
|
68
|
+
// `::<hash7>`, so appending the SAME commit — bare hash7 or a
|
|
69
|
+
// `<branch>::<hash7>` stamp — printed the commit twice (the engine-row
|
|
70
|
+
// bug). A DIFFERENT commit stays visible: that IS the drift signal.
|
|
71
|
+
const cases: Array<{ version: string; hash: string; expect: string }> = [
|
|
72
|
+
{ version: "0.1 master::d423747", hash: "d423747", expect: "0.1 master::d423747" },
|
|
73
|
+
{ version: "0.1 master::d423747", hash: "master::d423747", expect: "0.1 master::d423747" },
|
|
74
|
+
{ version: "0.1 master::d423747", hash: "badd902", expect: "0.1 master::d423747 badd902" },
|
|
75
|
+
{ version: "0.1 master::d423747", hash: "feat/x::badd902", expect: "0.1 master::d423747 feat/x::badd902" },
|
|
76
|
+
{ version: "0.1.284", hash: "d423747", expect: "0.1.284 d423747" },
|
|
77
|
+
{ version: "0.1.52", hash: "EDW62Q", expect: "0.1.52 EDW62Q" },
|
|
78
|
+
];
|
|
79
|
+
for (const { version, hash, expect: expected } of cases) {
|
|
80
|
+
const container = document.createElement("div");
|
|
81
|
+
document.body.appendChild(container);
|
|
82
|
+
const app = createApp({
|
|
83
|
+
render: () =>
|
|
84
|
+
h(HkStatusBar, {
|
|
85
|
+
version,
|
|
86
|
+
panelBuildHash: hash,
|
|
87
|
+
connectionStatus: "connected",
|
|
88
|
+
connectionInfo: INFO,
|
|
89
|
+
}),
|
|
90
|
+
});
|
|
91
|
+
app.mount(container);
|
|
92
|
+
await nextTick();
|
|
93
|
+
const row = container.querySelector<HTMLElement>(".s-status-bar-version")!;
|
|
94
|
+
expect(row.textContent, `${version} + ${hash}`).toBe(expected);
|
|
95
|
+
app.unmount();
|
|
96
|
+
container.remove();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
66
100
|
it("renders extraDetails rows capped at 400px with an ellipsized, title-backed value", async () => {
|
|
67
101
|
const container = mountBar({
|
|
68
102
|
version: "1.2.3",
|
|
@@ -65,8 +65,35 @@ function qualityIcon(quality: string, tier: string, isLocalhost: boolean, size:
|
|
|
65
65
|
return <WifiOff size={size} />;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The commit a family version line ends with (`0.1 master::d423747`),
|
|
70
|
+
* when it carries one. Lowercased for comparison.
|
|
71
|
+
*/
|
|
72
|
+
function versionLineCommit(v: string): string | undefined {
|
|
73
|
+
return v.match(/::([0-9a-f]{7,40})$/i)?.[1]?.toLowerCase();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The commit a build stamp carries — a bare hash7 or a `<branch>::<hash7>`
|
|
77
|
+
* stamp. Non-git stamps (retired Crockford tokens) carry none and always
|
|
78
|
+
* stay visible; they can never be shown "already". */
|
|
79
|
+
function stampCommit(hash: string): string | undefined {
|
|
80
|
+
const stamped = hash.match(/^(\S+)::([0-9a-f]{7,40})$/i)?.[2];
|
|
81
|
+
return stamped?.toLowerCase() ?? (/^[0-9a-f]{7,40}$/i.test(hash) ? hash.toLowerCase() : undefined);
|
|
82
|
+
}
|
|
83
|
+
|
|
68
84
|
function fmtVer(v: string, hash?: string): string {
|
|
69
|
-
|
|
85
|
+
// Display-layer dedup (2026-10-10 family direction): a hash whose commit
|
|
86
|
+
// the version line already names says nothing new — printing it twice was
|
|
87
|
+
// the status-bar engine-row bug. Drift (a different commit) stays visible:
|
|
88
|
+
// that IS the stale-embed signal.
|
|
89
|
+
if (hash) {
|
|
90
|
+
const shown = versionLineCommit(v);
|
|
91
|
+
const stamp = stampCommit(hash);
|
|
92
|
+
if (shown === undefined || stamp === undefined || shown !== stamp) {
|
|
93
|
+
return `${v} ${hash}`;
|
|
94
|
+
}
|
|
95
|
+
return v;
|
|
96
|
+
}
|
|
70
97
|
return v;
|
|
71
98
|
}
|
|
72
99
|
|