Skip to content

chore: lint and format scripts from @cldmv/configs, with the pre-commit hook - #96

Merged
Shinrai merged 4 commits into
nextfrom
chore/lint-format-scripts
Nov 7, 2026
Merged

Shinrai merged 4 commits into
nextfrom
chore/lint-format-scripts

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

No bug fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

@cldmv-bot cldmv-bot Bot added ! chore → next v4 flow: chore contributor PR targeting the next integration branch area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 7, 2026
@cldmv-bot cldmv-bot Bot mentioned this pull request Nov 7, 2026
…it hook

The repository had an ESLint config that imported plugins it never installed and a Prettier config no script ran. It now extends @cldmv/configs 1.4.0: .configs/eslint.config.mjs spreads the shared base, .configs/prettier.config.mjs re-exports the shared options without the jsonv plugin (no .jsonv files here), and .prettierignore carries the managed block plus types/. The lint, lint:fix, format and format:check scripts come from `cldmv-configs init`, build:ci runs lint and format:check unconditionally, and prepare installs the fleet pre-commit hook from .githooks/.

Formatting drift in two files and thirteen lint errors (unused imports, bindings and a stale disable directive, two fences without a language) are fixed; no behaviour changes.
@Shinrai
Shinrai force-pushed the chore/lint-format-scripts branch from 72cd57b to b5c8ac8 Compare November 7, 2026 01:23
@Shinrai
Shinrai merged commit 5e483a3 into next Nov 7, 2026
28 checks passed
@cldmv-bot
cldmv-bot Bot deleted the chore/lint-format-scripts branch November 7, 2026 01:31
Shinrai added a commit that referenced this pull request Nov 7, 2026
## 🚀 What's Changed

### 💥 Breaking Changes
_No breaking changes_

### ✨ Features
_No new features_

### 🐛 Bug Fixes
_No bug fixes_

### 📦 Dependencies
_No dependency updates_

### 🔧 Other Changes
- docs: the v1.4.0 notes cover the lint and format tooling (#96)
(b16d67c)
- docs: v1.4.0 release notes (#95) (d8fde13)



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---------

Co-authored-by: Shinrai <[email protected]>
cldmv-bot Bot added a commit that referenced this pull request Nov 7, 2026
# `@cldmv/uuid` v1.4.0 Changelog

**Release Date**: November 2026
**Release Type**: Minor
**Branch**: `release/1.4.0`

---

## Overview

v1.4.0 makes the Timestamp Variant sort by byte order. Until now `UUID.TA()` and `UUID.TB()` wrote the timestamp magnitude's low 32 bits ahead of its upper 31, so two ids compared as bytes only followed time inside one 2^32 window and reversed at every boundary: every 49.7 days for `TB` (milliseconds), every 136 years for `TA` (seconds). Any store that orders rows or cursors by a `TB` id broke silently at each rollover.

The fix is non-breaking and goes through the version field. Timestamp versions 3 (seconds) and 4 (milliseconds) carry the ordered layout, `UUID.TA()` and `UUID.TB()` now mint them by default, and versions 1 and 2 decode exactly as before, so every stored id keeps its timestamp. `UUID.migrate()` rewrites a stored legacy id to the ordered layout deterministically, and `isLegacyTimestampLayout()` selects the rows that need it.

---

## ✨ Features

### Timestamp versions 3 and 4 sort by byte order ([#90](#90), fixes [#89](#89))

- Versions 3 (seconds) and 4 (milliseconds) lay the magnitude out most significant bit first: the upper 31 bits at bits 1-31 and the low 32 at bits 32-63. The sign bit, the entropy bits and bits 69-74 are unchanged, so the version field is the only thing that tells the layouts apart.
- `UUID.TA()` mints version 3 and `UUID.TB()` mints version 4. An explicit `UUID.timestamp(ts, 1)` or `UUID.timestamp(ts, 2)` still mints the legacy layout for anyone who needs it.
- Versions 1 and 2 decode as before: `getTimestamp()` on an id minted by 1.3.1 or earlier answers the same value it always did.
- `validators.mjs` read segment A as one contiguous value, which was wrong for the legacy layout; it now reads by version.

### `UUID.migrate()` and `isLegacyTimestampLayout()` ([#90](#90))

- `UUID.migrate(input)` rewrites a legacy timestamp id to version 3 or 4 with the same sign, the same timestamp and the same 49 entropy bits, so the result is deterministic. It is idempotent, and an id that is not a Timestamp Variant passes through unchanged.
- `uuid.isLegacyTimestampLayout()` is true for a version 1 or 2 timestamp id, which is the test to select stored rows for migration.
- Old and new ids interleave in byte order until every row is migrated, because versions 1 and 2 keep the legacy layout. Ordering by byte value is chronological only once every id involved is at version 3 or 4.

### Types

- The `.d.mts` declarations cover the new timestamp version modules, `UUID.migrate()` and `isLegacyTimestampLayout()`, and the consumer type test exercises them.

## 🔧 CI & tooling

### Lint and format scripts from `@cldmv/configs` ([#96](#96))

- The repository had an ESLint config that imported plugins it never installed and a Prettier config no script ran. `.configs/eslint.config.mjs` now spreads the shared `@cldmv/configs` base, `.configs/prettier.config.mjs` re-exports the shared options (without the jsonv plugin, since there are no `.jsonv` files here), and `.prettierignore` carries the managed block plus `types/`.
- `lint`, `lint:fix`, `format` and `format:check` come from `cldmv-configs init`; `build:ci` runs `lint` and `format:check` unconditionally; `prepare` installs the fleet pre-commit hook from `.githooks/`, which rejects a commit on a lint or formatting problem.
- Formatting drift in two files and thirteen lint errors (unused imports and bindings, a stale disable directive, two fences without a language) are fixed. No behaviour changes.

## 📚 Documentation

- README: the `TA` and `TB` sections, the version table and the bit layout describe versions 3 and 4, and a new "Migrating stored ids to versions 3 and 4" section walks through the row-by-row rewrite ([#90](#90)).
- `uuid-spec.md` 8.2 gains versions 3 and 4 ([#90](#90)).
- **NEW:** [docs/changelog/v1/v1.4.0.md](./v1.4.0.md): this changelog.
- README What's New promoted to v1.4.0.

## 🧪 Tests

- Fixed vectors for versions 3 and 4, the 1.3.1 legacy vectors decoding unchanged, migration vectors, idempotence and pass-through, a 1000-id legacy sample that byte-sorts in timestamp order after migration, and the 2^32 boundaries ([#90](#90)).

## 🔧 Dependencies

- `@cldmv/configs` ^1.2.4 → ^1.4.0, and `eslint` ^10.14.0 and `prettier` ^3.9.10 added, for the lint and format scripts ([#96](#96)). Development dependencies only.

---

## Upgrade notes

- No breaking changes; drop-in for v1.3.2. New `TA` and `TB` ids are versions 3 and 4; existing ids keep decoding.
- If you order rows or cursors by a `TB` or `TA` id, migrate the stored ids once: select the rows where `new UUID(id).isLegacyTimestampLayout()` is true and write back `UUID.migrate(id).toString()` (or `.toBuffer()`). Until the rewrite is complete, old and new ids interleave in byte order.

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-84.0%25-green?style=for-the-badge&logo=vitest&logoColor=white)

| Metric | Coverage |
|--------|----------|
| Statements | 81.7% |
| Branches   | 83.6% |
| Functions  | 89.8% |
| Lines      | 81.2% |

*Avg: **84.0%** · `e58338c` · Node lts/**

<!-- coverage-end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! chore → next v4 flow: chore contributor PR targeting the next integration branch type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant