fix(parser): Dig 'reveal ... on top of your library, rest on bottom' kept-to-top destination (#2349) - #3155
Conversation
There was a problem hiding this comment.
Code Review
This pull request resolves Issue #2349 by enabling the parser to recognize library-top destinations (such as 'on top of your library') and correctly tracking whether a 'reveal' verb was used to promote the action to a public reveal. However, the introduction of the reveal_verb boolean field on the ContinuationAst::DigFromAmong struct violates Style Guide Rule R2 (No bool fields). It is recommended to replace this boolean field with a typed enum, such as DigVisibility, to better represent the design space.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| /// CR 701.20a vs 701.20e: True when the from-among clause's stripped verb | ||
| /// was "reveal" (a public action) rather than "put"/"choose" (a private | ||
| /// look). Promotes the patched Dig to `reveal: true` even when the kept | ||
| /// cards route to a fixed library position (Fertile Thicket). | ||
| #[serde(default)] | ||
| reveal_verb: bool, |
There was a problem hiding this comment.
[HIGH] Violation of Style Guide Rule R2 (No bool fields). Using a bool field (reveal_verb) to represent the visibility/action type of the dig clause does not express the design space well and violates the repository's strict rule against boolean fields on structs or variant payloads.
Suggested fix: Replace reveal_verb: bool with a typed enum DigVisibility defined at the module level:
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Default)]
pub(crate) enum DigVisibility {
#[default]
Private,
PublicReveal,
}| /// CR 701.20a vs 701.20e: True when the from-among clause's stripped verb | |
| /// was "reveal" (a public action) rather than "put"/"choose" (a private | |
| /// look). Promotes the patched Dig to `reveal: true` even when the kept | |
| /// cards route to a fixed library position (Fertile Thicket). | |
| #[serde(default)] | |
| reveal_verb: bool, | |
| /// CR 701.20a vs 701.20e: The visibility of the from-among clause's action. | |
| /// Promotes the patched Dig to reveal: true when set to PublicReveal. | |
| #[serde(default)] | |
| visibility: DigVisibility, |
References
- Rule R2: No bool fields — parameterize with existing typed enums. A bool field never expresses the design space; the project uses typed enums instead. Any new bool field on a struct or bool variant payload where an existing enum (or a small new enum) would carry the same information with more meaning is a finding. (link)
|
Deferring this one. The parser fix is real (the clause splitter bisects 'reveal … from among them, then put that card on top …' so the from-among continuation never absorbs into the look-Dig), but suppressing the |
b8be9ba to
0d3850a
Compare
…kept-to-top destination (#2349)
0d3850a to
42433d8
Compare
Summary
Closes #2349.
Fertile Thicket ("reveal up to one basic land card from among them, then put that card on top of your library and the rest on the bottom") did not keep the revealed land on top — the parser's
parse_dig_destination_tail(oracle_effect/sequence.rs) recognized only "onto the battlefield"/"into your hand" as kept destinations, not "on top of your library", so the kept destination resolved toNoneand the reveal became unimplemented. The DigChoice resolver already routes kept→top / rest→bottom correctly whendestination == Some(Library)— only the parser couldn't reach it.Class fix (parser-only):
parse_dig_destination_tail→Some((Some(Zone::Library), false))(+ leading-comma strip so ", then put that card on top..." is reached).reveal: truefor reveal-from-among clauses via a new parser-internalreveal_verbfield onContinuationAst::DigFromAmong(look-only digs keepreveal_verb: false— no regression).Covers the reveal-to-top peek class; resolver/types unchanged.
Tests
fertile_thicket_reveal_to_top_2349.rs: revealed basic land ends on library top (index 0) and is publicly revealed; the other 4 go to the bottom. Both asserts fail on revert.DigFromAmong{ Up(1), destination: Some(Library), rest_destination: Some(Library), reveal_verb: true }.CR 401.4, 701.20a, 701.20e (grep-verified). Verified locally via the parser combinator gate; full verification deferred to CI.