DEV Community

sfrunza13
sfrunza13

Posted on

Final ODS post

My final ODS post

It has been quite the semester beginning to work in open source, from building our own projects and uploading them to package managers for our respective languages, going through our first hacktoberfest, learning how to collaborate with one another and the world at large, it has been a steady climb to this finale.

I have been happy to actually make a few small code contributions in varying languages and of varying sizes and scopes while taking this course and today I will talk about the state that my latest PR is in.

When last you heard from me my PR was failing all of opsdroid's CI. This is not the story of a complex debugging session, or complex logic, no. Let me tell you the story of a character.

The devil's in the details

The opsdroid project has over ten different checks in CI along with a coverage check to ensure that testing coverage remains just as high as it was in the last mainline commit, I was failing all of them. Initially I did not give much thought to that and just aimed to make the ephemeral work, which I did through allowing the user to specify whether they wanted an in_channel or ephemeral response type.

The tests had all been written for in-channel message responses, which should mean that the default that I had set should work for the existing tests, I knew the problem could not be with the tests since up until I started writing my little bit of code they had all been working. After taking a closer look I saw the problem.

There is a conditional statement that I use to determine which post request to make to slack and in it I check against a string which reads in-channel not in_channel which is the default I set.

A small mistake of inattention is what ended up breaking all of CI, literally a single character. Once I replaced the underscore with a hyphen it worked fine.

Adding tests

To add a test I looked at the method they used in the existing tests when they wanted to make a change to the connector's configuration since that is where I would specify my response type as ephemeral to reach my new POST to ephemeral instead of message. I also added the user ID to the request since the ephemerals require a specific user to display to and not just a general channel. Once I had everything set up I was sure it was going to work and it didn't. Again once I looked into it it was the smallest of mistakes, another misplaced character.

At the top of test_connector.py the api calls and responses to test against are defined in this manner:
CHAT_POST_EPHEMERAL = ("/chat.postEphemeral", "POST", {"ok": True}, 200)

My problem I found, was that I had a comma where there should have been a colon which turned my dict of "ok":True string to boolean into a set instead.

I spent WAY too long figuring that out, and I think I might end up copying and pasting these things instead of manually typing them out in the future and just replacing the bits that are pertinent to what I want to change.

In any case after I was done having my day ruined by typos all of CI passed.

Radio Silence

So far no one has reached out to comment on the PR I filed even now that I have marked it as ready for review and even though it passes CI. I did mention it in their elements chat as well and one of the maintainers reacted with the party emoji but I do not think anyone has really looked over my code yet as I haven't gotten specific comments or a merge.

I think one of the things I am worried about is that this solution is all or nothing. Either you are always getting regular messages or you are always getting Ephemerals. The issue was not very specific in this regard and I have not gotten clarification on how they would like it implemented yet despite inquiry.

Bottom line, what I have works for now, if they would like a change they must just let me know and I will implement it.

Here is an example of the greeting and dance skills being returned as ephemerals:

Image description

Thanks for reading.

Top comments (0)