Skip to content

Update and correct all public JSDoc in AVClient and AVVerifier - #371

Merged
av-javier merged 5 commits into
mainfrom
AB29388/update-public-jsdoc-av-client-verifier
Jul 1, 2026
Merged

Update and correct all public JSDoc in AVClient and AVVerifier#371
av-javier merged 5 commits into
mainfrom
AB29388/update-public-jsdoc-av-client-verifier

Conversation

@av-javier

@av-javier av-javier commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

AB#29388

JSDoc Update — AVClient & AVVerifier

What changed

All public method documentation in lib/av_client.ts and lib/av_verifier.ts was reviewed
line-by-line against the actual code and cross-referenced with real usage in election-client
and IVR. Every claim was verified against the source before being written.

AVClient

Method Change
initialize Added @throws InvalidConfigError when injected config fails validation (validateLatestConfig in election_config.ts throws it)
requestAccessCode Rewrote description (removed stale "mail-in" context); fixed error class name VoterRecordNotFoundVoterRecordNotFoundError; added @throws EmailDoesNotMatchVoterRecordError (also thrown by the coordinator)
createVoterRegistration Added note: if identityConfirmationToken is set via setIdentityToken, the identity path is used regardless of authorizationMode — this matches the `
expireVoterSessions Added generateProofOfElectionCodes as documented prerequisite (method uses this.proofOfElectionCodes); added @throws InvalidTokenError (thrown when jwtDecode returns null)
extendVoterSessions Clarified no-op condition: the method accesses this.voterSession.address — the no-op fires when address is falsy, but if voterSession itself is undefined a TypeError is thrown
challengeBallot Critical: documented that submitCommitmentOpenings is called without await (fire-and-forget); removed incorrect @throws NetworkError; added constructBallot as prerequisite (it generates voterCommitmentOpening and verifierItem used here)
waitForVerifierRegistration Replaced three-line placeholder with full documentation; corrected endpoint from GET /verification/verifier to GET /verification/verifiers/{address} (path param, plural — verified in bulletin_board.ts:124)
disableVoter Added that voter registration must be complete — method reads this.voterSession.content.votingRoundReference

AVVerifier

Method Change
validateReceipt Corrected step order: code runs parseReceiptvalidateTrackingCodeverifyAddressvalidateReceipt (DBB sig). Previous doc had tracking code check last
getReadableContestSelections Added @throws InvalidOptionError — thrown by makeOptionFinder in option_finder.ts:13 when an option reference is not found

Public API exports

Error classes thrown by public methods but previously unexported were added to the module's
public surface so consumers can catch them by type:

  • av_client.ts — added InvalidTokenError, VoterRecordNotFoundError
  • av_verifier.ts — added InvalidContestError, InvalidOptionError, InvalidReceiptError,
    InvalidTrackingCodeError, NetworkError

Docs

Regenerated docs/ via yarn docs (TypeDoc 0.28). Result: 0 errors, 0 warnings.

What did not change

Files modified

  • lib/av_client.ts — JSDoc only, plus two new error exports
  • lib/av_verifier.ts — JSDoc only, plus error imports/exports
  • docs/ — regenerated output (TypeDoc)

Copilot AI review requested due to automatic review settings June 30, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 19 changed files in this pull request and generated 8 comments.

Files not reviewed (3)
  • docs/assets/hierarchy.js: Generated file
  • docs/assets/navigation.js: Generated file
  • docs/assets/search.js: Generated file
Comments suppressed due to low confidence (1)

lib/av_client.ts:184

  • AVClient.requestAccessCode accepts an optional ballotReference, but IAVClient still declares requestAccessCode(opaqueVoterId: string, email: string) only. Consumers typing against IAVClient won’t be able to pass ballotReference even though it’s supported by the concrete implementation.
  public async requestAccessCode(
    opaqueVoterId: string,
    email: string,
    ballotReference?: string,
  ): Promise<void> {

Comment thread lib/av_client.ts
Comment thread lib/av_client.ts
Comment thread lib/av_client.ts Outdated
Comment thread lib/av_verifier.ts Outdated
Comment thread lib/av_verifier.ts
Comment thread lib/av_verifier.ts Outdated
Comment thread lib/av_client.ts
Comment thread lib/av_client.ts
@av-javier
av-javier requested review from Copilot and removed request for Copilot June 30, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 26 changed files in this pull request and generated 4 comments.

Files not reviewed (3)
  • docs/assets/hierarchy.js: Generated file
  • docs/assets/navigation.js: Generated file
  • docs/assets/search.js: Generated file

Comment thread lib/av_verifier.ts Outdated
Comment thread lib/av_verifier.ts
Comment thread lib/av_verifier.ts
Comment thread lib/av_client.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 26 changed files in this pull request and generated 7 comments.

Files not reviewed (3)
  • docs/assets/hierarchy.js: Generated file
  • docs/assets/navigation.js: Generated file
  • docs/assets/search.js: Generated file

Comment thread lib/av_client.ts
Comment thread lib/av_verifier.ts
Comment thread lib/av_client.ts Outdated
Comment thread lib/av_verifier.ts Outdated
Comment thread lib/av_verifier.ts Outdated
Comment thread lib/av_verifier.ts
Comment thread lib/av_client.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 26 changed files in this pull request and generated 2 comments.

Files not reviewed (3)
  • docs/assets/hierarchy.js: Generated file
  • docs/assets/navigation.js: Generated file
  • docs/assets/search.js: Generated file

Comment thread lib/av_verifier.ts
Comment thread lib/av_client.ts
@av-javier
av-javier merged commit 2691531 into main Jul 1, 2026
3 checks passed
@av-javier
av-javier deleted the AB29388/update-public-jsdoc-av-client-verifier branch July 1, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants