Skip to content

test(agent-stub): pin nearest-gap note order and refused substitution - #8448

Merged
EffortlessSteven merged 2 commits into
mainfrom
cursor/agent-stub-at-note-tests-3abc
Oct 17, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
cursor/agent-stub-at-note-tests-3abc

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Advances #8444 (item 3 only).

Summary

Tests-only pin of the #8364 nearest-gap disclosure on ripr agent stub --at.

The existing #8364 test at_a_line_without_a_gap_names_the_nearest_gap_it_stubbed lives in app/test_stub.rs, calls resolve_test_stub with return_value only, and never sees disclosure.warnings.insert(0, note). This PR does not duplicate it.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR

Source-of-truth Links

Governing issue: #8444 item 3 (tests that pin the disclosure).
Spec: RIPR-SPEC-0122 (ripr agent stub --at).
Merged parent: #8364.

Candidate Relationships

Candidate branch: cursor/agent-stub-at-note-tests-3abc
No stack parent. No replacement of another PR.

Scope

Production delta

None.

Evidence/support delta

  • CLI adapter unit tests in agent_stub.rs: off-line predicate --at stays ready; off-line --at that then refuses is a post-resolution owner_async Decision, not seam_not_found.
  • Binary integration tests in crates/ripr/tests/agent_stub_at_disclosure.rs: JSON warnings[0] is the substitution note and warnings[1] is the strongly-gripped omission (so dropping insert(0) fails); the same note leads human stdout; a substituted-then-refused --json envelope keeps the note first.
  • policy/process_allowlist.txt: one Command::new for that binary harness.

Single acceptance criterion

Dropping disclosure.warnings.insert(0, note.clone()), or changing it to push, fails a test.

Non-goals

Scope Classification

  • Docs/spec/test-only evidence package

Support-tier Impact

  • none

Policy Impact

  • process/network

Ledger: one test-only spawn allowlist row for crates/ripr/tests/agent_stub_at_disclosure.rs.

Proof

cargo test -p ripr --lib off_line_   # 2 passed
cargo test -p ripr --test agent_stub_at_disclosure   # 2 passed
cargo xtask precommit   # pass
cargo xtask check-fast   # pass, base=origin/main

What this proves: the CLI adapter puts the nearest-gap note first among disclosure warnings for a predicate off-line --at, and a substituted --at that then refuses still names that nearest seam in the JSON envelope.

What this does not prove: hosted merge-gate completeness until required checks are terminal; check recommendation correctness (item 1); direct return_value stubbing (item 2).

Claim Boundary

May claim: the CLI adapter's nearest-gap note is first among disclosure warnings for a predicate off-line --at, and a substituted --at that then refuses still names that nearest seam in the JSON envelope.

Must not claim: check recommends a command that stubs the named line; return_value is stubbed directly; human refusal stderr prints the substitution note (that arm does not print disclosure.warnings; stdout stays empty on refusal). Items 1 and 2 remain open.

Rollback

Revert the commits. Tests-only; no production rollback.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0122
  • Tests: agent_stub.rs off_line_*; crates/ripr/tests/agent_stub_at_disclosure.rs
  • Code: unchanged agent_stub.rs insert(0)
  • Golden outputs: none
  • Metrics: none

Exact candidate SHA: fb07ee3013f7e7f72c6f0f17210a29fe88b38b1f

Open in Web Open in Cursor 

The #8364 use-case test only covers return_value through resolve_test_stub.
Pin the CLI adapter: insert(0) puts the note ahead of grip-class warnings
for a predicate --at, and an off-line --at that then refuses still names
that nearest seam.

Advances #8444 (item 3 only).

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 71da739e-135d-441c-a6c5-ff82917aa325
📥 Commits

Reviewing files that changed from the base of the PR and between 2958fdc and fb07ee3.

📒 Files selected for processing: 4
  • changelog.d/8444-agent-stub-at-note-tests.md
  • crates/ripr/src/cli/commands/agent_stub.rs
  • crates/ripr/tests/agent_stub_at_disclosure.rs
  • policy/process_allowlist.txt

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Summary by CodeRabbit

  • Tests
    • Added coverage for ripr agent stub --at when a selector is near a predicate gap, including cases where the gap belongs to an async function.
    • Verified that substitution notes appear before other warnings in JSON and human-readable output, and that async refusals explain the reason while preserving the resolved seam in JSON.

Walkthrough

This change adds CLI and integration tests for off-line --at predicate selectors. The tests check nearest-gap resolution, refusal details for async predicates, and the ordering of disclosure notes in JSON and human output.

Changes

Agent stub off-line selector tests

Layer / File(s) Summary
CLI nearest-gap resolution tests
crates/ripr/src/cli/commands/agent_stub.rs
Adds test fixtures and CLI tests that select a function’s closing brace. The tests check nearest-gap resolution for a synchronous predicate and an owner_async refusal for an async predicate.
Integration disclosure tests
crates/ripr/tests/agent_stub_at_disclosure.rs, policy/process_allowlist.txt, changelog.d/8444-agent-stub-at-note-tests.md
Adds integration tests for nearest-gap notes in JSON and human output. The tests check warning order and async refusal details. The allowlist permits the test’s CLI process spawn, and the changelog records the test coverage.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to fb07e

The added tests cover the stated selector and disclosure behavior, with no identified issue requiring a change before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the test-only change: it pins nearest-gap note ordering and refused substitution behavior for agent-stub.
Description check Passed The description is detailed and aligned with the template. It defines scope, acceptance criteria, non-goals, policy impact, proof, claim boundaries, rollback, and traceability. It omits explicit entri…
Full details: Description check

Explanation

The description is detailed and aligned with the template. It defines scope, acceptance criteria, non-goals, policy impact, proof, claim boundaries, rollback, and traceability. It omits explicit entries for the Static Language Check, Engineering Check, Gates, and CI Economics sections, but the missing sections are not critical for this tests-only change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the nearest gap,
Then reads the notes in JSON’s lap.
The async seam says why it’s stopped,
The warning order stays un-swapped.
Tests hop through each disclosed detail.

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

The new integration test runs the worktree-built ripr binary once against
an isolated scratch crate. Record that spawn in the process allowlist.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Author self-review on published head fb07ee3013f7e7f72c6f0f17210a29fe88b38b1f. GitHub cannot request-changes from the author; COMMENT is not approval.

reviewed_head_sha: fb07ee3013f7e7f72c6f0f17210a29fe88b38b1f
integration_basis: origin/main 71859f93d (branch base); GitHub base has since moved to 2958fdc (behind-only, no content conflict)
claim_boundary: #8444 item 3 tests only — pin CLI warning order for the #8364 nearest-gap note, a non-return_value family, and refused substitution. No production change. Items 1–2 out of scope.
changed_surfaces_and_semantic_owners_inspected:
- cli/commands/agent_stub.rs mod tests (CLI adapter owner)
- crates/ripr/tests/agent_stub_at_disclosure.rs (rendered CLI)
- policy/process_allowlist.txt (one test spawn)
- changelog.d/8444-agent-stub-at-note-tests.md
- production insert(0) path in run_agent_stub (unchanged)
- existing #8364 test in app/test_stub.rs (not duplicated)
blocking_findings: none
non_blocking_suggestions:
- Human refusal still omits disclosure.warnings (stdout empty; Decision names owner_async only). JSON envelope does carry the note first. Recorded on #8444; not a production fix in this tests-only lane.
refuted_or_stale_findings:
- Gemini quota and CodeRabbit rate-limit comments are missing-review, not clean review.
- Devin Review status is "Full review skipped: trial expired" — missing, not a pass.
proof_and_ci_observed:
- cargo test -p ripr --lib off_line_: 2 passed
- cargo test -p ripr --test agent_stub_at_disclosure: 2 passed
- cargo xtask precommit: pass (after process-allowlist for Command::new)
- cargo xtask check-fast: pass, base=origin/main, 3 committed files then +allowlist
- Hosted checks on this head: in progress (paste matrix, rust-only, windows-advisory-subset, wheel inspect); several lanes skipped-by-policy
proof_or_review_missing:
- Required hosted merge-gate terminal result for this exact head
- External reviewers (Gemini/CodeRabbit/Devin) unavailable or quota-skipped
affected_currentness_dimensions: test stimulus, test oracle, candidate head identity
residual_assumptions_and_non_claims:
- Does not prove check recommends a command that stubs L (item 1)
- Does not stub return_value directly (item 2)
- Does not claim human refusal stderr prints the substitution note
disposition: REVIEW_INCOMPLETE until required hosted checks are terminal on this head; source/oracle inspection found no blocker. Merge convergence waits on REVIEW_READY after that CI dimension.

