Skip to content

test(rust): cover package filters, edge selectors, and null metadata in Rust views - #7100

Open
saiyam-jain-dev wants to merge 2 commits into
morluto:mainfrom
saiyam-jain-dev:test/rust-binary-view-coverage
Open

saiyam-jain-dev wants to merge 2 commits into
morluto:mainfrom
saiyam-jain-dev:test/rust-binary-view-coverage

Conversation

@saiyam-jain-dev

@saiyam-jain-dev saiyam-jain-dev commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds unit test coverage in src/domain/analysisView/rustBinaryView.test.ts for package filtering (names, versions, indices), dependency edge selection (from_indices, to_indices), null auditable_metadata handling with compiler commit projections, and invalid view kind rejections in Rust analysis views.

Problem and expected behavior

While projectRustBinaryView supports filtering packages by names, versions, and indices, projecting requested dependencies collections, filtering dependency edges by from_indices and to_indices, projecting binaries without cargo-auditable metadata (auditable_metadata: null), and rejecting unsupported view kinds with analysisViewInputError, these code paths lacked unit test coverage in rustBinaryView.test.ts.

Change and scope

  • Added tests in src/domain/analysisView/rustBinaryView.test.ts verifying:
    • Package filtering by names, versions, and indices, including requested dependencies.
    • Dependency edge filtering by from_indices, to_indices, and fields.
    • Null auditable_metadata summary handling, compiler rustc_commit hashes count projection, and empty package collections.
    • Rejection of unsupported view kinds (e.g. cve) with AnalysisInputError.

Contribution scope fit: test-only coverage improvement within existing boundaries (not applicable).

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/domain/analysisView/rustBinaryView.test.ts.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: platform-independent.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/domain/analysisView/rustBinaryView.test.ts
  • Base reproduction or other evidence: previously uncovered projection and filtering branches.
  • User-visible CLI/MCP output: none.
  • Remaining proof gaps: none.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npx vitest run src/domain/analysisView/rustBinaryView.test.ts — passed (10 passed in 40ms)
  • npm run check:fast (turbo run typecheck lint) — passed cleanly (2/2 tasks successful in 1m26s)

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner: @saiyam-jain-dev

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Low impact] The changes stay within Rust analysis-view test coverage.

The test requirement must be satisfied before merging; all three previous findings remain outstanding.

Findings

  1. P2 Index filters remain untested ▶
  2. P2 Package fixture hides broken behavior ▶
  3. P2 Test freezes explanatory wording ▶
Fix with agent prompt
### Issue 1
src/domain/analysisView/rustBinaryView.test.ts:239-241
Both new filter tests claim to cover `indices`, but neither request supplies it. Checking an output row's `index` does not test the input filter. Ignoring `indices` for either collection would still pass these tests.

Add package and edge requests where `indices` excludes an otherwise matching row.

### Issue 2
src/domain/analysisView/rustBinaryView.test.ts:213-220
This fixture lets two failures pass:
- Only `serde` has version `1.0.100`, so removing the `names` check still produces the expected row.
- The selected row has empty `dependencies`, so replacing every dependency list with `[]` still passes.

Add a differently named package with the same version and select a package with a nonempty dependency list.

### Issue 3
src/domain/analysisView/rustBinaryView.test.ts:343-347
The new `stringContaining` check makes a harmless message rewrite fail the test. The preceding assertions already check missing metadata and unknown coverage.

`AGENTS.md` requires test changes to follow `docs/testing.md`, which says to assert facts instead of freezing explanatory wording. Remove this sentence check, or compare with the owning message if testing its delivery is necessary. This repository requirement must be satisfied before merging.

```suggestion

```

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Rust view tests for package and edge filters, missing metadata, compiler hash counts, and unsupported view kinds.

  • Rust package-view tests cover combined filters and selected fields.
  • Rust edge-view tests cover endpoint filters and selected fields.
  • Rust view tests cover summaries and package pages with missing metadata.
  • Rust view tests check that unsupported view kinds return input errors.

Reviews (2) · Last reviewed commit: "test(rust): retrigger ci" · Reviewed by Greptile

