---
description: Full QA pass for the cnk set-compression crate.
---

Run a comprehensive quality audit of the `cnk` crate. Execute each section in order. Report failures immediately; do not skip sections.

## 1. Build verification

```bash
cd /Users/arc/Documents/dev && cargo check -p cnk 2>&1
cd /Users/arc/Documents/dev && cargo check -p cnk --features ans 2>&1
cd /Users/arc/Documents/dev && cargo check -p cnk --features sbits 2>&1
cd /Users/arc/Documents/dev && cargo check -p cnk --features full 2>&1
```

Verify each feature combination compiles independently.

## 2. Lint and format

```bash
cd /Users/arc/Documents/dev/cnk && rustfmt --check src/*.rs tests/*.rs 2>&1
cd /Users/arc/Documents/dev && cargo clippy -p cnk --all-targets -- -D warnings 2>&1
cd /Users/arc/Documents/dev && cargo clippy -p cnk --all-targets --features full -- -D warnings 2>&1
```

## 3. Test suite (unit + property tests)

```bash
cd /Users/arc/Documents/dev && cargo test -p cnk 2>&1
cd /Users/arc/Documents/dev && cargo test -p cnk --features full 2>&1
```

Report total test count for each run. Verify no tests are ignored unintentionally.

## 4. Compression correctness

Verify roundtrip for various set sizes and densities:
- Empty set
- Single ID
- Dense set (consecutive IDs)
- Sparse set (large gaps)
- Very large IDs (near u32::MAX)

These are covered by property tests in `tests/property_tests.rs`. Confirm they all pass.

## 5. Compression ratio sanity

Verify that delta+varint encoding beats raw u32 storage for:
- Consecutive IDs (delta=1)
- Moderately sparse IDs
- Property test `prop_compression_ratio` covers this.

## 6. Envelope format

Verify:
- V2 envelope roundtrip
- V1 envelope backward compatibility
- CRC mismatch detection
- Wire format golden test

These are covered by `envelope::tests::*`.

## 7. Auto method selection

Verify `compress_set_auto` / `decompress_set_auto` roundtrip for:
- Default config
- Empty sets
- Consecutive IDs

These are in `auto::tests::*`.

## 8. Edge cases

- Empty set compression/decompression
- Single ID in large universe (`sparse_single_id`)
- Dense set near universe boundary (`dense_set`)
- Unsorted IDs rejected
- Duplicate IDs rejected
- IDs exceeding universe rejected

## 9. Doc tests

```bash
cd /Users/arc/Documents/dev && cargo test -p cnk --doc 2>&1
```

## 10. Feature isolation

Verify each feature compiles and tests pass in isolation:
```bash
cd /Users/arc/Documents/dev && cargo test -p cnk --no-default-features 2>&1
cd /Users/arc/Documents/dev && cargo test -p cnk --features ans 2>&1
cd /Users/arc/Documents/dev && cargo test -p cnk --features sbits 2>&1
cd /Users/arc/Documents/dev && cargo test -p cnk --features full 2>&1
```

## Summary

Report:
- Total test count (unit + property + doc)
- Any clippy warnings
- Any format issues
- Any failing tests
- Feature gate correctness