Oracle challenge: dropping insert(0) or changing it to push fails off_line_predicate_note_precedes_the_grip_class_warning (warnings[0] would not be the note while warnings[1] is the strongly_gripped omission). A selector miss instead of substituted refusal fails both the unit Decision pin and the JSON envelope (seam_id null / empty warnings). The #8364 return_value/resolve_test_stub test is not duplicated; this lane uses predicate through run_agent_stub and the binary.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions Bot left a comment

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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • Both new test files use std::env::temp_dir() for scratch crate roots; not parallel-safe by default but each file uses unique PID + stamp/atomic-counter suffixes, and each path is cleaned up via Drop (integration) or explicit remove_dir_all (unit). Cleanup is best-effort on panic but no observed shared-path collision.

Verification questions

  • Confirm unit tests use label+PID for scratch dir; integration tests use label+PID+AtomicU64 counter. Parallel CI runs are safe either way, but the asymmetry is an inconsistency, not a flaw.
  • Confirm scratch_crate uses std::env::temp_dir() directly; comment says .cargo/config.toml redirects TMPDIR but code does not honor TMPDIR explicitly. Comment is informational but the unit tests will fail on a fresh worktree if TMPDIR is set to target/. The integration tests share the same risk since CARGO_BIN_EXE_ripr child inherits env.

Refuted

  • Human refusal path also prints disclosure.warnings on stdout; refuted because: PR body explicitly states human refusal stdout stays empty and Decision names owner_async only; the unit test off_line_at_that_ends_in_a_refusal_names_the_nearest_seam matches only Err(CommandError::Decision(message)) and checks the message body. Item not in this PR's claim boundary.
  • Unit off_line_at_that_ends_in_a_refusal_names_the_nearest_seam does not red/green the JSON insert(0) behavior it is advertised to pin.; refuted because: The unit intentionally covers the post-resolution Decision path; the JSON-order pin lives in agent_stub_at_disclosure.rs::off_line_at_that_refuses_keeps_the_note_first_in_json_warnings. Claim boundary (#8444 item 3, both families) is honored.
  • failing_objection2_hypothesis: The async-predicate refused-substitution test could pass even if insert(0) is removed because the refusal envelope might not include warnings at all, and first() on an empty array returns None which would fail. So the test is order-sensitive only if warnings is non-empty.; refuted because: For a substituted refusal the run_agent_stub path still constructs a Disclosure with the note inserted at index 0 before matching the outcome Decision. The envelope is required to carry warnings; first().and_then(as_str) must yield the substitution note. The test's seam_id non-null assertion plus warnings.first() non-None gate ensures the note is present and first.

Parked follow-ups

  • Integration test off_line_at_that_refuses_keeps_the_note_first_in_json_warnings uses a unique atomic SEQUENCE; SEQUENCE.fetch_add only seeds one fixture while Scratch::create is called once. Parallel-safe but unused-since-once.
  • scratch_crate in mod tests and Scratch in integration file duplicate ~20 lines of crate-from-fixture setup with cosmetic differences (AtomicU64 sequence vs SystemTime nanos).
  • Integration test parses refusal envelope by finding literal 'ripr: agent stub: ' inside stderr; brittle if error prefix changes but no diff evidence it's brittle today. Parked.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Classification of ub-review 5557702807 on fb07ee301

No repair. No head change. The review is COMMENTED with zero inline threads.

Confirmed finding (temp_dir scratch roots)

Incorrect as a defect. Both helpers already uniquify the directory:

  • unit scratch_crate: ripr-agent-stub-at-{label}-{pid}-{nanos}
  • integration Scratch: ripr-agent-stub-at-disclosure-{label}-{pid}-{seq}

std::env::temp_dir() on Unix is the TMPDIR-honoring API. .cargo/config.toml force-sets TMPDIR/TEMP/TMP to workspace target. The #6712 comment is why create_dir_all(&parent) exists: a fresh worktree may not have target/ yet. Cargo-test children inherit that env; the binary harness does too. This is the same pattern as other in-tree CLI scratch tests, not a new race.

PID+stamp vs PID+AtomicU64: inconsistency, not a flaw. Parked; not worth a tests-only head churn.

Parked follow-ups

Fixture duplication and the ripr: agent stub: stderr prefix parse are parked. Not claim-falsifying. Head stays frozen per tests-only / freeze-except-real-failures.

CodeRabbit

Completed with no actionable comments. Docstring-coverage warning on test helpers is not a repository required check and is not a source defect.

Gemini / Devin

Quota / trial-expired: missing review, not a pass and not a blocker when this classification plus author self-review exist.

Disposition for this finding set: no blocking defect. Merge still waits on terminal required hosted checks for this exact head (Ripr Rust Small Result and remaining in-progress lanes).

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Published-head review-pr on exact SHA fb07ee3013f7e7f72c6f0f17210a29fe88b38b1f. GitHub cannot request-changes from the author; COMMENT is not approval.

reviewed_head_sha: fb07ee3013f7e7f72c6f0f17210a29fe88b38b1f
integration_basis: GitHub base 2958fdc (behind-only vs candidate; mergeable_state=clean, no content conflict)
claim_boundary: #8444 item 3 tests only — pin CLI warning order for the #8364 nearest-gap note, a non-return_value family, and refused substitution. No production change. Items 1–2 out of scope.
changed_surfaces_and_semantic_owners_inspected:
- cli/commands/agent_stub.rs mod tests (CLI adapter owner)
- crates/ripr/tests/agent_stub_at_disclosure.rs (rendered CLI)
- policy/process_allowlist.txt (one test spawn)
- changelog.d/8444-agent-stub-at-note-tests.md
- production insert(0) path in run_agent_stub (unchanged)
- existing #8364 test in app/test_stub.rs (not duplicated)
blocking_findings: none
non_blocking_suggestions:
- Human refusal still omits disclosure.warnings (stdout empty; Decision names owner_async only). JSON envelope does carry the note first. Recorded on #8444; not a production fix in this tests-only lane.
refuted_or_stale_findings:
- ub-review 5557702807 temp_dir scratch finding: not a defect (PID+stamp/seq uniquify; std::env::temp_dir honors Cargo TMPDIR redirect). Classified in PR comment 6233722898. Zero inline threads.
- CodeRabbit: no actionable comments; docstring-coverage warning on test helpers is not a required check.
- Gemini quota and Devin trial-expired: missing-review, not a pass.
proof_and_ci_observed:
- cargo test -p ripr --lib off_line_: 2 passed
- cargo test -p ripr --test agent_stub_at_disclosure: 2 passed
- cargo xtask precommit: pass
- cargo xtask check-fast: pass
- Hosted exact-head: Ripr Rust Small Result SUCCESS; Ripr Rust Small on GitHub Hosted / Rust gates SUCCESS; Rust-only feature lane SUCCESS; ub-review SUCCESS; paste matrix SUCCESS; windows-advisory-subset SUCCESS; wheel inspect SUCCESS. Remaining lanes skipped-by-policy. No failures.
proof_or_review_missing: none load-bearing for this tests-only claim. Gemini/Devin remain unavailable.
affected_currentness_dimensions: test stimulus, test oracle, candidate head identity, exact-head CI receipts
residual_assumptions_and_non_claims:
- Does not prove check recommends a command that stubs L (item 1)
- Does not stub return_value directly (item 2)
- Does not claim human refusal stderr prints the substitution note
disposition: REVIEW_READY

Oracle challenge unchanged: dropping insert(0) or changing it to push fails off_line_predicate_note_precedes_the_grip_class_warning. A selector miss instead of substituted refusal fails the unit Decision pin and the JSON envelope (seam_id null / empty warnings).

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