Skip to content

Contributing

The most useful bug report is one line: the input string, and the output you expected. That's usually enough to turn it into a fixture. If it came from a specific place (a YouTube title, a Beatport export, a file name), say so, because that decides which mode it belongs to.

Open an issue on GitHub. You can paste a playground link: the URL contains the input. It doesn't matter which language you use. The five packages share the rules, so a wrong result in one is a wrong result in all of them. If JavaScript, Python, Rust, Go and C ever disagree with each other, that is a bug of its own, and worth reporting with the two outputs.

Behaviour starts in the spec, not in the code:

  1. Add or amend a rule in spec/SPEC.md. Rule IDs are never renumbered or reused.
  2. Add handwritten fixtures that cite the rule (format): the positive case, the near-miss that must not trigger, and one exact case if the rule touches many fields.
  3. If the rule is combinatorial (a new joiner, a new version word), teach the generator the atom and regenerate.
  4. Change every port, JavaScript, Python, Rust, Go and C, and cite the rule ID in a comment.
  5. Check that every fixture passes in all five ports and that the cross-port diff reports zero differences.
  6. Update the pages of this site that describe the rule, with an example in each language.

How it works explains the pipeline, and How it's tested explains the fixtures and the generator.

Word lists live only in spec/data. They're compiled into each port, so a new keyword is a JSON change plus codegen, not a code change.

spec/ SPEC.md, word lists, JSON Schemas, fixtures, the fixture generator
js/ the npm package (reference implementation)
python/ the PyPI package
rust/ the crates.io package
go/ the Go module
c/ the C library
site/ this website
scripts/ cross-port diff and other tools

From the repository root. Development needs Node 22 or newer and pnpm.

pnpm install
pnpm test # fixtures, properties, API tests, generator tests
pnpm conformance # pass rate per fixture file and per rule
pnpm lint # Biome lint and format check
pnpm --filter trackparse typecheck
pnpm gen:data # regenerate js/src/data.generated.ts from spec/data
pnpm gen:fixtures # regenerate spec/fixtures/generated
pnpm build # build js/dist

Python 3.9 or newer, with uv.

cd python
uv sync # install the dev environment
uv run pytest # fixtures, properties, API tests
uv run python scripts/conformance.py # pass rate per fixture file and per rule
uv run ruff check . && uv run ruff format --check .
uv run mypy --strict src
uv run python scripts/gen_data.py # regenerate src/trackparse/_data.py from spec/data

Rust 1.74 or newer, and Node 24 for the codegen: the Unicode tables are generated from the Unicode data built into Node, so another Node version can write different tables.

cd rust
cargo test # fixtures, invariants, API tests
TRACKPARSE_REPORT=1 cargo test --test fixtures -- --nocapture # pass rate per file and per rule
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
node scripts/gen_data.mjs # regenerate src/data.rs and src/unicode_tables.rs

Go 1.22 or newer, and Node 24 for the codegen: as in Rust, the Unicode tables come from Node, not from the Go toolchain.

cd go
go test ./... # fixtures, invariants, unit tests
TRACKPARSE_REPORT=1 go test -run TestFixtures -v . # pass rate per file and per rule
gofmt -l . && go vet ./...
node scripts/gen_data.mjs # regenerate data_gen.go from spec/data
node scripts/gen_unicode.mjs # regenerate unicode_gen.go
pnpm --filter trackparse build && node scripts/dump_artist_cases.mjs # data for the artist-side tests

The artist-side tests compare with values from the JavaScript package. Their data file is too big to ship in the module, so it is not committed: the last command writes it, and without it those tests are skipped. CI writes it and requires it.

A C11 compiler, CMake 3.16 or newer, and Node 24 for the codegen: as in Go, the Unicode tables come from Node, not from the C library or the platform. The C code is a translation of the Go port, file by file; c/src/PORTING.md has the conventions.

cmake -S c -B c/build-test -DTRACKPARSE_WERROR=ON
cmake --build c/build-test
ctest --test-dir c/build-test --output-on-failure # fixtures, schema check, unit tests
TRACKPARSE_REPORT=1 c/build-test/trackparse-fixtures spec/fixtures/*/*.json # pass rate per file and per rule
TRACKPARSE_ONLY=brackets-version-001 c/build-test/trackparse-fixtures spec/fixtures/*/*.json # one case
cmake -S c -B c/build-asan -DTRACKPARSE_SANITIZE=ON # the same suite under ASan and UBSan
node c/scripts/gen_data.mjs # regenerate src/data_gen.c from spec/data
node c/scripts/gen_unicode.mjs # regenerate src/unicode_gen.c
node c/scripts/amalgamate.mjs # write trackparse.c, .h and .hpp into c/dist

src/ uses no strtod, no float printf, no <ctype.h> and no qsort: the first three follow the process locale, and qsort is not stable.

After a change in any port, build the JavaScript package and run the cross-port diff from the repository root. It runs every fixture through all five ports and compares the complete output.

pnpm build
node scripts/compare-ports.mjs # must print "differences: 0"
node scripts/compare-ports.mjs --only=rust # one port against JavaScript (or --only=python, --only=go, --only=c)
node scripts/fuzz-ports.mjs # the same diff on random input

The site lives in site/. Every code example has a JavaScript, a Python, a Rust, a Go and a C tab, and every output in it comes from running the code.

pnpm docs # run the site locally
pnpm docs:build # build it; fails on broken pages

AGENTS.md has the full repository map, every command and the release process. Commits follow Conventional Commits, because the changelog is generated from them. The five packages and the spec are released together under one version number.

MIT © Maksim Maksimov.