Skip to content

chore: update passport API#1315

Draft
aanorbel wants to merge 2 commits intopassport-bridgefrom
chore/passport-api-update
Draft

chore: update passport API#1315
aanorbel wants to merge 2 commits intopassport-bridgefrom
chore/passport-api-update

Conversation

@aanorbel
Copy link
Copy Markdown
Member

No description provided.

@aanorbel aanorbel marked this pull request as draft April 30, 2026 09:38
Copy link
Copy Markdown
Contributor

@sdsantos sdsantos left a comment

Choose a reason for hiding this comment

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

Should we create a ticket for storing the verification status of a measurement? Maybe to show it in the UI in the future?

) : SubmitError(raw)

companion object {
fun fromWire(value: String?): SubmitError? =
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.

Maybe fromPassport is a bit more clear?

private val deleteFiles: DeleteFiles,
private val updateMeasurement: suspend (MeasurementModel) -> Unit,
private val deleteMeasurementById: suspend (MeasurementModel.Id) -> Unit,
private val handleSubmitOutcome: suspend (VerificationStatus, SubmitError?) -> Unit = { _, _ -> },
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.

Why the default lambda?

}

when (error) {
SubmitError.ManifestNotFound -> retrieveManifest()
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.

If we failed to already fetch a Manifest, and we try on every background run, I don't think we should retry on every failed submission with ManifestNotFound too.

HandleSubmitOutcome(
retrieveManifest = { retrieveManifest() },
clearCredential = clearCredential,
signalUpdateRequired = {},
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.

We should mark this as TODO and create a ticket for it, if it's not done yet.

suspend operator fun invoke(content: String): String {
val credential = getCredential() ?: return content
val parsed = try {
json.parseToJsonElement(content) as? JsonObject
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.

You could use as instead, and catch the CastException below, to avoid it failing silently.

Comment on lines +18 to +19
val ccOk = entry.match.probeCc == WILDCARD || entry.match.probeCc == probeCc
val asnOk = entry.match.probeAsn == WILDCARD || entry.match.probeAsn == probeAsn
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.

We don't need to worry about case sensitivity for CC and ASNs?

if (credential == null) return null
val ranges = resolveSubmissionPolicy(manifest, data.probeCc, data.probeAsn) ?: run {
Logger.w("No submission_policy entry for cc=${data.probeCc} asn=${data.probeAsn}")
return null
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.

Without ageRange and measurementCountRange we shouldn't send any credential then? Just to confirm, could not find that in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants