Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec changes for currency support #594

Merged
merged 6 commits into from
Jun 16, 2023
Merged

Conversation

morlovich
Copy link
Collaborator

@morlovich morlovich commented May 24, 2023

I am not quite asking for a review yet; mostly just want to look at diffs of the combined thing.


Preview | Diff

@JensenPaul JensenPaul added the spec Relates to the spec label May 24, 2023
@morlovich morlovich force-pushed the spec-currency branch 2 times, most recently from 5f234ba to 0ba51d8 Compare June 7, 2023 18:18
@morlovich morlovich force-pushed the spec-currency branch 2 times, most recently from 5e3860d to 867eb16 Compare June 14, 2023 17:12
@morlovich morlovich changed the title (Not yet ready) Spec changes for currency support Spec changes for currency support Jun 14, 2023
@morlovich morlovich requested a review from miketaylr June 14, 2023 19:23
@morlovich
Copy link
Collaborator Author

This is a big one; I would suggest starting with the type stuff; one of the existing fields changed [=generate bid/bid=] is now a struct w/a currency tag...

Copy link
Collaborator

@miketaylr miketaylr left a comment

Choose a reason for hiding this comment

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

(apologies for the delay, will finish this tomorrow morning first thing)

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
Copy link
Collaborator

@miketaylr miketaylr left a comment

Choose a reason for hiding this comment

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

Mostly editorial suggestions/nits and a couple questions

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@@ -2295,6 +2362,32 @@ An interest group ad is a [=struct=] with the following items:

</dl>

<h3 dfn-type=dfn>Currency tag</h3>
A currency tag is a [=string=] containing exactly 3 upper-case ASCII letters, or null. The null value is used to denote that the currency is unspecified.
Copy link
Collaborator

Choose a reason for hiding this comment

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

dumb question: if there an RFC or other place that defines these 3 letter tags? Is it https://www.iso.org/iso-4217-currency-codes.html? Something else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ISO 4217 was the intent, but maybe the industry could agree on some other values, too. I hear they like doing things in cents, for example?

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, eventually we should link out to something... or invent a new thing (sure, why not). But that can be a follow up issue - I'll file a spec issue. 💸

Copy link
Collaborator

Choose a reason for hiding this comment

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

Filed #634

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@@ -2490,6 +2612,8 @@ The output of running a Protected Audience `scoreAd()` script, is represented us
dictionary ScoreAdOutput {
required double desirability;
double bid;
DOMString bidCurrency;
Copy link
Collaborator

Choose a reason for hiding this comment

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

AuctionAdConfig's sellerCurrency is a USVString - do we want bidCurrency to be DOMString? (Maybe there is some meaningful difference and I'm missing it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well... If it's a USVString I have to implement the bad-surrogate-pairs check, and if it's DOMString I don't. Is there a rule saying what AuctionAdConfig should be using, given that's clearly a usual web API?

It's actually an /observable/ difference for SetBid, since if it were a USVString, and one passed one that wasn't valid for that, but valid for DOMString, that would throw before side effects of converting the modelingSignals field occur.

... It doesn't matter if one is using valid tags, of course.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright - works for me.

Is there a rule saying what AuctionAdConfig should be using, given that's clearly a usual web API?

Not that I'm aware of. But maybe @domfarolino has more knowledge than me on this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Guidance for string types can be found in https://webidl.spec.whatwg.org/#idl-USVString and especially https://w3ctag.github.io/design-principles/#idl-string-types. If you use USVString you do not have to implement a bad-surrogate-pairs check, as USVString does that for you. Maybe you're referring to the implementation though (which doesn't actually use WebIDL so we'd have to manually implement that check as WebIDL would automatically)?

So I think the question comes down to whether we are doing any text processing on the value and need to ever dig into the individual scalar values?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems odd to be inconsistent here without good reason though. At the very least it would be good to document why these two currency types can be different, assuming them being different is the appropriate outcome.

Copy link
Collaborator

@miketaylr miketaylr left a comment

Choose a reason for hiding this comment

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

LGTM % nits

@miketaylr miketaylr merged commit a218d03 into WICG:main Jun 16, 2023
2 checks passed
github-actions bot added a commit that referenced this pull request Jun 16, 2023
SHA: a218d03
Reason: push, by miketaylr

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Relates to the spec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants