Skip to content

Feature/memento#195

Merged
rubensworks merged 18 commits into
masterfrom
feature/memento
Aug 8, 2018
Merged

Feature/memento#195
rubensworks merged 18 commits into
masterfrom
feature/memento

Conversation

@mielvds

@mielvds mielvds commented Aug 3, 2018

Copy link
Copy Markdown

This implements the Memento protocol (#79) and adds an -d parameter to the actor-init-sparql.

@CLAassistant

CLAassistant commented Aug 3, 2018

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rubensworks

Copy link
Copy Markdown
Member

Something seems to be wrong with the lockfile. Maybe try forcefully checking the lockfile out from master and re-running yarn install will fix it.

Also, be sure to sign the CLA.

@coveralls

coveralls commented Aug 3, 2018

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 383

  • 28 of 28 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 353: 0.0%
Covered Lines: 2405
Relevant Lines: 2405

💛 - Coveralls

@rubensworks rubensworks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like the test coverage for init-sparql and the memento actor is not 100% yet.

public async run(action: IActionHttp): Promise<IActorHttpOutput> {
const datetime: Date = action.context && action.context.get('datetime');

// 1. Create ActionHttp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would remove these 1., 2., 3. 4., 5. comments, they don't really add any information next to the code IMO.

status: httpResponse.statusCode,
url: httpResponse.responseUrl,
// when the content came from another resource because of conneg, let Content-Location deliver the url
url: headers.has('content-location') ? headers.get('content-location') : httpResponse.responseUrl,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also add a dedicated unit test for this to the HTTP-native actor?

@mielvds

mielvds commented Aug 7, 2018

Copy link
Copy Markdown
Author

@rubensworks I've tried to cover the requested changes as much as possible, but for the unit tests it takes me to long to figure out the 100% coverage in actor-init-sparql and actor-http-memento. I suggest you have a look?

@rubensworks

Copy link
Copy Markdown
Member

According to the coveralls logs this is the line that is missed: https://coveralls.io/builds/18360561/source?filename=packages%2Factor-init-sparql%2Flib%2FActorInitSparql.ts#L105

And here is the coverage file for the memento actor: https://coveralls.io/builds/18360561/source?filename=packages%2Factor-http-memento%2Flib%2FActorHttpMemento.ts#L23

(You should be able to see the non-covered lines when running yarn test as well)

@mielvds

mielvds commented Aug 7, 2018

Copy link
Copy Markdown
Author

Yeah of course, I got that. Let me be more specific:

  • how to cover the branches?
  • I'm not sure how to inspect the context when testing runfrom actor-init-sparql. Is there a trick I can use or should I change something to the class?

@rubensworks

Copy link
Copy Markdown
Member

So for actor-init-sparql, you can add a test that executes the command with the -d options similar to this test: https://github.com/comunica/comunica/blob/master/packages/actor-init-sparql/test/ActorInitSparql-test.ts#L218-L227

For the memento actor, you should add a test that has a context, but does not have an init or accept-datetime header, and ensure that it rejects.

@mielvds

mielvds commented Aug 7, 2018

Copy link
Copy Markdown
Author

it should be fine now

@rubensworks rubensworks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me!

@rubensworks rubensworks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh wait, just noticed on minor thing.


// Define the datetime
if (args.d) {
context.datetime = new Date(args.d);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I just noticed this, but this has to be set via a namespaced context key, just like KEY_CONTEXT_SOURCES below. You could add something like KEY_CONTEXT_DATETIME to the memento actor class.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ActorHttpMemento also has to be updated to use this key, it will always fail otherwise, as well as the unit tests.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oops, amateur move. Now fixed

@rubensworks rubensworks merged commit 3215d15 into master Aug 8, 2018
@rubensworks rubensworks deleted the feature/memento branch August 8, 2018 08:25
@pietercolpaert

Copy link
Copy Markdown
Member

I wonder whether we should add more documentation in the README.md about how this actor could be invoked from different query languages, as a library or as a command line interface. Right now, only the pull request mentions a -d parameter

@rubensworks

Copy link
Copy Markdown
Member

@pietercolpaert I think this is a problem in general for all actors. At some point we should start working on some detailed usage documentation for each actor, see #116.

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.

6 participants