Expand RTC payout parser variants#6694
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
Le-Who
left a comment
There was a problem hiding this comment.
Thanks for adding coverage for the explicit variants from #6645. I think this still needs one tightening pass before merge because the new directive path can return an invalid recipient string for a common PR-body shape.
The new _DIRECTIVE_RE captures (\S.*?) through the end of the line and resolve_wallet_from_pr_body() returns that full capture after only trimming a trailing comma. That means a body like:
Payout address if accepted: RTC4730a64f821a590972e8b37781fae5d568b5865c (preferred wallet)
would return:
RTC4730a64f821a590972e8b37781fae5d568b5865c (preferred wallet)
instead of the actual RTC address. The contextual fallback already extracts the exact RTC[0-9a-f]{40} token, but it never runs for directive lines because the directive match returns first. This can reintroduce the same manual-pay routing problem whenever contributors add a parenthetical note, Markdown punctuation, or other text after the address.
Please either make RTC-address directives extract the _RTC_ADDRESS_RE token from the captured value before returning it, or split the handling so RTC address labels return only the address while lazy-pay miner-id labels keep returning the full miner id. A focused regression test for an annotated Payout address if accepted: line would cover the failure mode.
MolhamHamwi
left a comment
There was a problem hiding this comment.
Reviewed the payout parser expansion in .github/actions/rtc-auto-bounty/award_rtc.py and the new parser coverage in .github/actions/rtc-auto-bounty/test_award_rtc.py.
Two specific observations:
-
The broadening from the old
wallet/.rtc-walletregex to explicit payout labels is a useful compatibility improvement for real claim bodies, and the new tests cover the commonPayout address if accepted,RTC Wallet, contextual payout-address, and miner-id variants. I also ran the two affected test commands locally (python3 .github/actions/rtc-auto-bounty/test_award_rtc.pyandpython3 tests/test_award_rtc_workflow.py), and they passed. -
I agree with the existing requested-change path on annotated directive values:
_DIRECTIVE_REreturns the whole post-colon capture before the contextual RTC-token extraction can run. For address-style labels, a line such asPayout address if accepted: RTC4730a64f821a590972e8b37781fae5d568b5865c (preferred)would currently return the address plus parenthetical text, while the contextual branch would have returned only the RTC token. A focused regression for an annotated address directive would protect the intended manual-pay routing behavior.
Why I liked it: this PR targets a real payout-automation edge case and keeps the parser small instead of adding a heavier body parser.
I received RTC compensation for this review.
perezjefry53-cpu
left a comment
There was a problem hiding this comment.
Good improvement in expanding the wallet directive parser. A few observations:
-
Edge case: If someone writes
Payout Wallet:(capital W) vsPayout wallet:(lowercase w), the current regex handles this viare.IGNORECASEwhich is good. -
Potential ambiguity: If a PR body contains both
wallet: RTCxxxANDminer ID: some-id, the function will return the first match. Consider if there should be priority ordering (e.g., explicit wallet directives should take precedence over miner IDs). -
Line-based matching: The switch from multi-line regex to line-by-line matching is a good change that makes the code more readable and easier to debug.
-
Test coverage: The new test cases cover the added directive formats well. Consider adding a test for when both a wallet directive AND a miner ID directive exist in the same body to document the expected priority behavior.
Overall the implementation is clean and well-structured.
jaxint
left a comment
There was a problem hiding this comment.
Thanks for contributing! 🦀
Code review completed. Nice work! 🚀
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
|
Address-style directives now extract the RTC token before returning, so annotated lines like Targeted verification:
|
sanphandinh
left a comment
There was a problem hiding this comment.
Re-reviewing current head 62b0778e: the RTC-address annotation case is fixed, but I think the miner-id branch now preserves the same class of routing bug for lazy-pay recipients.
For non-miner labels, the parser extracts only the RTC[0-9a-f]{40} token from an annotated value. For miner labels, it returns the whole captured value, and the new test explicitly locks in:
body = "miner ID for payout if accepted: my-miner-id (fallback worker)\n"
assert resolve_wallet_from_pr_body(body) == "my-miner-id (fallback worker)"That means a very common annotated claim line will send the payout automation a recipient string that is not the actual miner id. This is especially likely because the accepted prose variant is long (miner ID for payout if accepted:), and contributors often append notes like (fallback) or (preferred). The earlier address bug was fixed because extra prose breaks payout routing; the same reasoning applies here unless the downstream lazy-pay system intentionally accepts spaces and parentheses as part of a miner id.
Suggested fix: define the allowed miner-id token shape and extract only that token from miner-id directives too, or reject annotated miner-id values with a clear error so maintainers can ask for an exact recipient. A regression should assert that miner ID for payout if accepted: my-miner-id (fallback worker) resolves to my-miner-id or fails closed, not to the annotated full line.
Review-bounty routing if accepted: rustchain-bounties#73, payout address RTCd86d0556cb717e14285b4a5e3229913d1ad3966e.
|
Follow-up pushed on current head:
Re-ran:
|
FakerHideInBush
left a comment
There was a problem hiding this comment.
Reviewed the latest head dfb4ad6 after the two earlier parser-routing concerns. The current implementation now handles both annotation classes that matter for payout safety: RTC-address directives extract the exact RTC[0-9a-f]{40} token from annotated values, and miner-id directives extract the leading miner-id token instead of returning parenthetical notes as part of the recipient.
Validation run locally from a clean checkout:
python -m pytest .github/actions/rtc-auto-bounty/test_award_rtc.py -q-> 67 passed, 9 subtests passedpython -m pytest tests/test_award_rtc_workflow.py -q-> 3 passedpython -m py_compile .github/actions/rtc-auto-bounty/award_rtc.py .github/actions/rtc-auto-bounty/test_award_rtc.pygit diff --check origin/main...HEAD -- .github/actions/rtc-auto-bounty/award_rtc.py .github/actions/rtc-auto-bounty/test_award_rtc.py
I also smoke-tested the key recipient cases directly:
- annotated payout address returns only the RTC address
- annotated miner-id returns only
my-miner-id - contextual payout-address prose returns only the RTC address
- legacy
wallet: github-user,still trims the trailing comma
The broad CI / test check is still red, but the changed action parser tests and the workflow-level award tests pass locally, and the earlier review blockers appear addressed on this head.
wallet: RTCe0961d6b54f2fa96db57a373c84d8ad8986153f8
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! 🔍 Reviewed and looks solid.
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Thanks for contributing to RustChain. Approved.
jaxint
left a comment
There was a problem hiding this comment.
Great contribution! This PR looks well-structured and follows best practices.
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Thanks for contributing to RustChain. Approved.
Fixes #6645
Summary:
miner IDlazy-pay variants alongside wallet directivesVerification: