@bounded-systems/conformance-kit 0.7.0 → 0.8.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/gates/likeness-gate.mjs +15 -5
- package/package.json +1 -1
package/gates/likeness-gate.mjs
CHANGED
|
@@ -99,8 +99,16 @@ export function evaluateLikeness({ tokenMap = {}, groups = [], thresholds = DEFA
|
|
|
99
99
|
});
|
|
100
100
|
const collapseCount = categorical.reduce((n, c) => n + c.count, 0);
|
|
101
101
|
|
|
102
|
+
// Identical-value pairs (ΔE 0) are intentional ALIASES — two semantic tokens
|
|
103
|
+
// deliberately mapped to one value (e.g. `card`/`white` → one #FFFFFF). The single
|
|
104
|
+
// value is defined once; the alias is by design, NOT redundancy. Only NEAR-but-
|
|
105
|
+
// DISTINCT pairs (0 < ΔE < dupDeltaE) are real redundancy: two almost-the-same
|
|
106
|
+
// colours defined separately, which probably should be one.
|
|
107
|
+
const aliasPairs = near.duplicates.filter((d) => d.identical).length;
|
|
108
|
+
const redundantTokens = near.count - aliasPairs;
|
|
109
|
+
|
|
102
110
|
const dupIsError = t.dupSeverity === "error";
|
|
103
|
-
const errors = (dupIsError ?
|
|
111
|
+
const errors = (dupIsError ? redundantTokens : 0) + collapseCount;
|
|
104
112
|
|
|
105
113
|
return {
|
|
106
114
|
passed: errors === 0,
|
|
@@ -108,7 +116,8 @@ export function evaluateLikeness({ tokenMap = {}, groups = [], thresholds = DEFA
|
|
|
108
116
|
summary: {
|
|
109
117
|
tokens: Object.keys(tokenMap).length,
|
|
110
118
|
nearDuplicates: near.count,
|
|
111
|
-
identicalPairs:
|
|
119
|
+
identicalPairs: aliasPairs,
|
|
120
|
+
redundantTokens,
|
|
112
121
|
categoricalGroups: categorical.length,
|
|
113
122
|
categoricalCollapses: collapseCount,
|
|
114
123
|
},
|
|
@@ -117,7 +126,8 @@ export function evaluateLikeness({ tokenMap = {}, groups = [], thresholds = DEFA
|
|
|
117
126
|
// Envelope a future lone `likeness.*` criterion can consume.
|
|
118
127
|
likeness: {
|
|
119
128
|
distinctCategoricals: collapseCount === 0,
|
|
120
|
-
|
|
129
|
+
// Intentional identical-value aliases don't count — only near-but-distinct dups.
|
|
130
|
+
noRedundantTokens: redundantTokens === 0,
|
|
121
131
|
},
|
|
122
132
|
};
|
|
123
133
|
}
|
|
@@ -156,8 +166,8 @@ async function main() {
|
|
|
156
166
|
if (process.env.LIKENESS_REPORT) await writeFile(resolve(process.env.LIKENESS_REPORT), JSON.stringify(report, null, 2) + "\n");
|
|
157
167
|
|
|
158
168
|
const s = report.summary;
|
|
159
|
-
const line = `likeness-gate: ${s.tokens} token(s) — ${s.
|
|
160
|
-
const dupLine = (d) => ` · ${d.identical ? "identical" : "near-dup"}: ${d.a} ≈ ${d.b} (${d.aHex}/${d.bHex}) ΔE ${d.deltaE}`;
|
|
169
|
+
const line = `likeness-gate: ${s.tokens} token(s) — ${s.redundantTokens} redundant near-dup(s) + ${s.identicalPairs} intentional alias(es), ${s.categoricalCollapses} categorical collapse(s)`;
|
|
170
|
+
const dupLine = (d) => ` · ${d.identical ? "alias (identical, ok)" : "near-dup"}: ${d.a} ≈ ${d.b} (${d.aHex}/${d.bHex}) ΔE ${d.deltaE}`;
|
|
161
171
|
const colLine = (c) => ` · collapse: ${c.a} vs ${c.b} (${c.aHex}/${c.bHex}) under ${c.condition} — ΔE ${c.deltaE} < ${c.min}`;
|
|
162
172
|
if (!report.passed) {
|
|
163
173
|
console.error(`✗ ${line}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bounded-systems/conformance-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Standalone, site-agnostic web-conformance toolkit: integrity tooling + build gates + provenance generators, all parameterized so a site vendors one kit instead of duplicating scripts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|