edfcore 0.6.270 → 0.6.271

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,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
109
109
  readonly reserved: 224;
110
110
  };
111
111
  /** Published package version. Kept in sync with package.json by a test. */
112
- export declare const VERSION = "0.6.270";
112
+ export declare const VERSION = "0.6.271";
113
113
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -79,5 +79,5 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
79
79
  reserved: 224,
80
80
  };
81
81
  /** Published package version. Kept in sync with package.json by a test. */
82
- export const VERSION = '0.6.270';
82
+ export const VERSION = '0.6.271';
83
83
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-report.d.ts","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CA4NR;AAED,qFAAqF;AACrF,YAAY,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"format-report.d.ts","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CA8PR;AAED,qFAAqF;AACrF,YAAY,EAAE,SAAS,EAAE,CAAC"}
@@ -131,6 +131,38 @@ export function formatValidationReport(report, options) {
131
131
  'labels this names the rows with, which is all this option does. Next: pass ' +
132
132
  'recording.header, or omit it and the rows read `signal 0`.');
133
133
  }
134
+ /*
135
+ * And that it is THIS file's header, which nothing asked.
136
+ *
137
+ * The report and the header arrive as separate arguments and are only ever paired by a caller —
138
+ * the shape `resolveTimeWindow` guards for its timeline and index, where it is "not a wrong
139
+ * number but a wrong FILE". Here it is a wrong file's NAMES on a right file's numbers, and this
140
+ * option's whole job is those names: the difference between `EEG Fpz-Cz` and `signal 0`.
141
+ *
142
+ * A header from another recording labelled row 0 with its own signal 0 and left the rest reading
143
+ * `signal 1`, `signal 2` — so the output looks like a file where only some channels are named,
144
+ * which makes the wrong label harder to notice rather than easier. `validate-index-reuse.test.ts`
145
+ * lists the routes for the sibling mistake and they are the same here: "a viewer holding indices
146
+ * for several open recordings, a helper that caches one per session, a loop that forgets to
147
+ * rebuild".
148
+ *
149
+ * The test is the one fact the two share: every signal the report mentions has to exist in the
150
+ * header. A header that cannot name every row is certainly not this report's. It is a floor
151
+ * rather than a proof — a wrong header with enough signals still passes — and `signalStats` is
152
+ * only filled when `scanSamples` was on, so the diagnostics' own indices are counted too.
153
+ */
154
+ const mentioned = [
155
+ ...report.signalStats.map((stat) => stat.signalIndex),
156
+ ...report.diagnostics.map((diagnostic) => diagnostic.signalIndex),
157
+ ].filter((index) => typeof index === 'number');
158
+ const signalCount = options.header.signals.length;
159
+ const beyond = mentioned.find((index) => index >= signalCount);
160
+ if (beyond !== undefined) {
161
+ throw new RangeError(`formatValidationReport(): options.header has ${signalCount} signals and this report has ` +
162
+ `rows for signal ${beyond}, so it is not the header this file was validated with — the ` +
163
+ "rows it could name would carry another recording's channel labels. Next: pass the " +
164
+ 'header of the recording you passed to validateRecording(recording).');
165
+ }
134
166
  }
135
167
  const header = options?.header;
136
168
  // Before anything is rendered, and outside the `diagnostics.length > 0` branch below. A report
@@ -1 +1 @@
1
- {"version":3,"file":"format-report.js","sourceRoot":"","sources":["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AAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QACpE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAEpE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,KAAK,CAAC,IAAI,CACR,KAAK,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG;gBACpF,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAC/B,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACR,iBAAiB,CAAC,MAAM,CAAC,WAAW,EAAE;YACpC,QAAQ;YACR,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SACvF,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/docs/CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ alone does not tell you whether you were affected.
6
6
  edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
7
7
  defect; those are called out below.
8
8
 
9
+ ## 0.6.271
10
+
11
+ - **Fixed** `formatValidationReport(report, { header })` accepting a header from a different
12
+ recording, and labelling the rows with it. The two arrive as separate arguments and are only ever
13
+ paired by a caller — the shape `resolveTimeWindow` guards for its timeline and index, where it is
14
+ "not a wrong number but a wrong FILE". Here it is a wrong file's names on a right file's numbers,
15
+ and this option's whole job is those names.
16
+ - It answered. Row 0 took the other recording's signal 0 label and the rows that header had no signal
17
+ for fell back to `signal 1`, `signal 2` — so the output read as a file where only some channels are
18
+ named, which makes the wrong label harder to notice rather than easier. A reader comparing an
19
+ observed range against a channel name was reading two recordings on one line.
20
+ - The check is the one fact the two share: every signal the report mentions must exist in the header,
21
+ counting both `signalStats` and the diagnostics' own indices, since `signalStats` is only filled
22
+ when `scanSamples` was on.
23
+ - It is a floor rather than a proof, and the test says so: a wrong header with enough signals still
24
+ passes, because a report and a header carry no identifier to compare. A report with no rows at all,
25
+ and an omitted option, are unchanged.
26
+
9
27
  ## 0.6.270
10
28
 
11
29
  - **Fixed** `formatValidationReport(report, { header: readHeader(source) })` being told "options.header
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edfcore",
3
- "version": "0.6.270",
3
+ "version": "0.6.271",
4
4
  "description": "Modern, typed, zero-dependency reader for EDF, EDF+, BDF and BDF+ biosignal files. Works in browsers and Node with true random access.",
5
5
  "keywords": [
6
6
  "edf",
package/src/constants.ts CHANGED
@@ -93,4 +93,4 @@ export const SIGNAL_FIELD_BLOCK_OFFSETS = {
93
93
  } as const;
94
94
 
95
95
  /** Published package version. Kept in sync with package.json by a test. */
96
- export const VERSION = '0.6.270';
96
+ export const VERSION = '0.6.271';
@@ -149,6 +149,40 @@ export function formatValidationReport(
149
149
  'recording.header, or omit it and the rows read `signal 0`.',
150
150
  );
151
151
  }
152
+ /*
153
+ * And that it is THIS file's header, which nothing asked.
154
+ *
155
+ * The report and the header arrive as separate arguments and are only ever paired by a caller —
156
+ * the shape `resolveTimeWindow` guards for its timeline and index, where it is "not a wrong
157
+ * number but a wrong FILE". Here it is a wrong file's NAMES on a right file's numbers, and this
158
+ * option's whole job is those names: the difference between `EEG Fpz-Cz` and `signal 0`.
159
+ *
160
+ * A header from another recording labelled row 0 with its own signal 0 and left the rest reading
161
+ * `signal 1`, `signal 2` — so the output looks like a file where only some channels are named,
162
+ * which makes the wrong label harder to notice rather than easier. `validate-index-reuse.test.ts`
163
+ * lists the routes for the sibling mistake and they are the same here: "a viewer holding indices
164
+ * for several open recordings, a helper that caches one per session, a loop that forgets to
165
+ * rebuild".
166
+ *
167
+ * The test is the one fact the two share: every signal the report mentions has to exist in the
168
+ * header. A header that cannot name every row is certainly not this report's. It is a floor
169
+ * rather than a proof — a wrong header with enough signals still passes — and `signalStats` is
170
+ * only filled when `scanSamples` was on, so the diagnostics' own indices are counted too.
171
+ */
172
+ const mentioned = [
173
+ ...report.signalStats.map((stat) => stat.signalIndex),
174
+ ...report.diagnostics.map((diagnostic) => diagnostic.signalIndex),
175
+ ].filter((index): index is number => typeof index === 'number');
176
+ const signalCount = (options.header as EdfHeader).signals.length;
177
+ const beyond = mentioned.find((index) => index >= signalCount);
178
+ if (beyond !== undefined) {
179
+ throw new RangeError(
180
+ `formatValidationReport(): options.header has ${signalCount} signals and this report has ` +
181
+ `rows for signal ${beyond}, so it is not the header this file was validated with — the ` +
182
+ "rows it could name would carry another recording's channel labels. Next: pass the " +
183
+ 'header of the recording you passed to validateRecording(recording).',
184
+ );
185
+ }
152
186
  }
153
187
  const header = options?.header;
154
188