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
RFD4 provider: accept HBond BOTH, validate sequence probabilities at save, fix group colouring - #23
Builds on #20. The first commit here is #20 (CI fix); please review the commits after it. GitHub will drop it from this diff once #20 merges.
What this fixes
HBond BOTH was offered, then rejected at save. The condition contract offers NONE/DONOR/ACCEPTOR/BOTH, but validate_rfd4 raised hbond_both_not_supported as an error. The model does support BOTH at the pinned revision e519afe:
conditions.py:60 defines BOTH = 3 # DONOR | ACCEPTOR.
nn/feature_factory.py:715-716 sets both the donor and acceptor channels when hb == _HB_BOTH.
transforms/design_task_modifiers.py:395 produces BOTH during training through unions={HBondEnum.BOTH: (DONOR, ACCEPTOR)}.
So the save-time error was stale and is removed, and the contract is unchanged. If BOTH is meant to stay blocked for another reason, I'm happy to restore the check and drop BOTH from the contract instead.
Save validation skipped the sequence-probability invariants. They ran only in after_condition_update, so a file loaded with invalid sequence-probability conditions saved without complaint. validate_rfd4 now canonicalizes a copy against C_SEQ and reports each violation as an error, matching the edit-time behaviour and upstream's on_violation='raise'. A conflict with an exact C_SEQ is reported too. It costs about 1–2 ms per call, and none of the bundled fixtures raise issues.
Colour-by-group ignored insertion codes, so residues 52 and 52A shared colours. The lookup now uses display_atom_ids, the same identity the other views use.
The colour-by-group overflow dialog reopened on every reload. The choice, including Cancel, is remembered per object, annotation and group set, and the dialog asks again only when the groups change.
Validation
unit suite: 394 passed, 19 skipped, 0 failed. ruff is clean.
One existing test, test_pymol_conformance.py (2 lines), asserted the re-prompt behaviour and is updated.
Note
The CIF write→load path did not carry an insertion code through to PyMOL resi in my environment, so the insertion-code test sets it directly. That path may be worth its own look.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Addresses review on RosettaCommons#23: the overflow-highlight decision cache was keyed by
(obj_name, annotation, group ids), so after clear_all/object deletion a new
structure loaded under the same name with the same group ids reused the old
object's highlight (or cancellation) without prompting.
The key now also includes a digest of the object's atom identities
(display_atom_ids), so a genuinely different structure re-prompts while a benign
reload of the same structure still does not. Regression test loads a second
structure under a reused name with identical group ids but shifted atom ids and
asserts it re-prompts.
Thanks — addressed in the latest commit. The overflow-highlight decision key now includes a digest of the object's atom identities (display_atom_ids) alongside name/annotation/group-ids, so a genuinely different structure loaded under a reused name re-prompts, while a benign reload of the same structure still does not. New regression test loads a second structure under a reused name with identical group ids but shifted atom ids and asserts it re-prompts.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Save validation should aggregate all invariant violations, and overflow-choice caching should include stable structure identity for generated atom IDs.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Aggregate canonicalization conflicts with all invariant violations
Catching the canonicalization error here returns only the C_SEQ conflict and suppresses any other invariant violations on the same array (for example, an out-of-range or over-summed probability on another residue). Since save validation is intended to report each violation, collect the conflict and still run the invariant checker on the uncanonicalized copy (or otherwise aggregate both results) instead of returning early.
Include stable structure identity in highlight cache key
This digest is based only on display IDs, which are generated as 1..N whenever the array has no unique atom_id annotation. Consequently, a different structure with the same atom count can reuse the same (obj_name, annotation, choices, identity) key and inherit the previous highlight decision, despite the cache being intended to be per loaded structure. Include stable atom identity fields (or use a load-generation token managed with object state) in this key; the regression test only changes atom_id manually and does not cover the normal generated-ID case.
Addresses review on RosettaCommons#23: the overflow-highlight decision cache was keyed by
(obj_name, annotation, group ids), so after clear_all/object deletion a new
structure loaded under the same name with the same group ids reused the old
object's highlight (or cancellation) without prompting.
The key now also includes a digest of the object's atom identities
(display_atom_ids), so a genuinely different structure re-prompts while a benign
reload of the same structure still does not. Regression test loads a second
structure under a reused name with identical group ids but shifted atom ids and
asserts it re-prompts.
AtharvaTilewale
added a commit
to AtharvaTilewale/atomworks-studio
that referenced
this pull request
Oct 22, 2026
…le identity
Addresses the second review on RosettaCommons#23:
- Save validation returned only the C_SEQ conflict when canonicalization
failed, hiding other violations in the same structure. It now reports the
conflict, canonicalizes with the conflict resolved in favor of C_SEQ
(canonicalize_sequence_probabilities(..., resolve_conflicts=True); the
default still raises, as the model does), and reports every remaining
invariant violation on that. Checking the raw array instead would add
spurious incomplete-for-C_SEQ errors that canonicalization fills in.
- The group-highlight decision digest used display ids, which are generated
as 1..N when atom_id is not unique, so two same-size structures collided. It
now also digests chain_id, res_id, ins_code, res_name and atom_name.
All violations reported: on a C_SEQ conflict, save validation reports the conflict, canonicalizes with it resolved in favour of C_SEQ (canonicalize_sequence_probabilities(..., resolve_conflicts=True); the default still raises, as the model does), and then reports every other invariant violation. I deliberately didn't run the checker on the raw array: that adds spurious incomplete_for_c_seq errors on residues canonicalization would fill in.
Stable identity for the highlight cache: the digest now covers chain_id/res_id/ins_code/res_name/atom_name as well as display ids, since display ids are generated as 1..N when atom_id isn't unique. New test covers that generated-id case with two same-size structures.
Both tests fail on the previous commit and pass now.
- Accept HBond BOTH in RFD4 save validation (F19). Upstream defines
HBondEnum.BOTH as a model input ("for atoms that donate in one H-bond and
accept in another", vendored conditions.py:56-60), and RFD4's featurizer
sets both donor and acceptor channels for it, so the authoring contract was
correct and the Studio-side rejection was stale.
- Run the sequence-probability invariants in save validation (F20):
validate_rfd4 canonicalizes a copy against C_SEQ, then reports every
violation as an error, matching after_condition_update and the model's
raising invariant check. Loaded files and reset paths are now caught at
save/export.
- Key color-by-group b-factor lookup by display atom ID (F21) so residues
that differ only by insertion code (52, 52A) keep their own groups.
- Remember the overflow highlight choice per object, annotation and group
set (F34) so reloads after edits, console commands and divergence checks
no longer reopen the modal dialog; a cancelled prompt is remembered too.
The existing overflow conformance test now clears that decision between
its cancel and accept calls.
Addresses review on RosettaCommons#23: the overflow-highlight decision cache was keyed by
(obj_name, annotation, group ids), so after clear_all/object deletion a new
structure loaded under the same name with the same group ids reused the old
object's highlight (or cancellation) without prompting.
The key now also includes a digest of the object's atom identities
(display_atom_ids), so a genuinely different structure re-prompts while a benign
reload of the same structure still does not. Regression test loads a second
structure under a reused name with identical group ids but shifted atom ids and
asserts it re-prompts.
…le identity
Addresses the second review on RosettaCommons#23:
- Save validation returned only the C_SEQ conflict when canonicalization
failed, hiding other violations in the same structure. It now reports the
conflict, canonicalizes with the conflict resolved in favor of C_SEQ
(canonicalize_sequence_probabilities(..., resolve_conflicts=True); the
default still raises, as the model does), and reports every remaining
invariant violation on that. Checking the raw array instead would add
spurious incomplete-for-C_SEQ errors that canonicalization fills in.
- The group-highlight decision digest used display ids, which are generated
as 1..N when atom_id is not unique, so two same-size structures collided. It
now also digests chain_id, res_id, ins_code, res_name and atom_name.
Rebased onto current main (d7b78e4, 0.0.12). The earlier red CI was GitHub expiring the Oct 22 runs after 30 days awaiting approval; no job had run. CI on the rebased branch is green. The only failing job is the non-blocking integration acceptance suite, which fails the same single check on main ("a plain mmCIF opens as an entry does"), 36/37 in both.
No conflicts; 8 of the 11 new tests fail against main's provider code and pass here.
This branch has not been deployed
No deployments
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.
What this fixes
HBond BOTH was offered, then rejected at save. The condition contract offers NONE/DONOR/ACCEPTOR/BOTH, but
validate_rfd4raisedhbond_both_not_supportedas an error. The model does support BOTH at the pinned revisione519afe:conditions.py:60definesBOTH = 3 # DONOR | ACCEPTOR.nn/feature_factory.py:715-716sets both the donor and acceptor channels whenhb == _HB_BOTH.transforms/design_task_modifiers.py:395produces BOTH during training throughunions={HBondEnum.BOTH: (DONOR, ACCEPTOR)}.So the save-time error was stale and is removed, and the contract is unchanged. If BOTH is meant to stay blocked for another reason, I'm happy to restore the check and drop BOTH from the contract instead.
Save validation skipped the sequence-probability invariants. They ran only in
after_condition_update, so a file loaded with invalid sequence-probability conditions saved without complaint.validate_rfd4now canonicalizes a copy againstC_SEQand reports each violation as an error, matching the edit-time behaviour and upstream'son_violation='raise'. A conflict with an exactC_SEQis reported too. It costs about 1–2 ms per call, and none of the bundled fixtures raise issues.Colour-by-group ignored insertion codes, so residues 52 and 52A shared colours. The lookup now uses
display_atom_ids, the same identity the other views use.The colour-by-group overflow dialog reopened on every reload. The choice, including Cancel, is remembered per object, annotation and group set, and the dialog asks again only when the groups change.
Validation
unitsuite: 394 passed, 19 skipped, 0 failed.ruffis clean.tests/test_rfd4_review_fixes.py: 7 fail on Fix CI: open rebuilt examples as Annotated CIF and protonate them #20's code and all pass here.test_pymol_conformance.py(2 lines), asserted the re-prompt behaviour and is updated.Note
The CIF write→load path did not carry an insertion code through to PyMOL
resiin my environment, so the insertion-code test sets it directly. That path may be worth its own look.