Skip to content

test(fragment): add baseBMP ARX decode regression tests#22

Merged
baanish merged 2 commits intomainfrom
claude/add-basebmp-arx-fragment-tests
Apr 3, 2026
Merged

test(fragment): add baseBMP ARX decode regression tests#22
baanish merged 2 commits intomainfrom
claude/add-basebmp-arx-fragment-tests

Conversation

@baanish
Copy link
Copy Markdown
Owner

@baanish baanish commented Mar 27, 2026

Summary

  • Adds two regression tests in tests/fragment.test.ts for decoding baseBMP-encoded ARX fragments via decodeFragmentAsync
  • Tests both direct baseBMP payloads and percent-escaped BMP characters (URL-escaped non-ASCII)
  • Covers the decode path for v1.arx.N.<baseBMP-payload> fragments that was previously only tested in arx-codec.test.ts

Test plan

  • npx vitest run tests/fragment.test.ts — all 12 tests pass (10 existing + 2 new)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added test cases to verify ARX fragment decoding functionality
    • Validates successful parsing of serialized and compressed payloads
    • Tests include both standard hash formats and percent-encoded character handling
    • Ensures envelope structure parsing works correctly
    • Covers multiple encoding scenarios to verify cross-format compatibility

Add two tests in fragment.test.ts for decoding baseBMP-encoded ARX
fragments via decodeFragmentAsync: one for direct baseBMP payloads and
one for percent-escaped BMP characters. Covers the sync-adjacent decode
path that was previously untested for arx.N.<baseBMP> wire format.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 15ace89d-f142-4c1c-a6f8-17c7b497ec4b

📥 Commits

Reviewing files that changed from the base of the PR and between 07e0942 and 4288ffb.

📒 Files selected for processing (1)
  • tests/fragment.test.ts

📝 Walkthrough

Walkthrough

The PR adds two async test cases to verify ARX fragment decoding functionality. Tests construct ARX-codec PayloadEnvelopes, serialize and compress them, embed results into hash fragments, and verify successful parsing with correct title content, including one test with percent-escaped non-ASCII characters.

Changes

Cohort / File(s) Summary
ARX Fragment Decoding Tests
tests/fragment.test.ts
Two new async test cases for decodeFragmentAsync API: one decodes raw ARX hash fragments, another tests percent-escaped non-ASCII character handling. Tests utilize packEnvelope, arxCompressBMP, and getActiveDictVersion() utilities to construct and encode test payloads.

Possibly related PRs

Poem

🐰 Fragments decoded with flair so bright,
Async tests hopping left and right,
ARX compresses, escapes play,
Another piece of code today!

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding regression tests for baseBMP ARX fragment decoding, which aligns with the changeset that adds two async test cases for ARX fragment decoding.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/add-basebmp-arx-fragment-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

expect(parsed.code).toBe("decoded-too-large");
});

it("decodes a baseBMP-encoded arx fragment (sync path)", async () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Misleading test name — says "sync path" but uses decodeFragmentAsync. The sync decodeFragment explicitly rejects arx codec (see src/lib/payload/fragment.ts:321).

Suggested change
it("decodes a baseBMP-encoded arx fragment (sync path)", async () => {
it("decodes a baseBMP-encoded arx fragment (async path)", async () => {

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Mar 27, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
tests/fragment.test.ts 185 Test name says "sync path" but uses decodeFragmentAsync — misleading name since sync decodeFragment explicitly rejects arx codec
Files Reviewed (1 files)
  • tests/fragment.test.ts - 1 suggestion (misleading test name)

Notes

The two new tests look correct — they properly exercise the decodeFragmentAsync path for baseBMP-encoded arx fragments, including the percent-escaped variant. The imports and test structure follow existing conventions in the file. The only issue is the test name on line 185.


Reviewed by mimo-v2-pro-20260318 · 106,938 tokens

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 27, 2026

Deploying agent-render with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4288ffb
Status: ✅  Deploy successful!
Preview URL: https://4e3e2162.agent-render.pages.dev
Branch Preview URL: https://claude-add-basebmp-arx-fragm.agent-render.pages.dev

View logs

@baanish baanish merged commit 798d069 into main Apr 3, 2026
4 checks passed
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