Skip to content

Split lib test suites into integration targets (Fixes #307)#368

Open
Ayush7614 wants to merge 3 commits into
vybestack:mainfrom
Ayush7614:fix/307-split-test-targets
Open

Split lib test suites into integration targets (Fixes #307)#368
Ayush7614 wants to merge 3 commits into
vybestack:mainfrom
Ayush7614:fix/307-split-test-targets

Conversation

@Ayush7614

Copy link
Copy Markdown
Contributor

Summary

  • Move public GitHub client, layout, markdown HTML strip, pagination, identity, agent detection, list viewport, and issue-rewrite suites out of the lib harness into dedicated tests/*.rs targets (same pattern as git_info).
  • Lib registrations drop from 2239 → 1995, clearing Clippy large_stack_arrays on the generated test descriptor array.
  • Document soft budget ≤1900 / hard ceiling 2048 per test target in dev-docs/standards/testing-and-quality.md.

Test plan

  • cargo test --lib -- --list → 1995
  • cargo test --test github_client (+ other new targets)
  • CLIPPY_CONF_DIR=.github/clippy cargo clippy --lib --tests --all-features -- -D warnings (no large_stack_arrays)
  • Full make ci-check

Fixes #307

Move GitHub client, layout, and other public behavioral suites out of
the lib harness so Clippy's large_stack_arrays ceiling no longer blocks
new independent tests. Document the per-target registration budget.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • review-ready
🚫 Excluded labels (none allowed) (2)
  • wip
  • do-not-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 659e4585-c2d3-4148-ab0c-3698c4e8327a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit 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.

Comment thread src/lib.rs
pub mod logging;
/// Single-pass HTML-to-text stripping for untrusted markdown (issue #155).
pub(crate) mod markdown_html_strip;
pub mod markdown_html_strip;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expanding markdown_html_strip from pub(crate) to pub adds new public API surface (strip_html_to_text, contains_open_tag). Because this crate is published (jefe 0.0.29), this is a semver-breaking API addition. If the intent is to expose it, consider adding explicit public docs/stability notes and a feature gate; otherwise keep it pub(crate).

Comment on lines +24 to +27
fn rest_page_1_with_more_yields_page_2() {
let token = PageToken::after_page(1, true);
assert_eq!(token, PageToken::PageNumber(2));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing boundary test for PageToken::after_page overflow: after_page(u32::MAX, true) should yield Done because page.checked_add(1) wraps to None. Without this test, an off-by-one or overflow regression in the after_page implementation would go undetected.

Comment on lines +42 to +51
#[test]
fn list_request_id_default_is_zero() {
assert_eq!(ListRequestId::default().get(), 0);
}

#[test]
fn list_request_id_checked_next_increments() {
let id = ListRequestId::from_raw(41);
assert_eq!(id.checked_next(), Some(ListRequestId::from_raw(42)));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing test for ListRequestId::from_raw(0).checked_next() and explicit consistency between Default and from_raw(0). The current tests verify from_raw(41) and from_raw(u64::MAX), but skip the zero boundary. Adding a test that default() == from_raw(0) and that from_raw(0).checked_next() yields Some(from_raw(1)) would close this gap.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

OpenCodeReview — PR #368

  • Reviewed head SHA: fca963b6ee3cc1355af7f6225cfc081b0d7c7879
  • Merge base: 40254186061171577a56590890fc0c41206a8b38
  • OCR version: open-code-review v1.7.9 (a32f852) linux/amd64 built at: 2026-07-14T03:41:57Z https://github.com/alibaba/open-code-review
  • Phase: review
  • Exit code: 0
  • Run: https://github.com/vybestack/llxprt-jefe/actions/runs/29993520738
  • 4 finding(s) (4 posted inline).
  • Artifacts: ocr-review-output contains raw JSON, stdout, stderr, preview, phase, and exit-code diagnostics.

@acoliver

Copy link
Copy Markdown
Contributor

@Ayush7614 failing ci

…ck#307)

Resolve conflicts with the landed rewrite/stateReason work, keep the
GitHub field-list regression in the integration target, document the
markdown_html_strip pub surface, and add pagination boundary coverage.
Keep the lib harness under Clippy's large_stack_arrays ceiling after
merging main, which reintroduced enough registrations to exceed 2048.
@Ayush7614

Copy link
Copy Markdown
Contributor Author

Rebased/merged latest main, resolved conflicts with #358/#359, cleared rustfmt/OCR nits, and moved CLI tests out of --lib so registrations stay under the Clippy descriptor ceiling (now 2044).

CI should be green for fmt/clippy/source-length; please re-check.

Comment thread tests/cli.rs
Comment on lines +28 to +30
fn parse(args: &[&str]) -> Result<CliArgs, CliError> {
parse_args(args.iter().map(|s| (*s).to_string()))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The parse test helper allocates a String for every argument via .to_string(), but parse_args already accepts S: Into&lt;String&gt; and &amp;str implements that trait directly. This extra allocation is unnecessary in test code. You can avoid it by using args.iter().copied() to pass &amp;str slices directly, letting Into::into perform the conversion when needed.

Comment thread tests/cli.rs
Comment on lines +35 to +38
assert_eq!(parsed, CliArgs::default());
assert!(!parsed.version);
assert!(!parsed.help);
assert!(parsed.config_dir.is_none());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The assertions !parsed.version, !parsed.help, and parsed.config_dir.is_none() are redundant because the preceding assert_eq!(parsed, CliArgs::default()) already verifies every field matches the default. If you want explicit field-level documentation, consider checking only the fields that are non-default or removing the redundant checks entirely.

#[test]
fn entity_window_on_multibyte_boundary_does_not_panic() {
let input = format!("&{}中", "a".repeat(MAX_ENTITY_LEN - 2));
let input = format!("&{}中", "a".repeat(12 - 2));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The hardcoded literal 12 replaces the previously referenced MAX_ENTITY_LEN constant. This creates a silent maintenance hazard: if MAX_ENTITY_LEN is ever changed, this test will no longer verify the multibyte boundary condition it was designed to check, because the input length will no longer align with the actual entity-scan window. Import and use the constant instead, e.g.: use jefe::markdown_html_strip::{contains_open_tag, strip_html_to_text, MAX_ENTITY_LEN};

assert_eq!(out, input, "unterminated entity passes through: {out:?}");
// Same shape with a 4-byte emoji on the boundary.
let input2 = format!("&{}😀", "a".repeat(MAX_ENTITY_LEN - 3));
let input2 = format!("&{}😀", "a".repeat(12 - 3));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue: hardcoded 12 - 3 should reference MAX_ENTITY_LEN so the test adapts if the entity window size changes.

@Ayush7614

Copy link
Copy Markdown
Contributor Author

@acoliver — CI update for this PR:

Green: fmt, clippy, source-length, coverage, Linux Build + Test, OCR. Mergeable with no conflicts. Lib registrations are under the Clippy descriptor ceiling (1996 / 2048 on Windows lib run).

Only red check: Native Windows (MSVC + psmux).

Root cause (not from the test-target split):

I don’t have rights to re-run failed jobs on upstream Actions. Could you please re-run the Native Windows job (or merge if you’re OK treating that flake as known)? Happy to iterate if you want anything else changed here.

@acoliver

Copy link
Copy Markdown
Contributor

@Ayush7614 I'll fix the win stuff probably in the am and merge this after. Thanks!

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.

Scale Rust test targets beyond the library descriptor ceiling

2 participants