Skip to content

Implement lean, dependency-free CLJC Sqids - #10

Open
robhanlon22 wants to merge 1 commit into
mainfrom
v1.1.0
Open

robhanlon22 wants to merge 1 commit into
mainfrom
v1.1.0

Conversation

@robhanlon22

@robhanlon22 robhanlon22 commented Mar 4, 2026 •

Copy link
Copy Markdown
Collaborator

Replace the Java/JavaScript wrappers with a dependency-free CLJC implementation in one 308-line runtime namespace, org.sqids.clojure. Consolidate the behavior tests into org.sqids.clojure-test.

API and implementation

  • sqids validates an options map once and returns a non-associative deftype directly. encode and decode use typed field access. Keep options separately for serialization or reconstruction; old wrapper maps and raw options are rejected, including on empty input.
  • Keep implementation helpers private and public entry points direct. Remove redundant namespace facades, default aliases, and the string-reversal wrapper.
  • Use call-owned buffers, cursor-based decoding, cached alphabet membership, and prepared blocklist buckets. Preserve arbitrary JVM integers and enforce JavaScript's safe-integer boundary.
  • Share prefix assembly and ASCII validation across runtimes. Keep native digit buffers, shuffling, character conversion, and promoting arithmetic where measurements or platform semantics justify them.
  • Embed the bundled blocklist at compile time; missing data fails clearly. Normalize blocklist matching independently of JVM locale.

Dependency and toolchain refresh

Use stable releases at least 14 days old, with October 19, 2026 as this update's ordinary-release cutoff.

  • Update Clojure to 1.12.6, explicitly pin ClojureScript 1.12.145 for tests, and align npm/Maven shadow-cljs on 3.5.7.
  • Update data.json, tools.build, deps-deploy, nREPL, cljstyle, clj-kondo, pre-commit, shfmt, Markdown linting, and Prettier. Retain already-current stable Kaocha plugins, test.check, and ShellCheck.
  • Freeze Actions and pre-commit repository revisions to full commit SHAs; pin the CI runtime versions and upstream parity reference.
  • Run Clojure lint/format hooks through pinned aliases. Use the root npm lockfile for JavaScript formatters and constrain Python hook/build dependencies.
  • Enforce npm's 14-day resolution window, exact saves, disabled lifecycle scripts, and a supporting npm version. npm audit reports zero vulnerabilities; three scoped Markdown-linter overrides select aged fixes excluded by upstream dependency ranges.
  • Verify publication dates for all 101 locked npm packages, 16 Python pins, and 195 locally resolved Maven/Clojars artifact versions.

Four reviewed exceptions address documented security fixes: Node 24.22.1, Temurin 21.0.13+9, Python 3.14.10, and setup-python 7.1.0 (downloader fixes, dependency fixes). Newer ordinary shadow-cljs, clj-kondo, ws, Markdown-linter, and Node releases remain held back.

Verification

  • JVM/CLJS: 96 tests, 666 assertions, zero failures; preserves 400 generated roundtrips and 100 blocklist retry cases per runtime.
  • Coverage: 98.05% forms and 99.48% lines, with all runtime code included and a 90% gate.
  • Advanced CLJS/JVM parity: 779 requests per runtime against upstream; 4,060 assertions, zero failures.
  • JVM allocation budgets cover ordinary IDs, multi-digit inputs, 128-bit integers, and linear growth on long inputs. Advanced Node benchmarks cover default/empty blocklists and maximum-safe integers; timings remain informational.
  • The updated shadow-cljs launcher also compiles the consolidated tests with advanced optimization: 46 tests, 331 assertions, zero failures/errors, and zero compiler warnings.
  • Formatting, lint, all pre-commit checks, npm audit, and formatter dependency smoke checks pass.
  • Built-JAR sources match the working tree. Runtime-only smoke checks cover direct instances, canonical/blocked-ID roundtrips, rejected wrapper maps, and missing-resource failure.

Tests and reference harnesses remain outside production source, and benchmarks remain under dev/. The published runtime has no third-party dependencies.

@robhanlon22
robhanlon22 force-pushed the v1.1.0 branch 10 times, most recently from bc79a1b to 8344854 Compare March 7, 2026 23:05
@robhanlon22
robhanlon22 requested a review from 4kimov March 7, 2026 23:09
@robhanlon22
robhanlon22 force-pushed the v1.1.0 branch 6 times, most recently from ec7eca4 to 3ec5e1e Compare March 8, 2026 05:17
@robhanlon22
robhanlon22 enabled auto-merge March 8, 2026 05:47
@robhanlon22 robhanlon22 changed the title Implement pure CLJC Sqids and prepare 1.1.0 Implement lean, dependency-free CLJC Sqids Nov 2, 2026
@robhanlon22
robhanlon22 force-pushed the v1.1.0 branch 6 times, most recently from 2fc7a1d to 0140f03 Compare November 2, 2026 17:44
@robhanlon22

Copy link
Copy Markdown
Collaborator Author

@4kimov not sure if you care much about this anymore but I'd appreciate a review so I can merge this PR 🙂

Replace Java and JavaScript wrappers with one shared runtime namespace and
one behavior test namespace. Use direct non-associative instances, private
helpers, explicit validation, and call-owned buffers. Preserve arbitrary JVM
integers and JavaScript safe-integer checks.

Verify upstream parity, allocation budgets, advanced ClojureScript, and
packaging. Refresh dependencies and CI with reviewed release ages, exact
versions, locked tooling, and documented security exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant