From b68404cc6dc20e08844c3fbc7e63dccab66ee631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bilal=20Bera=20Meri=C3=A7?= <64109373+berameric@users.noreply.github.com> Date: Thu, 26 Nov 2026 22:14:56 +0300 Subject: [PATCH] Release 2.1.0 - One version source, src/version.js, read by the footer and the diagnostic and unsupported-instrument reports; tests/test_version.mjs checks that package.json, the README and the latest CHANGELOG entry agree. - CHANGELOG entry for 2.1.0: instrument recognition, phone layout, fixes and documentation since 2.0.0. - AGENTS.md: work locally and open a pull request when the work is complete; release steps. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 17 +++++++++++++++-- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ README.md | 2 +- index.html | 2 +- package.json | 6 +++--- src/main.js | 2 ++ src/ui/diag.js | 3 ++- src/ui/unsupported.js | 3 ++- src/version.js | 2 ++ tests/test_version.mjs | 13 +++++++++++++ 10 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 src/version.js create mode 100644 tests/test_version.mjs diff --git a/AGENTS.md b/AGENTS.md index 881cbbb..809932a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,6 +34,7 @@ install: the repository root is the site (GitHub Pages serves `main` as is). | `src/main.js` | Entry point: wires controls to actions, keyboard shortcuts, start-up | | `src/state.js` | The shared state object `S` and display-unit helpers | | `src/config.js` | Constants, storage keys, peak colours (read from CSS tokens), `MOCK` | +| `src/version.js` | The version number; the only place it is written in the code | | `src/acquisition.js` | Connect, acquire, live loop, exposure, dark | | `src/spectrum.js` | Frame → display unit, peak detection, render scheduling (one render per frame) | | `src/export.js` | CSV and PNG export | @@ -84,9 +85,21 @@ pass callbacks (as `initPlot(handlers)` does) when a lower module must reach a h - **Never push to `main`.** GitHub Pages publishes `main` as is, so every change reaches it through a pull request that the maintainer merges. -- **One change per branch, one branch per pull request,** branched from the current `main` and named by kind: - `feat/…`, `fix/…`, `docs/…`, `refactor/…`, `test/…`. +- **Work locally, open a pull request when the work is complete.** Branch from the current `main`, named by + kind (`feat/…`, `fix/…`, `docs/…`, `refactor/…`, `test/…`, `release/…`), commit as you go and check the result + locally. Push and open the pull request once the feature, fix or release is finished; small related edits go + into it rather than into pull requests of their own. - **Keep pull requests independent,** so they can be merged in any order or left out. Do not build one on an unmerged branch; when two changes truly depend on each other, say so in both descriptions. - The description says what changed, why, and how it was tested: `npm test`, the `?mock` checks, and whether a real instrument was used (and which). Driver changes are not merged before a test on hardware. + +## Releases + +Versions follow semantic versioning: a fix raises the patch number, a new feature the minor number. + +1. On a `release/x.y.z` branch, set the version in `src/version.js`, `package.json` and the README's version + line, and add the `## x.y.z — date` entry at the top of `CHANGELOG.md`; `tests/test_version.mjs` fails + until all four agree. +2. After the pull request is merged, tag the merge commit `vx.y.z` and publish a GitHub release whose notes + are the changelog entry. diff --git a/CHANGELOG.md b/CHANGELOG.md index d3dec52..51b9760 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## 2.1.0 — 2026-11-26 + +### Instruments +- Instruments are recognised by their USB IDs from a table of per-model profiles. Besides the HDX, the STS, + QE Pro, Spark and Ventana open as experimental models; older Ocean models and the Ocean ST/SR/HR series are + recognised but not operated. +- For an instrument Spektra cannot operate, a report built from the USB descriptors alone, with a pre-filled + GitHub issue; for an unknown device that may speak OBP, optional read-only requests. +- Read-only `?diag` page for the instrument's spectrum messages. + +### Phones +- Android Chrome over a USB-C (OTG) adapter, tested with an HDX; iOS remains unsupported (no WebUSB). +- Compact landscape layout: one-line top bar, processing steps as a strip on the left, the peaks panel as a + drawer, full-screen toggle and a prompt to turn the phone sideways. +- Touch gestures on the plot: pan, pinch-zoom, tap to select a peak, double tap to reset. + +### Fixes +- The wavelength coefficients are read twice and checked, so a repeated USB reply can no longer shift them + (the axis was stretched to about 2 × 10⁶ nm). +- X-axis labels no longer overlap when zoomed in or on narrow screens. +- Connect shows "Connecting…" and cannot be pressed twice while the instrument opens. +- Instrument error 12 is reported with its correct meaning; errors 13, 100–104 and 255 added. +- Interface text names "the spectrometer" wherever any model can be meant. + +### Documentation +- `docs/PROTOCOL.md`: how Spektra communicates with the instrument. +- `docs/TROUBLESHOOTING.md`: common connection problems and their fixes (contributed by Haseem Ajaz). +- README: the project's aims, supported instruments and a call for test reports. +- `AGENTS.md` and `CONTRIBUTING.md` for contributors; issue forms, a pull request template and tests run on + every pull request. + ## 2.0.0 — 2026-11-25 Spektra 2.0 replaces the earlier desktop program (1.x, Python and Qt) with a browser application: diff --git a/README.md b/README.md index c1c6021..c8f08e8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ protocol. It is tested on the HDX; support for other models is being added and n instruments](#supported-instruments)). No software has to be installed, and the same page works on Windows, macOS, Linux, ChromeOS and Android devices. -Application: · Version 2.0.0 ([changelog](CHANGELOG.md)) · +Application: · Version 2.1.0 ([changelog](CHANGELOG.md)) · [MIT licence](LICENSE) ![Spektra on a computer: live spectrum with detected peaks and the peak table (simulated data)](assets/screenshot.png) diff --git a/index.html b/index.html index f137e1e..d47e999 100644 --- a/index.html +++ b/index.html @@ -227,7 +227,7 @@

Peaks

0 Nano Optoelectronics Lab · IU - v2.0.0 + v GitHub diff --git a/package.json b/package.json index 608c4a4..15e4a58 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "spektra", - "version": "2.0.0", + "version": "2.1.0", "private": true, "license": "MIT", - "description": "Browser acquisition and peak analysis for the Ocean Insight HDX spectrometer", + "description": "Browser acquisition and peak analysis for Ocean Insight spectrometers", "type": "module", "scripts": { - "test": "node tests/test_web_analysis.mjs && node tests/test_web_usb.mjs", + "test": "node tests/test_web_analysis.mjs && node tests/test_web_usb.mjs && node tests/test_version.mjs", "start": "node scripts/serve.mjs", "dev": "node scripts/serve.mjs" } diff --git a/src/main.js b/src/main.js index 132bc1b..dff03b0 100644 --- a/src/main.js +++ b/src/main.js @@ -16,6 +16,7 @@ import { checkEnvironment, initEnvironment } from "./ui/environment.js"; import { toast } from "./ui/notify.js"; import { initPlot, redrawPlot, resetView, zoomToPeak, zoomToSelection } from "./ui/plot.js"; import { $, clamp, store } from "./util.js"; +import { VERSION } from "./version.js"; store.remove("hdx.rois.v1"); // saved regions of an earlier version store.remove("hdx.theme"); // the light theme was removed @@ -60,6 +61,7 @@ $("peaksCopy").addEventListener("click", async () => { $("detectScope").addEventListener("click", (e) => { if (e.target.closest('[data-act="clear-sel"]')) clearSelection(); }); initEnvironment(); watchDevice(); +$("versionLink").textContent = `v${VERSION}`; // ---------------------------------------------------------------- top bar $("connectBtn").addEventListener("click", connect); diff --git a/src/ui/diag.js b/src/ui/diag.js index fc2ece3..aef590e 100644 --- a/src/ui/diag.js +++ b/src/ui/diag.js @@ -5,6 +5,7 @@ import { DIAG } from "../config.js"; import { S } from "../state.js"; import { $ } from "../util.js"; +import { VERSION } from "../version.js"; import { toast } from "./notify.js"; const MESSAGES = [0x00101000, 0x00101100]; @@ -79,7 +80,7 @@ async function run() { for (let round = 0; round < 2; round++) for (const t of MESSAGES) caps.push(await capture(t)); const [a1, b1, a2, b2] = caps; report = { - spektra: "2.0.0", time: new Date().toISOString(), model: S.dev.model, serial: S.dev.serialNumber, + spektra: VERSION, time: new Date().toISOString(), model: S.dev.model, serial: S.dev.serialNumber, integrationMs: S.intMs, captures: caps.map(({ px, ...rest }) => rest), sameMessageRepeat: compare(a1, a2), otherMessageRepeat: compare(b1, b2), between: compare(a1, b1), }; diff --git a/src/ui/unsupported.js b/src/ui/unsupported.js index 0a82beb..adb8c30 100644 --- a/src/ui/unsupported.js +++ b/src/ui/unsupported.js @@ -5,6 +5,7 @@ import { OBP2, OOI, PROTOCOL_NAMES } from "../device/profiles.js"; import { describeDevice, probeObp } from "../device/probe.js"; import { $ } from "../util.js"; +import { VERSION } from "../version.js"; import { toast } from "./notify.js"; const ISSUES = "https://github.com/berameric/spektra/issues/new"; @@ -53,7 +54,7 @@ export function showUnsupported(device, profile) { if (!$("unsupDlg")) build(); current = { device, profile, - report: { spektra: "2.0.0", time: new Date().toISOString(), browser: navigator.userAgent, device: describeDevice(device) }, + report: { spektra: VERSION, time: new Date().toISOString(), browser: navigator.userAgent, device: describeDevice(device) }, }; const known = profile && profile.protocol !== undefined; $("unsupTitle").textContent = known ? `${profile.model} is not supported yet` : "This instrument is not supported yet"; diff --git a/src/version.js b/src/version.js new file mode 100644 index 0000000..c81403f --- /dev/null +++ b/src/version.js @@ -0,0 +1,2 @@ +// The Spektra version, shown in the footer and written into reports. Release steps: AGENTS.md. +export const VERSION = "2.1.0"; diff --git a/tests/test_version.mjs b/tests/test_version.mjs new file mode 100644 index 0000000..f573392 --- /dev/null +++ b/tests/test_version.mjs @@ -0,0 +1,13 @@ +// Node test: the version in src/version.js matches package.json, the README and the latest CHANGELOG entry, +// so a release cannot leave one of them behind: node tests/test_version.mjs +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { VERSION } from "../src/version.js"; + +const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), "utf8"); + +assert.equal(JSON.parse(read("package.json")).version, VERSION, "package.json"); +assert.ok(read("README.md").includes(`Version ${VERSION} (`), "README.md version line"); +assert.equal(read("CHANGELOG.md").match(/^## (\S+)/m)?.[1], VERSION, "CHANGELOG.md: the first entry is the current version"); + +console.log(`OK: version ${VERSION} is the same everywhere.`);