# The order of disambiguation: failing test

**URL:** https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532
**Category:** Uncategorized
**Created:** [April 17, 2019, 12:08am UTC](https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532 "2019-04-17T00:08:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![PaulStanley](https://avatars.discourse-cdn.com/v4/letter/p/e19b73/32.png) [@PaulStanley](https://discourse.citationstyles.org/u/PaulStanley)
#### Post date: [April 17, 2019, 12:08am UTC](https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532/1 "2019-04-17T00:08:54Z")

</div>

It seems churlish to mention this one, given that I currently pass barely 50 percent of the disambiguation tests, and mostly fair and square fall-on-your-face failure. However:

> disambiguate\_ByCiteDisambiguateCondition.txt FAILED  
> -------- EXPECTED --------  
> Doe et al., _Book A_ (2000); Doe et al., _Book B_ (2000)  
> ----------- GOT -----------  
> Doe et al. (2000a); Doe et al. (2000b)

See [disambiguate\_ByCiteDisambiguateCondition.txt](https://github.com/citation-style-language/test-suite/blob/144e39fddf5c2359ca6c24ae3a7554a7de36f366/processor-tests/humans/disambiguate_ByCiteDisambiguateCondition.txt)

We have disambiguation rules to `add-givenname`, `add-names` and `add-year-suffix`. The givenname disambiguation rule is `by-cite`, but both `add-givenname` and `add-name` must fail, because both works are by the same two (prolific) authors, John Doe and Jane Roe.

We also have a `<choose>` element that will render the title if `disambiguate` is true.

The test seems to assume that `disambiguate` **will** be true, and that the title will therefore get printed rather than a year suffix. I’m having trouble matching that to the spec. Per the spec:

> Disambiguation methods are activated with the following optional attributes, and **are always tried in the listed order**

Which is a) add more names, b) expand names to initials and given names, c) add a suffix. It is only if those methods fail that we get to the generalised disambiguation conditional:

> If ambiguous cites remain **after applying the selected disambiguation** methods described above, a **final disambiguation attempt is made** by rendering these cites with the disambiguate condition testing “true” [Step (4)].

So in this case we should:

- Try step 1 and fail (adding names gets us “Doe and Roe”, twice)
- Try step 2 and fail (expansion gets us “John Doe and Jane Roe”, twice: neither _name_ is ambiguous, but the cites remain ambiguous)
- Try step 3 and succeed (expansion gets us “2000a” and “2000b”): we now have unambiguous citations (though not unambiguous names, which we cannot have any which way here).

We should therefore never get to the “final” step 4, so the disambiguation condition is never triggered and we don’t get titles, as the test suggests we should.

What wrinkle am I missing here?

---

<div class="post-metadata">

### Author: ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)
#### Post date: [April 17, 2019, 12:35am UTC](https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532/2 "2019-04-17T00:35:29Z")

</div>

Quite right. The test fixture follows `citeproc-js`, not the spec. I remember thinking about this one during the drafting, and I think year-suffix should be the last listed (as the last to be tried), because it _always_ succeeds. (This may be another that should be moved out or amended in the interest of faithfulness to the specification.)

---

<div class="post-metadata">

### Author: ![Sebastian\_Karcher](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/sebastian_karcher/32/176_2.png) [@Sebastian\_Karcher](https://discourse.citationstyles.org/u/Sebastian_Karcher)
#### Post date: [April 17, 2019, 1:31am UTC](https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532/3 "2019-04-17T01:31:20Z")

</div>

FWIW, this one has very few, if any, implications in practice, since the if disambiguate test typically adds a title, which is almost always unique.

I agree with Frank that the citeproc-js, rather than the spec, version allows for more flexibility (I could tell a style to use year suffixes only when the if disambiguate action also fails to disambiguate, e.g. for items with the same title, author, and year) but this is exceedingly rare.

---

<div class="post-metadata">

### Author: ![PaulStanley](https://avatars.discourse-cdn.com/v4/letter/p/e19b73/32.png) [@PaulStanley](https://discourse.citationstyles.org/u/PaulStanley)
#### Post date: [April 17, 2019, 8:27am UTC](https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532/4 "2019-04-17T08:27:32Z")

</div>

Thanks for the clarification. It sounds as if this is one of those tests where I can more or less please myself (in the sense that it tests an edge case that is unlikely to occur with any sanely coded style). FWIW it always seemed to me unlikely that anyone would ever use a year suffix _and_ a disambiguation rule, because the only circumstance I can imagine where that combination would make any sense is if one was dealing with a set of ambiguous cites that never printed a year.

Since the spec is at least clear on this, I’ll probably follow the spec, though I agree with Frank that flipping the order of `year-suffix` and `disambiguation-condition` rules would actually make good sense.

---

<div class="post-metadata">

### Author: ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)
#### Post date: [April 19, 2019, 1:42am UTC](https://discourse.citationstyles.org/t/the-order-of-disambiguation-failing-test/1532/5 "2019-04-19T01:42:27Z")

</div>

I’ve adjusted a couple of disambiguation tests that touch both `year-suffix` and `disambiguate="true"` to conform to the spec, and moved the remainder out to the `citeproc-js` repo.

`citeproc-js` will now conform to spec by default, with a `sys` option to restore its former behavior. Will flag that change in a release note at the next update.

**Edit:** not -\> now
