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

ActivityStreams 2.0 #1483

Merged
merged 128 commits into from
Apr 27, 2018
Merged

ActivityStreams 2.0 #1483

merged 128 commits into from
Apr 27, 2018

Conversation

strugee
Copy link
Member

@strugee strugee commented Oct 26, 2017

Resolves #851

@coveralls
Copy link

coveralls commented Nov 5, 2017

Coverage Status

Coverage decreased (-3.7%) to 70.08% when pulling a6bfb17 on as2 into 5bf9335 on master.

routes/api.js Outdated
@@ -303,7 +311,7 @@ var getObject = function(req, res, next) {
next(err);
} else {
obj.sanitize();
res.json(obj);
res.json(wantAS2(req) ? as2(obj) : obj);
Copy link

Choose a reason for hiding this comment

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

I thinks this could be put in a function like "handleAS2" for prevent repeating code (line 547 is the same code)

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, thanks 👍

Fixed this locally, will push soon

@coveralls
Copy link

coveralls commented Nov 6, 2017

Coverage Status

Coverage decreased (-3.7%) to 70.088% when pulling 58af0b5 on as2 into 5bf9335 on master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-3.7%) to 70.088% when pulling 58af0b5 on as2 into 5bf9335 on master.

@coveralls
Copy link

coveralls commented Nov 6, 2017

Coverage Status

Coverage decreased (-3.7%) to 70.088% when pulling 58af0b5 on as2 into 5bf9335 on master.

@coveralls
Copy link

coveralls commented Nov 6, 2017

Coverage Status

Coverage decreased (-3.7%) to 70.082% when pulling 7f934e4 on as2 into 5bf9335 on master.

@strugee
Copy link
Member Author

strugee commented Nov 6, 2017

The tentative plan is to capitalize all verbs that have been straight up dropped and rename verbs when they have been fully renamed or subsumed by another Activity type. We'll do the same for object types, but we'll use Tombstones specially.

Here's the complete list of differences between AS1 and AS2 verb vocabularies:

  • Dropped: access
  • Renamed: share -> Announce
  • Not dropped and I think it doesn't have different semantics: add
  • Dropped: agree
  • Dropped: append
  • Dropped: approve
  • Dropped: archive
  • Dropped: assign
  • Dropped: at
  • Subsumed: attach by Add
  • Dropped: attend
  • Dropped: author verb (note: more specific form of AS1 create)
  • Dropped: authorize
  • Dropped: borrow
  • Dropped: build
  • Dropped: cancel
  • Dropped: close
  • Dropped: complete
  • Dropped: confirm
  • Dropped: consume (maybe subsumed by others?)
  • Dropped: checkin
  • Dropped: deliver
  • Dropped: deny
  • Dropped: disagree
  • Dropped: experience
  • Subsumed: favorite by like
  • Dropped: find
  • Renamed: flag-as-inappropriate to Flag
  • Dropped: give
  • Dropped: host
  • Dropped: insert
  • Dropped: install
  • Dropped: interact
  • Dropped: lose
  • Dropped: make-friend
  • Dropped: open
  • Subsumed: play by View
  • Dropped: present
  • Dropped: purchase
  • Dropped: qualify
  • Dropped: receive
  • Dropped: remove-friend
  • Dropped: replace
  • Dropped: request
  • Dropped: request-friend
  • Dropped: resolve
  • Dropped: return
  • Dropped: retract
  • Subsumed: rsvp-maybe by TentativeAccept
  • Subsumed: rsvp-no by Reject
  • Subsumed: rsvp-yes by Accept
  • Dropped: satisfy
  • Dropped: save
  • Dropped: schedule
  • Dropped: search
  • Dropped: sell
  • Dropped: send
  • Renamed: share to Announce
  • Dropped: sponsor
  • Dropped: start
  • Subsumed: stop-following by Undo
  • Subsumed: submit with a target by Add (maybe?)
  • Subsumed: submit without a target by Create
  • Dropped: tag
  • Dropped: terminate
  • Dropped: tie
  • Subsumed: unfavorite by Undo
  • Subsumed: unlike by Undo
  • Subsumed: unsatisfy by Undo
  • Subsumed: unsave by Undo
  • Subsumed: unshare by Undo
  • Dropped: use
  • Subsumed: watch by View
  • Dropped: win
  • Added: Arrive
  • Added: Block
  • Added: Move
  • Added: Offer
  • Added: TentativeReject
  • Added: TentativeAccept
  • Added: Travel

And here's the list of object type vocabulary differences:

  • Dropped: alert
  • Dropped: badge
  • Dropped: binary
  • Dropped: bookmark
  • Dropped: comment (subsumed by Note...???)
  • Dropped: device
  • Dropped: file
  • Dropped: game
  • Dropped: group
  • Dropped: issue
  • Dropped: job
  • Dropped: offer
  • Dropped: permission
  • Dropped: process
  • Dropped: product
  • Dropped: question
  • Dropped: review
  • Dropped: role (subsumed by Relationship, maybe?)
  • Dropped: task
  • Dropped: team
  • Added: Document
  • Added: Profile
  • Added: Relationship
  • Added: Tombstone
  • Added: Mention