Comment on lines +239 to +241
names: ["serde"],
versions: ["1.0.100"],
fields: ["name", "version", "dependencies"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Index filters remain untested

Both new filter tests claim to cover indices, but neither request supplies it. Checking an output row's index does not test the input filter. Ignoring indices for either collection would still pass these tests.

Add package and edge requests where indices excludes an otherwise matching row.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/analysisView/rustBinaryView.test.ts
Line: 239-241

Comment:
**Index filters remain untested**

Both new filter tests claim to cover `indices`, but neither request supplies it. Checking an output row's `index` does not test the input filter. Ignoring `indices` for either collection would still pass these tests.

Add package and edge requests where `indices` excludes an otherwise matching row.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +213 to +220
value.auditable_metadata!.packages.push(
{
name: "serde",
version: "1.0.100",
source: "crates.io",
kind: null,
root: false,
dependencies: [],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Package fixture hides broken behavior

This fixture lets two failures pass:

  • Only serde has version 1.0.100, so removing the names check still produces the expected row.
  • The selected row has empty dependencies, so replacing every dependency list with [] still passes.

Add a differently named package with the same version and select a package with a nonempty dependency list.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/analysisView/rustBinaryView.test.ts
Line: 213-220

Comment:
**Package fixture hides broken behavior**

This fixture lets two failures pass:
- Only `serde` has version `1.0.100`, so removing the `names` check still produces the expected row.
- The selected row has empty `dependencies`, so replacing every dependency list with `[]` still passes.

Add a differently named package with the same version and select a package with a nonempty dependency list.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +343 to +347
expect(summary.value.unknowns).toEqual(
expect.arrayContaining([
expect.stringContaining("No cargo-auditable metadata was observed"),
]),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Test freezes explanatory wording

The new stringContaining check makes a harmless message rewrite fail the test. The preceding assertions already check missing metadata and unknown coverage.

AGENTS.md requires test changes to follow docs/testing.md, which says to assert facts instead of freezing explanatory wording. Remove this sentence check, or compare with the owning message if testing its delivery is necessary. This repository requirement must be satisfied before merging.

Suggested change
expect(summary.value.unknowns).toEqual(
expect.arrayContaining([
expect.stringContaining("No cargo-auditable metadata was observed"),
]),
);

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/analysisView/rustBinaryView.test.ts
Line: 343-347

Comment:
**Test freezes explanatory wording**

The new `stringContaining` check makes a harmless message rewrite fail the test. The preceding assertions already check missing metadata and unknown coverage.

`AGENTS.md` requires test changes to follow `docs/testing.md`, which says to assert facts instead of freezing explanatory wording. Remove this sentence check, or compare with the owning message if testing its delivery is necessary. This repository requirement must be satisfied before merging.

```suggestion

```

**Context Used:** AGENTS.md ([source](https://github.com/morluto/rea/blob/main/AGENTS.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@saiyam-jain-dev
saiyam-jain-dev marked this pull request as ready for review October 25, 2026 09:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-25T12:29:02.407313Z 3bf2421 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@saiyam-jain-dev

Copy link
Copy Markdown
Contributor Author

@codex review

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: The new Rust view tests pass on Node 22.23.4, 24.22.1 and 26.12.1. Two test titles name an indices filter that neither test uses. The head is 1,260 commits behind main b81da90, and I did not test a merge with it.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
src/domain/analysisView/rustBinaryView.test.ts pass (1 file, 10 tests) pass (1 file, 10 tests) pass (1 file, 10 tests)

I ran head 3bf2421 in a VM on all three Node versions.

The test filters packages by name, version, and indices, projecting requested dependencies (line 211) passes names and versions to projectAnalysisView (lines 234-242). It passes no indices.

The test filters dependency edges by from_indices, to_indices, and indices (line 256) passes from_indices and to_indices (lines 292-300). It passes no indices either.

So both titles name the indices filter, but neither test exercises it. One idea: add indices to one case in each test, or drop indices from the titles.

CI on 3bf2421: all 17 check runs that ran passed. They include CI required, Static checks, Source tests, Portable tests and the test shards. PR readiness passed. GitHub says the PR is mergeable, and its merge state is clean.

Not run

  • A real Rust binary with cargo-auditable metadata.
  • A merge with current main, b81da90.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: 3bf2421 / 113679c (merge base with main)
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1, exit 0
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- src/domain/analysisView/rustBinaryView.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@CassieFox23

Copy link
Copy Markdown
Contributor

Hi! This PR's checks pass, but GitHub shows a merge conflict with main. A rebase on main should clear it, and then it's ready for a maintainer to review. No rush.

🤖 Written with Claude Code (Opus 5.5), posted with my OK 🦊

This branch has not been deployed

No deployments
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.

2 participants