You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bring the name contract to btclib's walks, with validate_ and async (closes #490) - #491
ecc's name contract test is the source btclib's copy is ported from, and btclib's had moved ahead: validate_ in the vocabulary (btclib-org/btclib#2960), every definition of a name held to its prefix instead of the last one only, async def read, and class members keyed by their dotted path (btclib-org/btclib#2963). This brings ecc's tests/name_contract_test.py to those walks, adds validate_ to _PROMISED and _NOT_A_READ, and adds the rule decided in btclib-org/btclib#2964: an async def carries none of the prefixes, since a call without await answers a coroutine, which is true for is_, check_ and verify and refuses nothing for assert_ and validate_. CONTRIBUTING.md's vocabulary says so.
Nothing in src/ecc changes verdict: ecc.frost.validate_threshold_info is now held to validate_'s promise and keeps it, no name is defined twice, and there is no async def. What still differs from btclib's file is btclib's own: its exemption lists, the op-code and English-predicate entries, and the argument-less bool walk ecc never had.
Evidence
What
Result
The controls can fail
each of: validate_ dropped from _PROMISED or _NOT_A_READ; one definition per name; FunctionDef only; no coroutine wrap; wrap only bool or only None answers; wrap only is_/validate_ names; flat keys for nested classes; judging the last definition only — fails a control (the one equivalent mutant, async read in _public_bools_in, is dead once the wrap applies)
The library
_PUBLIC_BOOLS and _CLASS_MEMBERS hold the same keys before and after; _NAMED gains ecc.frost.validate_threshold_info only
pytest whole suite 0 (coverage 100%); pre-commit run --all-files 0; sphinx-build -n -W 0 on c4b2529e, the round before two that changed only the test file
dedicated reviewer CLEARED 8c16031a, after three rounds (a docstring restating CONTRIBUTING's reason; a false sentence on _answer's argument; a control with an async def under two prefixes only; a comment claiming every prefix)
Fresh review in the other client
missing: Codex refused the run with ERROR: Your workspace is out of credits. Add credits to continue. (2026-11-07)
…loses#490)
tests/name_contract_test.py takes the walks of btclib's port at
btclib-org/btclib@96f3b68a (PR btclib-org/btclib#2960 and
PR btclib-org/btclib#2963), adapted to this tree's exemptions:
- `validate_` promises None, matched at the front with its underscore,
and a self-only `validate_` member is not a read. This holds
`frost.validate_threshold_info`, which already returns None.
- each definition of a name is kept, in a list per name, so a second
definition hides no first.
- the name walks read `async def`, and class members are keyed by their
full dotted path, so two nested classes of one name are two keys.
It adds the rule of ISS btclib-org/btclib#2964: an `async def` whose
name carries a `_PROMISED` prefix breaks the promise, whatever its
annotation, because a call without `await` answers a coroutine. The
walk records such a definition as `Coroutine[<annotation>]`, so an
async bool is neither a kept promise nor a public bool.
Control sources hold each case the tree does not: a `validate_`
answering a bool or a coroutine, a name defined twice, nested classes of
one name, and an `async def` under each prefix. CONTRIBUTING.md's
vocabulary states `validate_*` and the async rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ferdinando Ametrano <ferdinando@ametrano.net>
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Documentation
Clarified naming guidance for validation functions, asynchronous functions, and properties.
Tests
Expanded naming-contract checks to cover validation names, asynchronous functions, nested classes, and additional class-member cases.
The naming guidance and AST-based name contract now include validate_*. The census retains duplicate definitions, accounts for async return types, and expands class-member and public-bool discovery. Tests cover these rules.
Changes: Naming contract and census
Layer / File(s)
Summary
Document and encode naming rules CONTRIBUTING.md, tests/name_contract_test.py
The guidance and test vocabulary define validate_* as a refusal prefix that promises None. The property guidance exempts validate_*, and the read check treats it as a non-read prefix.
Expand definition census tests/name_contract_test.py
The census retains all matching public definitions, represents async functions as coroutines, and reports a broken promise when any definition differs from the promised type. Class-member and public-bool discovery now handle the described nested and async cases.
Test naming and member rules tests/name_contract_test.py
Tests cover validate_* return promises, duplicate and async definitions, nested discovery, and member read classification.
This PR extends the naming-contract test and contributor guidance to cover validate_* functions. It changes no production behavior, and no merge-blocking risk is identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: bringing the name contract test in btclib's walks up to date, and it covers the validate_ prefix and async handling. It also cites issue #490. It follows the title for…
Description check
The description states that it ports ecc's tests/name_contract_test.py to btclib's walks, adds validate_ to _PROMISED and _NOT_A_READ, and adds the async def rule. It also lists the controls, gate res…
Linked Issues check
Directly linked issue #490 requires that tests/name_contract_test.py hold validate_* to a None answer and that validate_ be exempt from the property rule. At the reviewed head 8c16031, _PROMISED maps…
Out of Scope Changes check
The reviewed change set, from merge base e5260d4 to head 8c16031, touches only CONTRIBUTING.md and tests/name_contract_test.py. No file under src/ecc changes. The CONTRIBUTING.md edits add validate_…
Full details: Title check
Explanation
The title names the main change: bringing the name contract test in btclib's walks up to date, and it covers the validate_ prefix and async handling. It also cites issue #490. It follows the title format in the referenced organization standard, which the reviewer has not checked in detail.
Full details: Description check
Explanation
The description states that it ports ecc's tests/name_contract_test.py to btclib's walks, adds validate_ to _PROMISED and _NOT_A_READ, and adds the async def rule. It also lists the controls, gate results, and the missing fresh review. It matches the changeset closely.
Full details: Linked Issues check
Explanation
Directly linked issue #490 requires that tests/name_contract_test.py hold validate_* to a None answer and that validate_ be exempt from the property rule. At the reviewed head 8c16031, PROMISED maps "validate" to "None", matched at the front with its underscore. NOT_A_READ is ("assert", "to_", "validate_"). Both changes are present in the code. The walk test test_the_walk_reaches_what_it_claims asserts ecc.frost.validate_threshold_info == ["None"], and the control test_a_validate_answering_a_bool_breaks_its_promise fails if validate_ is dropped from _PROMISED, because validate_answer would no longer break its promise. The control for the NOT_A_READ change lies beyond the 16000-byte read limit, so I could not view it directly. The PR reports that control exists, and the visible code shows the change. CONTRIBUTING.md adds the validate* line the issue cites. The issue's convergence goal is met for the two changes it names. No coding requirement is unmet in the evidence I could read.
Full details: Out of Scope Changes check
Explanation
The reviewed change set, from merge base e5260d4 to head 8c16031, touches only CONTRIBUTING.md and tests/name_contract_test.py. No file under src/ecc changes. The CONTRIBUTING.md edits add validate_* to the prefix vocabulary and state the no-async-prefix rule, which matches the test changes and the #490 vocabulary point. The test-file changes beyond the two named additions cover the walk rules the PR cites from btclib-org/btclib#2963 and #2964: every definition checked, async def read as a coroutine, dotted class keys, and the async-method exclusion. These extend the same name contract that #490 asks to converge with btclib's port, so they are not demonstrated to be unrelated. The added controls are supporting tests for these rules. I found no change that lacks a connection to the linked issue or to the name contract.
Finishing Touches
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
Reviewing files that changed from the base of the PR and between e5260d4 and 8c16031.
Files selected for processing: 2
CONTRIBUTING.md
tests/name_contract_test.py
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Not checked: the new walks and controls in tests/name_contract_test.py, and the mutants the description's "The controls can fail" row reports, were not run, because there is no interpreter here. A grep of src/ finds no async def, which matches the description's claim that the tree has none.
tests/name_contract_test.py read an `async def`'s annotation as its answer, so `async def is_ready(self) -> bool` kept the `is_` promise, while a call without `await` answers a coroutine, which is true, and an unawaited `validate_x()` refuses nothing. `_named_in` now records an `async def` as `Coroutine[<annotation>]`, which breaks the promise of every prefix in `_PROMISED`; an `_OTHER_CONTRACT` exception excuses an answer, never a coroutine; and an `async def -> bool` is no longer a public bool. Controls hold an `async def` under each prefix and an excepted name made async, as ecc's copy does (btclib-org/ecc#491). CONTRIBUTING.md's vocabulary states the rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ferdinando Ametrano <ferdinando@ametrano.net>
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
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.
ecc's name contract test is the source btclib's copy is ported from, and btclib's had moved ahead:
validate_in the vocabulary (btclib-org/btclib#2960), every definition of a name held to its prefix instead of the last one only,async defread, and class members keyed by their dotted path (btclib-org/btclib#2963). This brings ecc'stests/name_contract_test.pyto those walks, addsvalidate_to_PROMISEDand_NOT_A_READ, and adds the rule decided in btclib-org/btclib#2964: anasync defcarries none of the prefixes, since a call withoutawaitanswers a coroutine, which is true foris_,check_andverifyand refuses nothing forassert_andvalidate_. CONTRIBUTING.md's vocabulary says so.Nothing in
src/eccchanges verdict:ecc.frost.validate_threshold_infois now held tovalidate_'s promise and keeps it, no name is defined twice, and there is noasync def. What still differs from btclib's file is btclib's own: its exemption lists, the op-code and English-predicate entries, and the argument-less bool walk ecc never had.Evidence
validate_dropped from_PROMISEDor_NOT_A_READ; one definition per name;FunctionDefonly; no coroutine wrap; wrap only bool or only None answers; wrap onlyis_/validate_names; flat keys for nested classes; judging the last definition only — fails a control (the one equivalent mutant, async read in_public_bools_in, is dead once the wrap applies)_PUBLIC_BOOLSand_CLASS_MEMBERShold the same keys before and after;_NAMEDgainsecc.frost.validate_threshold_infoonlypre-commit run --all-files0;sphinx-build -n -W0 on c4b2529e, the round before two that changed only the test filemaine5260d4, no rebaseCLEARED 8c16031a, after three rounds (a docstring restating CONTRIBUTING's reason; a false sentence on_answer's argument; a control with anasync defunder two prefixes only; a comment claiming every prefix)ERROR: Your workspace is out of credits. Add credits to continue.(2026-11-07)Closes #490
🤖 Generated with Claude Code