@floless/app 0.134.1 → 0.134.2

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.
@@ -109,8 +109,10 @@ export function selectionMode(mode) {
109
109
  * Deliberately NOT `modeDims`, which normalises by splitting on '+'. The two genuinely disagree on a
110
110
  * malformed persisted mode, and normalising here would silently change a stored verdict. Phase D's
111
111
  * answer to that divergence is a canonicity gate on the saved mode — a refusal, not a quiet rewrite —
112
- * and it lands in a later slice; until then the rule stays exactly as it was, in ONE place instead of
113
- * being re-derived wherever it is needed.
112
+ * and slice D2 LANDED it: `hasCanonicalMode` is a clause of the Filter-Save route, of the audit's
113
+ * `filter-checkpoint`, and of the exclusion sign-off. So every mode that can reach a completed audit
114
+ * is one where this rule and `modeDims` agree, and the rule stays exactly as it was, in ONE place
115
+ * instead of being re-derived wherever it is needed.
114
116
  */
115
117
  export function selectionDims(mode) {
116
118
  const raw = selectionMode(mode);
@@ -519,27 +521,56 @@ export function liveUpdateAction(frame, ctx) {
519
521
  }
520
522
 
521
523
  /**
522
- * THE canonical "dismissible" layer set — the ONE definition shared by the recorded layer sign-off's
523
- * server digest (server/steel-read-manifest.ts), the sign-off confirm step in steel-filter.html, and
524
- * (from #805 Phase C slice 2) the completion audit's shorthand-eligibility predicate. Defining it once
525
- * is the point: three predicates that merely agree can drift, and one of them decides when real steel
526
- * may be dismissed without a line-by-line justification.
524
+ * THE canonical "dismissible" facet set — the ONE definition shared by the recorded exclusion
525
+ * sign-off's server digest (server/steel-read-manifest.ts), the sign-off confirm step in
526
+ * steel-filter.html, the `facet-census` coverage check, and the completion audit's
527
+ * shorthand-eligibility predicate. Defining it once is the point: predicates that merely agree can
528
+ * drift, and this one decides when real steel may be dismissed without a line-by-line justification.
527
529
  *
528
- * A layer name qualifies iff it is a NON-EMPTY string and EVERY row carrying that name has
529
- * `on === false` (a duplicated name with one row ticked ON is therefore NOT dismissible, and neither
530
- * is a non-boolean `on`, which is neither ON nor OFF). Emitted once per name, in the filter's
531
- * persisted order — never sorted, because the order is part of the list the human was shown and a
532
- * reorder must read as a change.
530
+ * Generalised from `dismissibleLayerNames` (#805 Phase D slice D2). It is REPLACED, not wrapped: two
531
+ * functions that agree is exactly the shape this epic keeps losing to.
532
+ *
533
+ * Three rules, and the first is load-bearing:
534
+ *
535
+ * 1. **Only dimensions the saved `mode` activates contribute** (`selectionDims` — the LEDGER's rule,
536
+ * the same one `selectionIndex` reads). A line unselected under `mode: 'thickness'` is unselected
537
+ * because of its width, so a layer approval had no bearing on why; borrowing authority from a
538
+ * facet the mode ignores would inherit a premise nobody established. Folding the mode into the SET
539
+ * also closes a silent-broadening hole structurally: an approval recorded under `layer` cannot
540
+ * carry unchanged into a later save under `thickness+layer`, because the set changes, so the
541
+ * digest changes, so the approval is invalid.
542
+ * 2. A value qualifies iff its CANONICAL key is well-formed for its dimension (`facetKey` plus
543
+ * `isDismissibleFacetValue` — a non-empty string, or a finite number) and EVERY row carrying that
544
+ * canonical key has `on === false`. A duplicated value with one row ticked ON is therefore NOT
545
+ * dismissible, and neither is a non-boolean `on`, which is neither ON nor OFF. Grouping by the
546
+ * CANONICAL key is what makes a hand-edited `#ABC123: false` beside `#abc123: true` read as the
547
+ * one conflicted value it is, rather than as an approval of half of it.
548
+ * 3. Values are emitted once each, in the filter's persisted order within their dimension, never
549
+ * sorted — the order is part of the list the human was shown, and a reorder must read as a change.
550
+ * Dimensions are emitted in `MODE_ORDER` order.
551
+ *
552
+ * @returns {Array<{ dim: 'thickness'|'layer'|'color', value: number|string }>}
533
553
  */
534
- export function dismissibleLayerNames(filter) {
535
- const rows = (filter && typeof filter === 'object' && Array.isArray(filter.layers)) ? filter.layers : [];
536
- const allOff = new Map();
537
- const order = [];
538
- for (const row of rows) {
539
- if (!row || typeof row !== 'object' || Array.isArray(row)) continue;
540
- if (typeof row.name !== 'string' || row.name === '') continue;
541
- if (!allOff.has(row.name)) order.push(row.name);
542
- allOff.set(row.name, (allOff.get(row.name) ?? true) && row.on === false);
554
+ export function dismissibleFacetValues(filter) {
555
+ const source = (filter && typeof filter === 'object' && !Array.isArray(filter)) ? filter : {};
556
+ const active = new Set(selectionDims(source.mode));
557
+ const out = [];
558
+ for (const dim of MODE_ORDER) {
559
+ if (!active.has(dim)) continue;
560
+ const d = FACET_DIMS[dim];
561
+ const rows = Array.isArray(source[d.control]) ? source[d.control] : [];
562
+ const allOff = new Map();
563
+ const order = [];
564
+ for (const row of rows) {
565
+ if (!row || typeof row !== 'object' || Array.isArray(row)) continue;
566
+ const key = facetKey(dim, row[d.rowKey]);
567
+ // Ill-formed values never enter. That is a deliberate FAIL-CLOSED change from the layer-only
568
+ // rule this generalises: such a line simply gets an explicit row instead.
569
+ if (key === undefined || !isDismissibleFacetValue(dim, key)) continue;
570
+ if (!allOff.has(key)) order.push(key);
571
+ allOff.set(key, (allOff.get(key) ?? true) && row.on === false);
572
+ }
573
+ for (const value of order) if (allOff.get(value) === true) out.push({ dim, value });
543
574
  }
544
- return order.filter((name) => allOff.get(name) === true);
575
+ return out;
545
576
  }