@coveralls
Copy link

coveralls commented Nov 6, 2017

Coverage Status

Coverage decreased (-0.01%) to 73.79% when pulling d6ad7d1 on as2 into 5bf9335 on master.

@detrout
Copy link
Contributor

detrout commented Nov 7, 2017

Thats a lot of changes... is there a way to tell a client that terms are deprecated and give them a chance to adapt? Did the endpoint change or is there a version number so a client can tell that it wont work now?

Just thoughts... Not sure whats truly necessary for activity streams migration

lib/as2.js Outdated
as2["@id"] = as2.id;
delete as2.id;

if (as2.verb === "post") {
Copy link

Choose a reason for hiding this comment

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

If you change the verb, need to change this #L145 or change the name of Activity.prototype.apply[Method]

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't need to change anything outside of this file since this runs so late in the request-response cycle. Basically everywhere else doesn't have to care.

Copy link

Choose a reason for hiding this comment

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

You only change the output/response?

What will happened with the petitions?, if comes the request with AS2, it transform to AS1 before process/save?

Copy link
Member Author

Choose a reason for hiding this comment

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

@vxcamiloxv we don't support AS2 submissions yet but when we do that'll be how it works. At least for the time being.

Eventually we'll want to move to AS2 storage but. Not yet. We want the API to stabilize, etc.

Copy link

Choose a reason for hiding this comment

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

I think will be strange (and confusing), if the input is AS1 and the output AS2, for the external apps could be more work (migrate the output and later the input) and probability cause more side effects and more errors.

I think is better one big change a not change by parts, is better one migration than 2 big migrations in a short period of time, mostly when is related with the input/output of a API

Copy link
Member Author

Choose a reason for hiding this comment

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

@vxcamiloxv I would agree with you except that AS2 output is opt-in. So if clients don't want to deal with the hassle of consuming two different formats in input and output (I certainly wouldn't), they don't have to. They can just wait for AS2 input to ship too.

Copy link

Choose a reason for hiding this comment

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

Ha ok, yes, probably they will wait for full implementation

@strugee
Copy link
Member Author

strugee commented Nov 7, 2017

@detrout endpoints do HTTP content negotiation. Clients only get this representation if they specifically ask for AS2 in the Accept header.

@strugee
Copy link
Member Author

strugee commented Nov 7, 2017

So to be clear, this is fully backwards-compatible and will ship as semver-minor.

@strugee
Copy link
Member Author

strugee commented Nov 9, 2017

Since writing this vocab plan I've found https://github.com/snarfed/granary (/cc @snarfed); we should try to align with that processing model. Otherwise I think this is ready to implement.

@puckipedia
Copy link

puckipedia commented Nov 17, 2017

So quick note: It seems there's no @context in the AS2 representation. Together with this, the AS2 context defines type to be an alias of @type and idto alias @id, so those should be used instead as well :)

for the rest, I'm more than willing to test stuff against Kroeg for interop testing :P

@coveralls
Copy link

coveralls commented Nov 22, 2017

Coverage Status

Coverage increased (+0.1%) to 73.908% when pulling 9828f3c on as2 into f0d30e2 on master.

@coveralls
Copy link

coveralls commented Dec 4, 2017

Coverage Status

Coverage decreased (-3.7%) to 70.087% when pulling 3df16ad on as2 into a5b7b9b on master.

@coveralls
Copy link

coveralls commented Dec 4, 2017

Coverage Status

Coverage increased (+0.2%) to 74.224% when pulling e596168 on as2 into 3637b31 on master.

@strugee
Copy link
Member Author

strugee commented Feb 7, 2018

Here's the current list of TODOs:

  • Normalize well-known Public collection ids
  • Write a compatibility @context for dropped vocabulary terms
  • Properly output Undo activitites

If people complain, we can readd these. But better to start with them
gone and add them later, rather than have to go through a full
semver-major cycle in order to remove them later.

Also, these were dropped for a reason. There was no actual evidence of
`upstreamDuplicates` and `downstreamDuplicates` being used, and
`title` was deprecated for similar reasons. So it just doesn't seem
worth supporting them.
@strugee
Copy link
Member Author

strugee commented Apr 9, 2018

@evanp to answer your question on IRC - I'm down to merge this whenever provided that a) tests are passing and b) nothing is half-implemented or whatever. I'll try to do a code review tonight 👍

@ghost ghost dismissed a stale review April 20, 2018 15:54

avoid problems

@evanp evanp merged commit 0e18d5b into master Apr 27, 2018
@strugee strugee deleted the as2 branch July 13, 2018 00:24
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.

5 participants