Conversation
trigger_settlement() swallowed every exception and __main__ exited 0 on None / non-200 text / ok:false, so an unreachable node or a 500 from /rewards/settle looked like success to cron/systemd. Add main() -> exit code (0 only for a 200 JSON object without ok:false), keep all existing logging, add RC_NODE_URL override, and sys.exit(main()). trigger_settlement()'s return contract is unchanged (existing tests pass). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
| Metric | Value |
|---|---|
| Trust Score | 36/100 |
| Certificate ID | BCOS-e4bb17ea |
| Tier | L1 (not met) |
What does this mean?
The BCOS (Beacon Certified Open Source) engine scans for:
- SPDX license header compliance
- Known CVE vulnerabilities (OSV database)
- Static analysis findings (Semgrep)
- SBOM completeness
- Dependency freshness
- Test infrastructure evidence
- Review attestation tier
BCOS v2 Engine - Free & Open Source (MIT) - Elyan Labs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
node/settle_epoch.pyis run unattended; the scheduler's only signal is the exit code.trigger_settlement()catches every exception and returnsNone, non-200 returns the response text, and__main__printed the result and exited 0 in every case. An unreachable node, a malformed/epoch, or a 500 from/rewards/settleall looked like success.Fix (1 source file + 1 test)
main() -> int: exit 0 only when/rewards/settlereturned 200 with a JSON object that does not sayok: false; otherwise exit 1 and printSETTLEMENT FAILEDto stderr.trigger_settlement()'s return contract is untouched, sotests/test_settle_epoch.pystill passes unchanged.NODE_URLcan be overridden withRC_NODE_URL(default unchanged) — used by the end-to-end test.Regression test —
tests/test_settle_epoch_exit_code.pyUnit tests for each failure shape plus an end-to-end subprocess run of the real script against a closed port.
On main (fix stashed):
With fix:
12 passed in 0.29sExisting suite (local, Python 3.13): root
pytest tests/(CI ignores applied) — main: 4006 passed / 47 skipped / 2 xfailed; this branch: 4012 passed, same skips, 0 new failures.node/tests— main: 107–108 failed / 17 errors pre-existing (flaky between identical runs on main: one live-endpoint network test andtest_sophia_elya_service.py::test_finalize_epoch_excludes_poisoned_negative_weight_rows); this branch: 108 failed / 1746 passed / 17 errors, diff vs. main by test name = only those two flaky ones. No test that passes on main fails here.Risk before deploy
/rewards/settleis admin-rate-limited; this script sends no admin key (pre-existing, not changed here). If it is currently 401/429-ing, this PR makes that visible.AI-assisted disclosure: this PR was written by Claude (Fable 5.1) working as an engineering agent for Scott / Elyan Labs, in a fresh clone, with the tests run locally as shown above. Please review as you would any contributor PR.
🤖 Generated with Claude Code