maybe collapse the two assertions into `assert hasValue(docId) == length > 0`?