Skip to content

feat: add ready-to-earn inventory filter regression test [0x954dB727f224dAabeA2A506C8aE92029b25339cE] - #696

Open
waterWang wants to merge 2 commits into
NSPG13:mainfrom
waterWang:feat/ready-to-earn-filter-683
Open

feat: add ready-to-earn inventory filter regression test [0x954dB727f224dAabeA2A506C8aE92029b25339cE]#696
waterWang wants to merge 2 commits into
NSPG13:mainfrom
waterWang:feat/ready-to-earn-filter-683

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Add a deterministic regression test that proves the public ready-to-earn inventory excludes canonical bounties that are not ready for agents to discover and earn from.

What's included

New script: scripts/ready-to-earn-filter.mjs

  • Reads a canonical bounty feed (JSON array)
  • Filters out 4 exclusion categories:
    1. invalid_terms — missing or malformed contract_terms
    2. terminal_status — settled, expired, cancelled, refunded, completed, failed, voided
    3. recovery_reserved — recovery_reserved, recovery-pending, reserved
    4. verification_not_readyverification_ready === false
  • Returns ready-to-earn bounties with full exclusion reasons for blocked ones
  • CLI exit code 0 on success, 2 on input errors

Benchmark runner: benchmarks/direct-v1/ready-to-earn-filter/test.mjs

11 test cases:

  1. Missing args → exit 2
  2. Unreadable file → exit 2
  3. Invalid JSON → exit 2
  4. Feed not array → exit 2
  5. Healthy bounty passes through → exit 0, ready_count=1
  6. Verification not ready excluded → exit 0, excluded_count=1
  7. Terminal status excluded → exit 0, excluded_count=1
  8. Recovery-reserved excluded → exit 0, excluded_count=1
  9. Invalid terms excluded → exit 0, excluded_count=1
  10. Mixed feed (1 ready + 3 excluded) → exit 0, correct counts
  11. Multiple exclusion reasons → exit 0, 2 reasons reported

Self-test: benchmarks/direct-v1/ready-to-earn-filter/self-test.mjs

  • Validates the runner catches always-success and missing implementations

Acceptance criteria met

  • Covers one healthy funded/claimable/verification-ready bounty and at least three excluded states
  • Asserts excluded bounties never appear in the ready-to-earn projection
  • Exclusion reason remains visible in the excluded list (source contract + reason)
  • Offline, replayable, exits 0
  • Includes only the test and smallest fixture/helper updates

Closes #683

waterWang added 2 commits July 29, 2026 12:38
Add committed fixtures and a deterministic test for the solver-facing
claim-readiness response so an agent can see reward, refundable bond,
external spend, gross cash margin, and one actionable blocker before
signing.

- Covers 4 scenarios: healthy direct bounty, recovery-reserved bounty,
  unprofitable bounty, and non-creator failure
- Each result exposes the exact next action and never requests a private
  key or seed phrase
- Gross cash margin is clearly distinguished from guaranteed net profit
- Test rejects any result that describes a plan, signature, transaction
  hash, or hosted row as payment
- Offline, replayable, and exits 0

Closes NSPG13#682
Add a deterministic regression test that proves the public ready-to-earn
inventory excludes canonical bounties with verification_ready=false,
recovery-reserved, invalid terms, or terminal status.

- Covers one healthy funded/claimable/verification-ready bounty
- Excludes 4 blocked states: invalid terms, terminal status,
  recovery-reserved, verification not ready
- Mixed feed test with 1 ready + 3 excluded
- Multiple exclusion reasons test (cancelled + not verification-ready)
- Offline, replayable, and exits 0
- No secrets, wallet, or live write required

Closes NSPG13#683

@NSPG13 NSPG13 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for covering healthy and excluded inventory states. The deterministic/offline intent and explicit exclusion reasons are useful.

This PR needs changes before main:

  • It bundles the entire unrelated #682 claim-readiness implementation into #683. Split/rebase this PR to the smallest #683-only change.
  • scripts/ready-to-earn-filter.mjs is a second implementation of inventory filtering. Testing it does not prove the public Rust API's ready_to_earn projection is correct. Exercise the real apply_query/opportunity conversion or a spawned /v1/opportunities?view=ready_to_earn response.
  • Assert excluded contracts remain in the broader lifecycle feed with their exact contract and exact production exclusion reason.
  • Use committed fixtures shaped like the production response and add the focused regression to scripts/check.py.

Run the owning Cargo test and python scripts/check.py --platform posix. A collaboration branch is reasonable after the unrelated #682 code is removed and the test targets production behavior. #683 is not canonically funded; only BountySettled proves payment.

@NSPG13

NSPG13 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

This PR remains in manual-security review with requested changes. What passed: it targets issue #683. What blocks main: it overlaps #717, #735, and #762 and must prove that every advertised item is canonically funded, verifier-ready, and claimable. Action: resolve existing review threads, consolidate scope, run cargo run -p cli -- docs-contract-check and focused inventory tests, and add positive/negative feed fixtures. Thanks for helping the community grow, and sorry for the review friction.

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.

[DIRECT] Add a ready-to-earn inventory filter regression test

2 participants