#dev-contrib

1 messages ยท Page 162 of 1

austere hornet
#

sir-lancebot#901 please

dusky shoreBOT
patent pivot
#

yea dm_sent lgtm

static canyon
#

That's a lot of tests for the user command lmao

patent pivot
#

needs a branch update

#

but otherwise probably can merge

static canyon
#

Thanks joe

#

I'm rather confused by this. Can it be ignored?

#

I've got 8 failing tests and no clue why

#

What's weird is that works fine on the above test

#

This is the breakdown of the errors:```py
FAILED tests/bot/exts/moderation/test_incidents.py::TestMakeEmbed::test_make_embed_content - AssertionError: 'this is an incident' != 'this is an incident\n\n__*Reported on <t:1:D> at ...'

FAILED tests/bot/exts/moderation/test_incidents.py::TestArchive::test_archive_clyde_username - AttributeError: 'NoneType' object has no attribute 'kwargs'

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_can_explicitly_target_themselves - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_may_use_command_in_bot_commands_channel - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_moderators_can_target_another_member - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_staff_members_can_bypass_channel_restriction - AssertionError: expected call not found.

FAILED tests/bot/exts/moderation/test_incidents.py::TestProcessEvent::test_process_event_confirmation_task_is_awaited - AssertionError: Expected mock to have been awaited.

FAILED tests/bot/exts/moderation/test_incidents.py::TestArchive::test_archive_relays_incident - AssertionError: Expected 'send' to be called once. Called 0 times.```

#

Hmm I might have an idea

#

I think I branched from a different PR instead of main

gritty wind
#

The method is already an instance method (it's being called from self.cog), and you don't need to explicitly pass self in those cases

#

You'd really only pass self explicitly if you're calling it like Class.method() instead of Class().method()

static canyon
gritty wind
#

I assume so

static canyon
#

Aight

gritty wind
#

Mind you I don't have actual context

fallen patrol
#

oh wait

#

I'm tired

gritty wind
#

๐Ÿ”จ

fallen patrol
#

that never happened

gritty wind
#

I thought you were just making a joke lol

static canyon
#

What confuses me is this

#

It's fine when another (optional) argument is passed

fallen patrol
gritty wind
#

What's the actual signature for that function

static canyon
fallen patrol
gritty wind
#

Strange that it isn't complaining on the first one, really feels like it ought to

static canyon
fallen patrol
#

pretty sure the tests have self.cog

static canyon
gritty wind
#

Unless that method is mocked in the top example

fallen patrol
#

is it Com and pushed cause I'll pull down and look at the tests

static canyon
gritty wind
#

wery veird

fallen patrol
#

going to my pc now

#

I told myself I wouldn't develop at all today...

#

but broke that... 5 minutes after midnight so

static canyon
# gritty wind wery veird

Keep in mind I didn't write these tests, so someone else passed self.cog in and they worked before my PR ๐Ÿคท

static canyon
gritty wind
#

not even new years but we're already breaking resolutions

fallen patrol
#

no, my monitor still works ๐Ÿคก

gritty wind
#

I'd assume so

fallen patrol
#

which branch or pull is this?

gritty wind
#

Anyways, as long as it works, I guess it's fine

#

From what Tizzy just said, I assume master

fallen patrol
#

master.

#

checks didn't fail so

#

seems like incident-archive-msg-improvements @static canyon ?

#

also is it pushed

static canyon
#

Not pushed yet because I'm fixing stuff

fallen patrol
#

ah, could you push what you have so i can debug the tests, or are they broken on what's pushed?

static canyon
#

I removed self.cog from all the function calls and now there's 8 tests failing still but it's a different 8

gritty wind
#

lol nice

#

whatcha got

static canyon
#
FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_staff_members_can_bypass_channel_restriction - TypeError: user_info() missing 1 required positional argument: 'ctx'
```niceee
gritty wind
#

Heh

static canyon
#

The call in that one ispy await self.cog.user_info(ctx)

gritty wind
#

Can you show the init where it sets self.cog

static canyon
#

So I guess for some reason self.cog doesn't get passed?

#

Err there's multiple definitions of self.cog

gritty wind
#

o no

#

that would help explain the differing behavior

static canyon
#

I think this is the one we want```py
@unittest.mock.patch("bot.exts.info.information.constants")
class UserCommandTests(unittest.IsolatedAsyncioTestCase):
"""Tests for the !user command."""

def setUp(self):
    """Set up steps executed before each test is run."""
    self.bot = helpers.MockBot()
    self.cog = information.Information(self.bot)
gritty wind
#

With that one, it'll definitely not require passing self.cog

#

Where are the other definitions

fallen patrol
#

lemme take a look

#

which file?

static canyon
#
class UserInfractionHelperMethodTests(unittest.IsolatedAsyncioTestCase):
    """Tests for the helper methods of the `!user` command."""

    def setUp(self):
        """Common set-up steps done before for each test."""
        self.bot = helpers.MockBot()
        self.bot.api_client.get = unittest.mock.AsyncMock()
        self.cog = information.Information(self.bot)
        self.member = helpers.MockMember(id=1234)```
static canyon
fallen patrol
#

;-; ~~a screenshot smh I can't copy paste that

#

tests/bot/exts/info/test_information.py

gritty wind
#

Hm, that's more or less the same

#

I wonder why it's failing

static canyon
#
class InformationCogTests(unittest.IsolatedAsyncioTestCase):
    """Tests the Information cog."""

    @classmethod
    def setUpClass(cls):
        cls.moderator_role = helpers.MockRole(name="Moderator", id=constants.Roles.moderators)

    def setUp(self):
        """Sets up fresh objects for each test."""
        self.bot = helpers.MockBot()

        self.cog = information.Information(self.bot)
``````py
@unittest.mock.patch("bot.exts.info.information.constants.MODERATION_CHANNELS", new=[50])
class UserEmbedTests(unittest.IsolatedAsyncioTestCase):
    """Tests for the creation of the `!user` embed."""

    def setUp(self):
        """Common set-up steps done before for each test."""
        self.bot = helpers.MockBot()
        self.bot.api_client.get = unittest.mock.AsyncMock()
        self.cog = information.Information(self.bot)
``````py
@unittest.mock.patch("bot.exts.info.information.constants")
class UserCommandTests(unittest.IsolatedAsyncioTestCase):
    """Tests for the `!user` command."""

    def setUp(self):
        """Set up steps executed before each test is run."""
        self.bot = helpers.MockBot()
        self.cog = information.Information(self.bot)
``````py
class UserInfractionHelperMethodTests(unittest.IsolatedAsyncioTestCase):
    """Tests for the helper methods of the `!user` command."""

    def setUp(self):
        """Common set-up steps done before for each test."""
        self.bot = helpers.MockBot()
        self.bot.api_client.get = unittest.mock.AsyncMock()
        self.cog = information.Information(self.bot)
        self.member = helpers.MockMember(id=1234)```
#

These are the four definitions @gritty wind

fallen patrol
#

!paste

stable mountainBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

gritty wind
#

They all just set up self.cog in the same way

static canyon
#

Yeah

#

So why doesn't it work

gritty wind
#

Which tests fail

static canyon
#

lol

gritty wind
#

Ah I see it up

static canyon
#

Right now it's these that fail:```py
FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_staff_members_can_bypass_channel_restriction - TypeError: user_info() missing 1 required positional argument: 'ctx'

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_may_use_command_in_bot_commands_channel - TypeError: user_info() missing 1 required positional argum...

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_can_explicitly_target_themselves - AttributeError: Mock object has no attribute 'author'

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_moderators_can_target_another_member - AttributeError: Mock object has no attribute 'author'

FAILED tests/bot/exts/info/test_information.py::InformationCogTests::test_role_info_command - AttributeError: Mock object has no attribute 'send'

FAILED tests/bot/exts/info/test_information.py::InformationCogTests::test_roles_command_command - TypeError: roles_info() missing 1 required positional argument: 'ctx'

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_member_cannot_target_another_member - AttributeError: Mock object has no attribute 'author'

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_member_cannot_use_command_outside_of_bot_commands - TypeError: user_info() missing 1 required positional ...```

austere hornet
static canyon
gritty wind
#

big brain

austere hornet
static canyon
#

They wanted the file path copy-pasteable

austere hornet
#

Ahh

#

Mb

fallen patrol
#

dw, it was funny

austere hornet
#

Yeah ik

fallen patrol
#

...

#

all tests in tests/bot/exts/info/test_information.py pass locally

#

so uh

#

have fun ๐Ÿคก

static canyon
#

lol

gritty wind
#

Well, did you make the changes locally lol

fallen patrol
#

no, because i don't have said changes smh

#

they weren't pushed or pasted or anything ๐Ÿ˜”

static canyon
#

Wait no

#

user-improvement branch

fallen patrol
#

oh

static canyon
#

The incidents one is for a different pr

fallen patrol
#

oh wait

#

4 tests fail on the branch i listed above

static canyon
#

So just ignore it all

fallen patrol
#

that seems like just not finished rather than bug tho

#

yeah

#

although now i'm gonna run the tests on main jussst to have a local baseline

#

and then check out the actually correct branch

static canyon
#

lol

fallen patrol
#

so disgraceful smh

#

imagine writing tests lol can't be me

static canyon
#

Should I pass the self.cog back in again? Since that seems to be needed ๐Ÿคท @gritty wind

static canyon
gritty wind
#

I guess so, but I still want to know what dark fuckery is being done to make that a thing

fallen patrol
#

i copied the pydis mocks and then made some improvements for my own code

#

bot#1911 to share them upstream

dusky shoreBOT
gritty wind
#

Git blame says this is KS' doing ๐Ÿ‘€

fallen patrol
#

git blame always says sometone did it

#

...i'm leaving that typo

gritty wind
#

Someone mocked the cog, instead of making an actual instance of the cog

#

Turns out it's not a very good mock /s

#

At least in the methods where it fails with the changes

fallen patrol
#

wait i actually

#

huh interesting

gritty wind
#

I honestly have no idea where though lol

fallen patrol
#

what if you use a mock cog and set functions to functions on the mock cog, so you'd be testing just the specific functions

#

^ that's not relevant but is speculation for later

gritty wind
#

Wait

#

Hm no

#

self.cog is a mock when the debugger is inside the actual function

#

It's because I'm looking at self when it's set to ctx because of the arg fuckery

#

So ignore that part

fallen patrol
#

oh i get 12 failed tests

gritty wind
#

This might explain it though:

> type(self.cog)
<class 'bot.exts.info.information.Information'>

> type(self.cog.user_info)
<class 'bot.monkey_patches.Command'>
static canyon
#

lol

#

fgs

static canyon
fallen patrol
#

!d unittest.IsolatedAsyncioTestCase

stable mountainBOT
#

class unittest.IsolatedAsyncioTestCase(methodName='runTest')```
This class provides an API similar to [`TestCase`](https://docs.python.org/3/library/unittest.html#unittest.TestCase "unittest.TestCase") and also accepts coroutines as test functions.

New in version 3.8.
fallen patrol
#

some of these failures are valid....

#

oh wait

fallen patrol
static canyon
#

I've now got only 5 failing tests

#

Now clue how but that's good

#
FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_moderators_can_target_another_member - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_can_explicitly_target_themselves - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::InformationCogTests::test_role_info_command - AttributeError: Mock object has no attribute 'send'

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_staff_members_can_bypass_channel_restriction - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_may_use_command_in_bot_commands_channel - AssertionError: expected call not found.
fallen patrol
#

!d unittest.mock.patch

static canyon
#

It looks weird with a default though because the command itself (which calls this function) has a default

stable mountainBOT
#

unittest.mock.patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)```
[`patch()`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch "unittest.mock.patch") acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the *target* is patched with a *new* object. When the function/with statement exits the patch is undone.

If *new* is omitted, then the target is replaced with an [`AsyncMock`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.AsyncMock "unittest.mock.AsyncMock") if the patched object is an async function or a [`MagicMock`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.MagicMock "unittest.mock.MagicMock") otherwise. If [`patch()`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch "unittest.mock.patch") is used as a decorator and *new* is omitted, the created mock is passed in as an extra argument to the decorated function. If [`patch()`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch "unittest.mock.patch") is used as a context manager the created mock is returned by the context manager.
fallen patrol
#

ah

static canyon
fallen patrol
#

i have 4 now too lol

static canyon
#

Okay, cool

fallen patrol
#

8 of them were missing args

static canyon
#

Just to confirm, this is the 4 right?```py
FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_staff_members_can_bypass_channel_restriction - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_may_use_command_in_bot_commands_channel - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_regular_user_can_explicitly_target_themselves - AssertionError: expected call not found.

FAILED tests/bot/exts/info/test_information.py::UserCommandTests::test_moderators_can_target_another_member - AssertionError: expected call not found.

fallen patrol
#

btw you might find this helpful: --sw or --stepwise

#

also

#

if you pass tests/bot/exts/info/test_information.py::UserCommandTests::test_moderators_can_target_another_member to pytest

pytest tests/bot/exts/info/test_information.py::UserCommandTests::test_moderators_can_target_another_member
``` you can run just that specific test
static canyon
#

๐Ÿ‘

#
E           AssertionError: expected call not found.
E           Expected: create_user_embed(<MockContext spec_set='Context' id='1788322016032'>, <MockMember spec_set='Member' id='1788321768208'>)
E           Actual: create_user_embed(<MockContext spec_set='Context' id='1788322016032'>, <MockMember spec_set='Member' id='1788321768208'>, False)
```Looks like I just need to update what it expects
#

Yep, all working now

fallen patrol
#

@static canyon

static canyon
#
create_embed.assert_called_once_with(ctx, self.target)```to```py
create_embed.assert_called_once_with(ctx, self.target, False)```etc.
fallen patrol
#

lol we got it at the exact same time

#

I have @gritty wind to thank for helping me 10/10 support

static canyon
#

Thanks guys ๐Ÿ˜„

fallen patrol
#

1 test failed ๐Ÿ‘€

static canyon
fallen patrol
#

wait

#

nvm nothing is wrong

gritty wind
#

Any contribs around to merge bot#2028 please?

brazen charm
#

why the change from ctx.bot to self.bot?

static canyon
#

Scale asked for it

brazen charm
#

and why is it being passed around when it's causing issues and is available from the global instance

static canyon
gritty wind
#

To clarify, the typehint isn't wrong

#

What we're passing is wrong compared to the type hint

#

afaik we don't patch the internal ctx.bot object

#

just our global bot instance

#

Unless those are linked somehow?

brazen charm
#

pretty sure that should be our subclasses bot

hoary haven
#

ot names didn't change today shrug

gritty wind
#

Ah, that makes sense

fallen patrol
hoary haven
#

oh lol i was like ok yeah makes sense bot wants a day off for christmas

fallen patrol
#

which actually means... all tasks that were supposed to run probably

#

hmm did anything important not run

#

nah seems like they all ran or aren't important

gritty wind
#

!int e ```py
from bot.constants import Channels, MODERATION_ROLES
CHANNELS = (Channels.off_topic_0, Channels.off_topic_1, Channels.off_topic_2)

channel_0_name, channel_1_name, channel_2_name = await bot.api_client.get(
'bot/off-topic-channel-names', params={'random_items': 3}
)
channel_0, channel_1, channel_2 = (bot.get_channel(channel_id) for channel_id in CHANNELS)

await channel_0.edit(name=f'ot0-{channel_0_name}')
await channel_1.edit(name=f'ot1-{channel_1_name}')
await channel_2.edit(name=f'ot2-{channel_2_name}')
log.debug(
"Updated off-topic channel names to"
f" {channel_0_name}, {channel_1_name} and {channel_2_name}"
)

stable mountainBOT
#
In [1]: from bot.constants import Channels, MODERATION_ROLES
   ...: CHANNELS = (Channels.off_topic_0, Channels.off_topic_1, Channels.off_topic_2)
   ...: channel_0_name, channel_1_name, channel_2_name = await bot.api_client.get(
   ...:     'bot/off-topic-channel-names', params={'random_items': 3}
   ...: )
   ...: channel_0, channel_1, channel_2 = (bot.get_channel(channel_id) for channel_id in CHANNELS)
   ...: await channel_0.edit(name=f'ot0-{channel_0_name}')
   ...: await channel_1.edit(name=f'ot1-{channel_1_name}')
   ...: await channel_2.edit(name=f'ot2-{channel_2_name}')
   ...: log.debug(
   ...:     "Updated off-topic channel names to"
   ...:     f" {channel_0_name}, {channel_1_name} and {channel_2_name}"
   ...: )
   ...: 
Out[1]: 
```... response truncated; full contents at https://paste.pythondiscord.com/daqipamozu.py
gritty wind
#

First time getting to see the changes roll out

hoary haven
#

internals-and-pepsi yum

#

lol go to sleep scale featherknightZzz

gritty wind
#

Maybe >.>

#

Have to do midnight patches

fallen patrol
#

what tz?

patent pivot
#

coordinated scaleios clock

fallen patrol
#

.time CSC

#

TI(re)L .time is a command

austere hornet
fallen patrol
#

its an alias

austere hornet
#

Oh

#

But you gave me a great idea - we should have a .timezone-convert <time> <from which timezone> <to what timezone> that gives you the difference in # of hours between 2 timezones. What do people think about that?

#

(If we don't already have that, that is)

tawdry vapor
#

That's probably easy enough to do with an eval already

fallen patrol
#

given we're adding .epoch, i don't see how a timezone command shouldn't be added because it can be done in eval

tawdry vapor
#

I misunderstood it as converting a time to a different timezone, which would be simpler. Anyway, that bot is just meant to be for fun and learning so I don't mind what gets added.

fallen patrol
#

ah gotcha ๐Ÿ‘

austere hornet
tawdry vapor
#

Ah i missed the <time> argument you had

#

So it would essentially be like

#

!e import arrow; print(arrow.utcnow().to("Europe/Berlin"))

stable mountainBOT
#

@tawdry vapor :white_check_mark: Your eval job has completed with return code 0.

2021-12-26T05:02:19.194466+01:00
fallen patrol
#

say....

#

do the bots share the same redis instance?

tawdry vapor
#

Yes, I think so.

#

They connect to the same host and I only see one redis container in prod

fallen patrol
#

neat

#

oh come on!

#

github!!!

short snow
#

hmm?

fallen patrol
#

my actually important review comment wasn't saved

short snow
#

oh lol

fallen patrol
#

was about api requests

clever wraith
#

also fwiw

returned to the frontend is documented on

#

I actually wonder in which cases 500 is returned

#

I guess a general 500 handler should be added

#

oi, I found a bug when reading the unittesting code (misuing strip)

#

and also it doesn't catch base exception from the user code meaning you could trick it into generating a 500

clever wraith
#

how do you make a token pithink

#

I guess you must run the frontend for that?

#

it would be nice to have a utility script to generate one

#

or even have just the backend drop one in the console if debug mode is enabled (cc @gritty wind)

gritty wind
#

And reported as "failed" for the suite

gritty wind
#

But we've added a special form for debug that will be sent if no other form exists, which does have oauth

#

so yes, you do need to run the frontend, but then you'll get a token

#

This is all documented in the getting started guide

#

The backend also has /admin_dev route which allows you to add any admin user without requiring a pre-existing admin account, which resolves that cyclical dependency

#

Because I've just done it right now, the steps to getting a full fledged admin token are:

#
  1. Run backend and frontend
  2. Go to frontend
  3. Auth with the only form there
  4. Copy the cookie
  5. Make a request to /admin_dev with your ID
  6. You're done
clever wraith
gritty wind
#

Ah, I see what you mean

clever wraith
#

also could you assign me to the issue?

gritty wind
#

Sure, but don't expect a review from anyone :P

#

Assigned

clever wraith
#

haha, thanks

gritty wind
#

Actually, if you get it in now, I can review

clever wraith
#

yeah

#

just gimme some time to fork and all

#

it is a quite small PR

gritty wind
#

Right

clever wraith
#

no form currently in prod uses uppercase letters in its ID?

gritty wind
#

No

clever wraith
#

Sending DMs also sound interesting

gritty wind
#

It's more or less done iirc

clever wraith
#

oh wait you are working on it

#

bad squishie not being assigned to the issue

gritty wind
#

Is it possible to have the form ID be automatically lowercased when fetching/writing from the DB? I have a feeling it'll get forgotten eventually

#

It might especially be lost in testing because people won't think to

clever wraith
#

that's what the constraint is doing

gritty wind
#

I mean for the other places where you're manually calling lower

clever wraith
#

I submitted a form called siGNUps and it saved it to the db as signups

#

ah, the problem is the frontend here

#

hmm

#

maybe a validator could do the trick

#

nope

#

I don't think that's a thing you can do

gritty wind
#

Alright thatโ€™s fine

#

Thanks Chris, but Iโ€™ve hooked up my brain to the forms database

#

I know everything hyperlemon

vale ibex
#

lol

clever wraith
#

plot twist, chris hooked his brain onto yours

vale ibex
#

I imagine you could do that is we used request models

#

then the pydantic convertor would work

gritty wind
#

Not possible, he hasnโ€™t gone mad yet

gritty wind
vale ibex
#

lol yea

clever wraith
#

I thought that's how the admin team worked

#

disappointed

gritty wind
clever wraith
gritty wind
#

This just means we donโ€™t need to make all props optional, or require all props on all requests

#

Hm we could create a base form model thatโ€™s just ID

#

It would run it on the arg passed to the requestitsef

clever wraith
#

also I'm not sure why you have pre=True on some models with a single validator haha

vale ibex
#

I more mean ```diff

  • async def get(self, request: Request, form_id: some_con_str) -> JSONResponse:
  • async def get(self, request: Request) -> JSONResponse:
    """Returns single form information by ID."""
    admin = request.user.admin if request.user.is_authenticated else False
  •   form_id = request.path_params["form_id"].lower()
    
#

then you wouldn't need to lower() all the path params

gritty wind
#

How would the request actually look

vale ibex
#

since it's done by the type hint

clever wraith
#

I guess it is the same problem as you have to remember to use the constraint

vale ibex
#

true

vale ibex
#

I usually do this with the decorator, so it might be slightly different syntax like this

#

IE ```py
@app.get("/foo/{bar}")
async def read_bar(bar: ham):

clever wraith
#

well you'd have to swap _id for form_id wouldn't you

vale ibex
#

depends what the actual request looks like

#

I'm not familiar with forms directly, but that's a format that would work at least

#

I had assumed since it was path_params["form_id"] the path param was form_id

clever wraith
#

it is a bit of a mixed bag, going by ak's memory haha

#

yeah in that case it is form_id

vale ibex
#

cool

clever wraith
#

should be giveOwOy but oh well can't have everything in life

#

oh also fyi @vale ibex

Getting into a bad data situation like this is directly blocked in the command anyway, so shouldn't be possible.
Our github account is linked to our three discord accounts haha

#

if it doesn't break that's fine, we can just poke y'all :3

vale ibex
#

Ah right

#

well it won't break yea, dict generators just work

#

just the same as if you overwrite a dict key normally

clever wraith
#

yeah yeah, not sure why she wrote that

vale ibex
#

I wouldn't mind a subsequent PR to support multiple links, but don't have the time to do it myself atm

clever wraith
#

I would say it is fine

vale ibex
#

at least not until the new year

cold island
#

@vale ibex whenever you've got a moment, your requested changes on bot#1889 were addressed

dusky shoreBOT
clever wraith
#

now I wish we wouldn't have deleted our old test server

vale ibex
#

if not, it's something we can do in a following pr anyway

#

.

cold island
#

The main difference is that it still relies on there being a schema

vale ibex
#

Yea

cold island
#

So I guess I'm fine with either

#

(now or in a future PR)

vale ibex
#

I mean if this is a clear improvement, then we can merge

cold island
#

There's no particular rush, I'm just trying to clear filter-related PRs

vale ibex
#

yea makes sense ๐Ÿ˜›

#

Ah, of course, there's lock conflicts ๐Ÿ˜…

cold island
#

yeah I can relock in the evening if no one gets to it

vale ibex
#

We'd lose policy bot then tho

cold island
#

oh hmm

vale ibex
#

I can do it right now, lol

#

@gritty wind are you here to give a proxy approval?

clever wraith
#

I can give a contrib approval, that should work?

vale ibex
#

yea should do

#

jsut checking out the pr now

#

poetry lock takinga while on this laptop

#

might do a @hoary haven and buy a new macbook

clever wraith
#

I get the error that blue mentioned on the aoc role PR

#

it will error if someone is on the leaderboard and doesn't have any linked account, from what I can see

vale ibex
#

Ahhhhh, I thought he was referring to the member_aoc_info["name"] slice

#

but now I see it was the slice that uses that

clever wraith
#

I don't know how you managed that one chris lol

#

there are multiple programming error

#
diff --git a/bot/exts/events/advent_of_code/_cog.py b/bot/exts/events/advent_of_code/_cog.py
index 7315d166..90c42783 100644
--- a/bot/exts/events/advent_of_code/_cog.py
+++ b/bot/exts/events/advent_of_code/_cog.py
@@ -93,25 +93,25 @@ class AdventOfCode(commands.Cog):
                 # Only give the role to people who have completed all 50 stars
                 continue
 
-            member_id = aoc_name_to_member_id[member_aoc_info["name"]]
+            member_id = aoc_name_to_member_id.get(member_aoc_info["name"], None)
             if not member_id:
                 continue
 
-            member = members.get_or_fetch_member(guild, member_id)
+            member = await members.get_or_fetch_member(guild, member_id)
             if member is None:
                 continue
 
             if member in completionist_role.members:
                 if await self.completionist_block_list.contains(member_id):
-                    await members.handle_role_change(member, member.remove_roles)
+                    await members.handle_role_change(member, member.remove_roles, completionist_role)
                 continue
 
-            await members.handle_role_change(member, member.add_roles)
+            await members.handle_role_change(member, member.add_roles, completionist_role)
             members_who_deserve_role.add(member)
 
         for member in set(completionist_role.members) - members_who_deserve_role:
             # Remove the role from members who have it but don't deserve it (been removed from the leaderboard)
-            await members.handle_role_change(member, member.remove_roles)
+            await members.handle_role_change(member, member.remove_roles, completionist_role)
 
     @commands.group(name="adventofcode", aliases=("aoc",))
     @whitelist_override(channels=AOC_WHITELIST)```
#

if you want to quickly fix them, this code should work

gritty wind
#

Sorry I caught a glimpse of myself in the mirror and have been distracted staring

#

Do you still need me for anything

clever wraith
#

Fame and money

#

Oh and a proxy approval

vale ibex
#

kk bot#1889 is pushed up

dusky shoreBOT
vale ibex
#

but it's pushed now

#

will squash before merge

clever wraith
#

Lmao

static canyon
static canyon
#

(I asked for it to be a log.warning since it means we'd need to remove them via int e)

#

I suppose sending to mod-meta would work the same though (and arguably makes more sense)

vale ibex
#

imo, it shouldn't be a log, they should just be removed from the cache entirely

#

a message to mod-meta would make more sense over sentry, since this is mod domain, not core-dev

static canyon
#

I wasn't sure whether that's something we wanted to do

static canyon
static canyon
vale ibex
#

Yea, I can't think of a reason why not to

static canyon
#

Maybe just an info log saying they were removed and why

#

I think that could be helpful

vale ibex
#

๐Ÿ‘

#

Added a comment

austere hornet
clever wraith
#

dammit i missed my merge

fallen patrol
#

uhhh is lance broken

#

playing status, now I wonder if it was just a fluke

#

"playing since 60 minutes ago"

#

could someone on devops redeploy lance

gritty wind
#

If probably doesnโ€™t have a reset after the last day of aoc

#

.int e 0;exit()

fallen patrol
#

smh you could have used king arthur

gritty wind
#

I donโ€™t know the commands ๐Ÿ˜ญ

fallen patrol
#

arthur deployments redeploy sir-lancebot

vocal prairie
#

restart, not redeploy iirc

gritty wind
#

I think itโ€™s aliased to both

fallen patrol
#

I've seen Chris use redeploy for restart

vocal prairie
#

oh interesting

fallen patrol
#

I don't think there's any difference really

vocal prairie
#

arthur help deploy restart

#

sad

fallen patrol
#

you have to have the devops role

vocal prairie
#

yeah

fallen patrol
#

speaking of which @gritty wind congrats on devops!
I don't remember seeing it last I stalked viewed your profile

gritty wind
#

Slash commands when

#

Ah ty ty

fallen patrol
# gritty wind Slash commands when

when you guys either move to a fork or implement them yourself. there's actually methods on the http object in dpy for slash commands, soooooo you don't actually need a fork.

gritty wind
#

Slash commands are actually really easy to write without a library

patent pivot
#

I can't run Arthur commands from my Apple Pencil

gritty wind
#

If weโ€™re not doing gateway stuff

fallen patrol
#

now I want to take the challenge

patent pivot
#

We'll do slash commands once they have good permissions

fallen patrol
#

everything exists in dpy 2.0 to have slash commands

gritty wind
#

Itโ€™s not a challenge, itโ€™s doable in 200 lines with a decent http library

patent pivot
#

KA will get slash commands fairly early

gritty wind
#

Voice activated Arthur commands when

#

AI too so I donโ€™t have to remember the exact thing

#

When can I just shout restart the mainframe and have it do something

patent pivot
fallen patrol
patent pivot
#

No

#

It's once we move to a fork and can hide commands

fallen patrol
#

that doesn't make the most sense to me

#

you can make some commands slash commands that never are intended to be hidden

#

before there's discord support to hide them

#

like /docs /pypi /tags /topic etc

patent pivot
#

All king Arthur commands are hidden

#

I'm talking specifically KA here

fallen patrol
#

I wasn't talking about ka specifically, but all the bots

#

ah

patent pivot
#

Lance might move before that

#

ยฏ_(ใƒ„)_/ยฏ

fallen patrol
#

yeah I haven't added any commands that require permissions to slash commands because discord

patent pivot
#

Apple Pencil is great I can write ยฏ_(ใƒ„)/ยฏ and it writes ยฏ_(ใƒ„)/ยฏ

dry folio
#

joe uses 3 shrugs in a row-

patent pivot
#

ยฏ_(ใƒ„)_/ยฏ

austere hornet
#

Lmao

fallen patrol
#

imagine not shrugging

fallen patrol
#

!e 5

stable mountainBOT
#

@fallen patrol :warning: Your eval job has completed with return code 0.

[No output]
fallen patrol
#

@patent pivot is this about to switch from @gritty wind's server back to pydis?

patent pivot
#

yes

fallen patrol
#

noice

patent pivot
#

once i like

#

switch it

#

lol

#

it hasn't deployed yet

fallen patrol
#

ah

#

oh

#

lol

#

is the self hosted runner ran by pydis?

patent pivot
#

yeah

fallen patrol
#

ah

patent pivot
#

it's on a deb 11 box we span up just for this

#

it means that all external contribs will need approval to run snekbox CI for all commits, but that isn't a major problem

fallen patrol
#

yeah

#

something went wrong somewhere: shouldn't really affect the outcome but

patent pivot
#

uhh I don't see it

fallen patrol
#

oh, wait until the run finishes then ๐Ÿ’€

#

github streaming logs doesn't show them retroactively until the run is done

patent pivot
#

yeah makes sense

fallen patrol
#

#19 3.419 WARNING: Ignoring invalid distribution -istlib (/root/.local/lib/python3.10/site-packages)

#

sometimes happens from a pip install

#

obviously meant distlib

patent pivot
#

it's just a warning

fallen patrol
#

but how'd it do that in the first place

patent pivot
#

lol

#

ยฏ_(ใƒ„)_/ยฏ

#

arthur deploy restart bot

radiant merlinBOT
#

:white_check_mark: Restarted deployment bot in namespace default.

patent pivot
#

!eval import platform; print(platform.uname())

stable mountainBOT
#

@patent pivot :white_check_mark: Your eval job has completed with return code 0.

uname_result(system='Linux', node='snekbox', release='5.10.0-9-cloud-amd64', version='#1 SMP Debian 5.10.70-1 (2021-09-30)', machine='x86_64')
patent pivot
#

okay we're back on pydis infra

vale ibex
#

In cluster?

#

Just a plain debian box?

patent pivot
#

we figured that the stuff with cgroups wasn't exactly a bug

vale ibex
#

Nice nice

#

Nah, just a happy accident

patent pivot
#

it was just a thing we had to handle

vale ibex
#

I'm guessing we'll go back in April?

patent pivot
#

what happens in april

fallen patrol
#

I mean

#

April is after March and before may soooo

#

you kinda have to be prepared ๐Ÿคก

vale ibex
#

I remember something happening in april

tawdry vapor
#

Only thing that comes to mind is new Ubuntu LTS coming out

vale ibex
#

Ahhh yea

tawdry vapor
#

But that's only relevant for CI

fallen patrol
vale ibex
#

No, what mark was saying

fallen patrol
#

ah

tawdry vapor
#

We might go back to a debian box if we can get gvisor working on it

gritty wind
#

I wonder if I can take down my domain from mobile

#

Bleh Iโ€™ll just leave it up

fallen patrol
#

๐Ÿ‘€

patent pivot
#

kubernetes 1.24 is released in april

fallen patrol
tawdry vapor
#

What's that update going to bring?

gritty wind
patent pivot
#

hmmmm, full deprecation of dockershim is targeting 1.24 I think

fallen patrol
#

yes, yes you can

#

so please don't ty

patent pivot
#

KEP 2221 schedules removal of Docker support in Kubernetes for 1.24 now

#

it was gonna be 1.23

#

but got pushed forward, so April 2022

fallen patrol
#

how does that affect snekbox and or pydis?

patent pivot
#

not much

#

scenario 1 is that Linode continue using an externally managed version of Dockershim and LKE clusters continue using Docker

fallen patrol
#

how does pydis use dockershim*

patent pivot
#

scenario 2 is that Linode pick a better container runtime like containerd or CRI-O, then I have to go through our manifests and change alpine to docker.io/alpine, lol, and that's about it

patent pivot
#

kubernetes doesn't work 100% with docker

#

so the kubernetes team wrote a tool called "Dockershim" which makes Kubernetes compatible with Docker runtime

#

but it's a big maintenance burden

#

and there are better runtimes approaching like containerd and CRI-O

#

that are built specifically for use in Kubernetes

#

whether we are on or off Kubernetes, we are looking at migrating away from Docker

#

there are much nicer container runtimes nowadays, if we're off Kubernetes there is https://podman.io/ which is absolutely fantastic

#

If we're on Kubernetes, probably containerd or CRI-O, which are good runtimes for kube

#

me and Volcyy are writing a paper on pydis devops

#

mayyyyyybe public we'll see

fallen patrol
#

so docker-compose for running the projects wouldn't exist anymore?

fallen patrol
#

so just what you use internally then

patent pivot
#

We're talking production here

fallen patrol
#

gotcha

patent pivot
#

Podman supports compose so we might advise you use that

clever wraith
#

Actually it isn't

patent pivot
#

But podman has full Docker compatibility

clever wraith
#

But it will be!

#

Hasn't k8s already dropped Docker runtime support?

patent pivot
#

You can alias Docker to it and it works

patent pivot
#

Kubernetes 1.24

clever wraith
#

Huh, I thought linode already switched to another runtime

patent pivot
#

However, Docker will be maintained by a third Party

#

So Linode may stay with Docker

gritty wind
#

Come to do, weโ€™re already running containered ๐Ÿ˜”

patent pivot
#

They have not confirmed anything yet

gritty wind
#

Do you actually need to change to docker repo in the image?

#

I think Iโ€™m running fine from just the pydis deployments, at least for snekbox lol

patent pivot
#

Podman can support it

gritty wind
#

Good

#

To know

patent pivot
#

Podman can also run kubernetes pod specifications which is so cool

#

it also runs as non-root

#

which is cool

vocal prairie
patent pivot
patent pivot
#

it's a drop in replacement that's getting a lot of community traction

vocal prairie
#

I've been hearing a lot about it, maybe I'll try it out

patent pivot
#

this is what I wrote about it

#

daemonless is pretty nice

fallen patrol
clever wraith
#

So would you yeet k8s for podman?

#

Or k8s will rely on podman as it's engine

patent pivot
# fallen patrol if it's drop in, why use it in place of docker? why does it exist if docker exis...

why use it in place of docker? docker makes a lot of decisions which are... decisions. it's just an alternate container runtime option, more details at https://podman.io/whatis.html. some of the great things about podman include that you can run things rootless containers and so on.

why does it exist? alternatives have to exist, it's what makes OSS software great. it exists because people didn't like how docker do specific things.

what doesn't work that works with docker? it's mostly 1-to-1, both docker and docker-compose will work with Podman socket. there are probably intricacies that are different but vast majority is 1-to-1.

#

it's important to remember that docker is a fairly thin layer, the majority of docker is in the build process and Dockerfiles and so on, the runtime just uses a lot of built-in Linux features

patent pivot
clever wraith
#

I see

fallen patrol
#

so

patent pivot
fallen patrol
#

if people didn't like how docker does specific things but podman is 1:1, isn't that counteractive?

clever wraith
#

Interesting

patent pivot
#

it's under the hood changes

#

the API is the same because Docker is so widely used that it's almost standard

#

Dockerfiles, all in all, are pretty great

#

but for runtime, Docker uses a daemon, Podman is daemonless, which is a huge difference

fallen patrol
#

er, what does that mean? ๐Ÿ˜…

clever wraith
#

Daemonless sounds very interesting

clever wraith
#

Which allows you to more easily deploy on demand and stuff like that

fallen patrol
#

but how would it work without one?

patent pivot
#

yeah, pretty much that

fallen patrol
#

more importantly, how does it work with one?

patent pivot
#

well, whenever you run a docker command, it is basically just an API call to the docker daemon

#

then that daemon builds/starts whatever you are working with

clever wraith
#

Through /var/docker.socket if I remember the path correctly

patent pivot
#

yeah something like that

#

podman still supports that, which is how docker-compose support works

#

but when you do podman run or whatever to start a container, instead of calling out to some API it interacts directly with runc

clever wraith
#

How is bookkeeping done?

#

Like what container maps to what PID

patent pivot
#

hahaha a very good question

clever wraith
#

I'm assuming some form of file storage?

patent pivot
#

mayyyybe, or maybe it can pull it back out of runc

clever wraith
#

Wouldn't that mean runc would run on a dameon then?

#

I guess it could list namespaces and all from the kernel

#

But I doubt every information can be taken back from the OS

patent pivot
#

don't think runc has a daemon nope

clever wraith
#

Yeah I'm pretty sure it doesn't

#

~/.local/share/containers/storage it seems like?

#

Or is that just the images

patent pivot
#

think that's just the storage

clever wraith
#

Someone just do strace -eopen podman run ... haha

fallen patrol
#

maybe when you start a container it starts a daemon or something?

clever wraith
#

Strace best friend for life

fallen patrol
#

or writes it to a file

patent pivot
#

it doesn't do daemons no, it just uses the containerisation tools that are built into the linux kernel

#

you'd be surprised how much of docker and containers are just linux features

fallen patrol
#

lol ;-;

patent pivot
#

Basically there are a few new Linux kernel features (โ€œnamespacesโ€ and โ€œcgroupsโ€) that let you isolate processes from each other. When you use those features, you call it โ€œcontainersโ€.

fallen patrol
#

enter docker desktop for windows

patent pivot
#

which spawns a linux vm, lol

clever wraith
#

Is that the "containers aren't a thing" blog post

patent pivot
#

uhhh maybe

#

but yeah more or less it just breaks containers into "containers are fancy processes"

#

which actually cleared things up a lot for me

clever wraith
#

Namespaces, cgroups and overlayfs basically makes up Docker

#

Or runc?

stable mountainBOT
#
Aye aye, cap'n!

Your reminder will arrive on <t:1640552840:F>!

patent pivot
#

unsure

#

oh maybe it is runc actually yeah

clever wraith
#

That one is a great read

clever wraith
patent pivot
#

hahahhaa yeah

clever wraith
#

You have CRIO, Moby, runc, docker, docker-compose

patent pivot
#

it is all part of why I like podman though, it makes things a bit clearer

clever wraith
#

It is such a confusing stack

patent pivot
#

podman interfaces directly with runc, and that's it

#

it uses a cool tool called Buildah when you build Dockerfiles (well, you rename them to Containerfiles, lol) https://buildah.io/

gritty wind
#

You know docker runs non-root :x

#

Itโ€™s in the troubleshooting guide of all places

clever wraith
#

Does it now

patent pivot
clever wraith
#

Pretty sure it needs sysadmin capabilities for all the cgroup actions it has to do

gritty wind
#

Wait what do you mean by root

patent pivot
#

root user

gritty wind
#

Like, root user to start the daemon or run commands

clever wraith
#

Well a sysadmin user

#

Who is usually root

gritty wind
#

Because if itโ€™s the latter, thatโ€™s what Iโ€™m referring to

patent pivot
#

run the daemon

clever wraith
#

To start the daemon

#

Yeah of course if you set your socket perms properly you can use the client without root

gritty wind
#

Right, nvm then

clever wraith
#

But I heard from security consultants that you shouldn't

patent pivot
#

oh cool, my podman isn't using runc

#

it uses crun, hahahaha, what great naming

#

crun works with cgroups v2

clever wraith
#

Was it not confusing enough for ya lmao

patent pivot
#

the hosted runner took like 4 mins to boot because it kept failing to pull the action

#

good to see our self-hosted runner going strong though lol

tawdry vapor
#

boom another reason to drop k8s ๐Ÿ˜Ž

patent pivot
#

lmfao

#

hmmm no status reports on github

tawdry vapor
#

I tried re-running and it's still failing on it

#

I guess I'll just try again in an hour or something

clever wraith
#

Do we self host now?

patent pivot
gritty wind
#

Nice

patent pivot
#

looks like there might be some generic networking problems on the hosted runners today, 13 KiB/s pull speed lmfao

patent pivot
gritty wind
#

Genuinely faster than my cellular rn ๐Ÿฅฒ

clever wraith
#

cool, that's smart

fallen patrol
clever wraith
#

@patent pivot is the runner set up on k8s and if yes are the manifest available somewhere?

patent pivot
#

it isn't nah

#

it's just on a debian 11 nanode we've spun up

#

install was fairly easy, just set up the runner & docker on that box

#

and it's good to go

clever wraith
#

Cool

#

Sorry, saying we instead of you out of habit

#

Would be nice to get more reviews on sir-lancebot#991

dusky shoreBOT
fallen patrol
obsidian patio
#

@static canyon heyo, just so you know, Iโ€™ve addressed your requested changes

static canyon
fallen patrol
#

what issue number was that again (I can't remember if my review comment got saved or not)

#

github was bugging out and didn't save a few comments I made on different issues so I'm not sure

static canyon
#

It'll be basically at the top

fallen patrol
#

I'm on mobile smh

#

sir-lancebot#988 def didn't scroll back to find it

dusky shoreBOT
fallen patrol
#

ah yeah & I couldn't check out the branch so I need to debug that

#

I really ended up with a detached head and a load of other goodies

static canyon
fallen patrol
#

ยฏ\_(ใƒ„)_/ยฏ

stable mountainBOT
#
Yep.

Your reminder will arrive on <t:1877201974:F>!

elder granite
static canyon
#

Edit duration

fallen patrol
#

!remind edit duration 3825 90M

stable mountainBOT
#
Of course!

That reminder has been edited successfully!

patent pivot
fallen patrol
#

(also if someone has some ideas as to why I kept getting invalid reference from the gh cli client, I'd love that)

austere hornet
#

I'm sorry if I'm annoying anyone by this, but sir-lancebot#901 has been up for a long time now and needs one more core dev review to get merged. Thanks!

dusky shoreBOT
stable mountainBOT
fallen patrol
#

that was a fast 40 minutes.

elder granite
#

The article is small and reads in less than 5 minutes hah

austere hornet
elder granite
#

And Joe how are you a first year student ? Did you start to code at 2 yo ?

patent pivot
#

So 10 years now

elder granite
#

impressive ๐ŸŽฉ

stable mountainBOT
clever wraith
#

I really ended up with a detached head

#

take that out of context

#

easy win

austere hornet
#

Lmao

trail pilot
#

Ahh I have some very small grammar nitpicks in the docstring for the AOC completer role but I don't know if I should post them given that they're the smallest nitpicks, and are probably unnecessary

clever wraith
#

haha, you can always approve and comment with a suggestion

#

as chris will squash the PR down anyway

trail pilot
#

Ahh

tawdry vapor
#

Do PRs only execute the workflows in the target branch, even if they've been changed in the source branch?

#

Oh never mind, it just errored out but the UI wasn't making it clear.

fallen patrol
#

github failing to load for anyone else?

fiery kernel
#

Hello

elder granite
austere hornet
tawdry vapor
clever wraith
#

That's an interesting problem. If no interpolation is done I can hardly think of a workaround.

#

pushing to a specific branch could be a quite janky solution

#

probably not worth doing at that point

fallen patrol
#

the whole issue?

tawdry vapor
#

Workaround for lack of interpolation support for the ref. I was looking at the JS actions to see if there's any way to execute a workflow from a YAML or something of that nature.

#

The only workaround for the whole issue that I know of is to use composite actions, but those suck because 1. it requires each action to be in a separate directory 2. actions cannot contain multiple jobs

gritty wind
#

Thereโ€™s something planned thatโ€™s somewhere between composite actions and normal actions (aka composite actions with jobs and what not), but that wonโ€™t happen for a while. Even then, itโ€™s only announced for enterprise, but I imagine itโ€™ll happen eventually

#

For now we just live with the duplication and dedup where we can (HassanAbouelela/actions was a start to that)

tawdry vapor
#

Makes me miss azure pipelines

fallen patrol
gritty wind
#

My GH

fallen patrol
#

and I wonder why I overuse the clown emoji ๐Ÿ˜ฉ

fallen patrol
#

help.

#

it works for every pull

#

except for this one

#

sir-lancebot#988

dusky shoreBOT
fallen patrol
#

wait it happens on other pulls now

#

something with git config perhaps?

#

yeah idfk what i did here

cold island
#

Can you checkout the usual git way?

fallen patrol
#

what is the usual git way?

vale ibex
#

git switch -c twemoji upstream/twemoji

#

Might need to git fetch upstream first

cold island
#

upstream is usually inferred, so just git pull && git checkout twemoji should work

fallen patrol
stable mountainBOT
#
Okay.

Your reminder will arrive on <t:1640716396:F>!

fallen patrol
#

what do you use for managing your dev todo? ๐Ÿคก

green oriole
#

it is inferred if the branch name is only present on one remote

cold island
fallen patrol
fallen patrol
#

what do you all use for managing what you need to do or something? like, what app or tool?

#

specifically talking like: fix up dev commit here, review that pull, finish an issue, etc

gritty wind
#

Jetbrains VCS integration >.>

green oriole
#

did lance just die lol

gritty wind
#

It probably oomed on something, could look into it later

green oriole
#

I was about to say, a devops should be able to pull that haha

#

then checked roles

gritty wind
#

I donโ€™t really have PC access this month :D

green oriole
#

Kubenav is a great app haha

austere hornet
vale ibex
#

I just use github notifications

dim pelican
#

OneNote for work, and for developing I just work slow enough to have 1 thing at a time

austere hornet
#

And yeah OneNote also works

vocal wolf
gritty wind
#

But internet is way too slow to reliably get anything

vocal wolf
green oriole
#

lol

vale ibex
#

Forcepush to the AoC branch was just a squash

green oriole
#

We all saw the token grabber you tried to push to that branch

vale ibex
#

It just emails me your dotenv on boot

green oriole
#

I mean if you want it I can mail it to you

#

Like literally mail it

#

But you pay the postage

#

Poking the poking lead, we've come full circle

vocal wolf
#

jokes on you I already poked myself heheheheheh

green oriole
#

nooooooo

fallen patrol
#

how is the message info calculated

#

its off by.... 20k messages

#

unless it doesn't include commands?

#

bot#2016

dusky shoreBOT
stable mountainBOT
fallen patrol
#

i timed that perfectly then

fallen patrol
summer garden
#

Do you guys fix style errors and write docstrings as you go, or do you do it all at the end?

fallen patrol
#

all commands:

fallen patrol
summer garden
#

I despise writing docstrings and commit messages. It's almost more work than the coding itself

dim pelican
#

Conversely; it is the most important stuff so that people like me can understand what a function or a commit does

fallen patrol
#

basically its not just you, its helpful for everyone

summer garden
#

HAHA you know what? It's because I have to decipher what my code does and then explain it in a concise and eloquent way so nobody else gets confused

vale ibex
#

Message count is used for voice verification, so we ignore both bot command channels

fallen patrol
#

so a bot command in a different channel is counted then

vale ibex
#

Yes

fallen patrol
cold island
#

Counting starts August 25th 2020

fallen patrol
#

I was here after then

#

and I only have about 2-3k messages in bot command channels so....

dim pelican
fallen patrol
#

oH yeah

#

is this Stat metricity

cold island
#

yes

fallen patrol
#

that's why it's wrong then

cold island
#

?

fallen patrol
#

I previously asked Joe to delete my metricity data ๐Ÿคก

cold island
#

ah

fallen patrol
cold island
#

Did the other approach work?

gritty wind
#

Git fetch?

fallen patrol
fallen patrol
gritty wind
#

Can you list remotes

fallen patrol
#

oh.

fallen patrol
gritty wind
#

Idk try checkout instead of switch /shrug

fallen patrol
#

this could be why....

#

the remote references aren't being saved, so its something with fetching

#

oh.

#

git config

#

remote.upstream.fetch=+refs/heads/main:refs/remotes/upstream/main

#

there. we. go.

fallen patrol
#

apparently github does this when you use gh repo clone

gritty wind
#

Why are you even using it?

fallen patrol
#

using what

gritty wind
#

GH

green oriole
#

That activity block count seems off

#

Pretty sure I had >30k blocks

#

You can look at my messages in mod-spam back when we were testing the lag

fallen patrol
vocal prairie
#

Seems like you're at 16k

green oriole
#

Really

#

Well, thanks for checking

gritty wind
#

The GH client not just GitHub lol

fallen patrol
gritty wind
#

Iโ€™m genuinely asking why you use it

#

Like what benefits does it give you over regular git

fallen patrol
#

ah

#

fwiw I use it in combination with regular git

#

but it has api, browse, actions, gist, issue, pull, etc commands

#

so gh api /repos/python-discord/bot to make an api request to their,
gh browse to open the repo in the browser
gh gist to make gists
gh issue view num to view an issue
gh pr checkout num to checkout a pull, etc etc

vocal prairie
#

I use the gh client since I'm too lazy to set up ssh and the auth is easy

fallen patrol
#

yeah pretty much

gritty wind
#

Most of these things are pre-integrated into my IDE, so Iโ€™ve gotten kinda complacent about the whole thing

#

My IDE has the benefit of doing most of the heavy lifting while I give it vague instructions

green oriole
#

I use it to check out PRs because I'm a lazy bastard

#

That is aaaallll

#

This isn't a self attributed lazy bastard title btw

fallen patrol
#

lmfao @vocal wolf

vocal wolf
#

Yes, I joined a server

fallen patrol
#

its more like

#

all of you at once

#

but also

#

I didn't know that bots could join servers with invites ๐Ÿคก

gritty wind
#

Our raid channel says otherwise

fallen patrol
#

yeah, saw it yesterday on stats.pydis

tawdry vapor
#

Looking for reviews on snekbox#132 and snekbox#136 - they're not too scary, I hope

fallen patrol
#

๐Ÿ’€ omg those are scary

austere hornet
#

Also sir-lancebot#901 needs a core dev review! Again, sorry if I'm being annoying about this but it's been up for a long time now. Thanks so much!

dusky shoreBOT
static canyon
#

Is anyone able to give some insight as to what these test errors mean?```py
FAILED tests/bot/exts/moderation/test_incidents.py::TestArchive::test_archive_clyde_username - AttributeError: 'NoneType' object has no attribute 'kwargs'

FAILED tests/bot/exts/moderation/test_incidents.py::TestArchive::test_archive_relays_incident - AssertionError: Expected 'send' to be called once. Called 0 times.

FAILED tests/bot/exts/moderation/test_incidents.py::TestProcessEvent::test_process_event_confirmation_task_is_awaited - AssertionError: Expected mock to have been awaited.

green oriole
#

No line number?

#

Because without one it would be hard to exactly know what happened, at least with the first one

#

The first one is the code didn't call send, and the second one ร  certain task never got awaited

static canyon
#

It says the test

#

Gimme a few mins, uploading what I've got at the moment to GitHub

#

Right, okay

#

@green oriole ```py
______________________________________________________________________________________ TestArchive.test_archive_clyde_username ______________________________________________________________________________________

self = <tests.bot.exts.moderation.test_incidents.TestArchive testMethod=test_archive_clyde_username>

async def test_archive_clyde_username(self):
    """
    The archive webhook username is cleansed using `sub_clyde`.

    Discord will reject any webhook with "clyde" in the username field, as it impersonates
    the official Clyde bot. Since we do not control what the username will be (the incident
    author name is used), we must ensure the name is cleansed, otherwise the relay may fail.

    This test assumes the username is passed as a kwarg. If this test fails, please review
    whether the passed argument is being retrieved correctly.
    """
    webhook = MockAsyncWebhook()
    self.cog_instance.bot.fetch_webhook = AsyncMock(return_value=webhook)

    message_from_clyde = MockMessage(author=MockUser(name="clyde the great"))
    await self.cog_instance.archive(message_from_clyde, MagicMock(incidents.Signal), MockMember())
  self.assertNotIn("clyde", webhook.send.call_args.kwargs["username"])

E AttributeError: 'NoneType' object has no attribute 'kwargs'

tests\bot\exts\moderation\test_incidents.py:439: AttributeError
============================================================================================== short test summary info ==============================================================================================
FAILED tests/bot/exts/moderation/test_incidents.py::TestArchive::test_archive_clyde_username - AttributeError: 'NoneType' object has no attribute 'kwargs'

#

It's the webhook.send.call_args.kwargs["username"] giving the attribute error

#

But I didn't change that and it worked before my commits

green oriole
#

Hmm

#

Try a poetry install?

static canyon
#

hmm

#

Let's see

static canyon
# green oriole Try a `poetry install`?

It updated two libraries:```c
(bot-6mLjCNeK-py3.9) C:\Users\tizzy\bot>poetry install
Installing dependencies from lock file

Package operations: 0 installs, 2 updates, 0 removals

โ€ข Updating pycares (4.0.0 -> 4.1.2)
โ€ข Updating rapidfuzz (1.7.1 -> 1.8.0)

Installing the current project: bot (1.0.0)

green oriole
#

Interesting

#

Is your branch up to date with main?

static canyon
#

Not the current main

#

It's like a monthish behind

green oriole
#

Hmm, could you try to merge? (fetch and merge origin/main)

static canyon
#

That worked, no conflicts

green oriole
#

What about the tests

static canyon
#

But test still fails

#

Exact same error

green oriole
#

How weird

#

What files did you change

static canyon
#

bot/exts/moderation/incidents.py iirc

green oriole
#

Wait, so your code probably broke it then haha

static canyon
#

But like, I don't get how

#

I've not changed any of the core functionality

green oriole
#

Can I get a diff?

static canyon
#

It's the exact same just the archive message has more info

static canyon
#

If you run tests you'll also get once saying the embed.description doesn't match but that's just because I forgot to remove the on in the test so that test can be ignored (have resolved locally)

green oriole
#

Okay

#

One of the problem is the mock user doesn't have display_name working properly, I'm pretty sure

vale ibex
#
- message_from_clyde = MockMessage(author=MockUser(name="clyde the great"))
+ message_from_clyde = MockMessage(author=MockUser(display_name="clyde the great"))
green oriole
#

Basically this

static canyon
#

Right, lemme try

#

Yep, that fixed it lol

#

Thanks

#

Now the other 2 tests

green oriole
#

All three?

#

Sadge

#

Thanks for the role Chris

#

If that was you

#

Oh BTW you shouldn't be using now in your test

static canyon
#

2nd test I'm looking at might be the same thing

green oriole
#

They should be deterministic

static canyon
static canyon
austere hornet
dusky shoreBOT
static canyon
#
_________________________________________________________________________ TestProcessEvent.test_process_event_confirmation_task_is_awaited __________________________________________________________________________

self = <tests.bot.exts.moderation.test_incidents.TestProcessEvent testMethod=test_process_event_confirmation_task_is_awaited>

    async def test_process_event_confirmation_task_is_awaited(self):
        """Task given by `Incidents.make_confirmation_task` is awaited before method exits."""
        mock_task = AsyncMock()

        with patch("bot.exts.moderation.incidents.Incidents.make_confirmation_task", mock_task):
            await self.cog_instance.process_event(
                reaction=incidents.Signal.ACTIONED.value,
                incident=MockMessage(id=123),
                member=MockMember(roles=[MockRole(id=1)])
            )

>       mock_task.assert_awaited()

tests\bot\exts\moderation\test_incidents.py:543:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <AsyncMock id='1744593019040'>

    def assert_awaited(self):
        """
        Assert that the mock was awaited at least once.
        """
        if self.await_count == 0:
            msg = f"Expected {self._mock_name or 'mock'} to have been awaited."
>           raise AssertionError(msg)
E           AssertionError: Expected mock to have been awaited.

..\AppData\Local\Programs\Python\Python39\lib\unittest\mock.py:2188: AssertionError
========================================================================================= short test summary info =========================================================================================
FAILED tests/bot/exts/moderation/test_incidents.py::TestProcessEvent::test_process_event_confirmation_task_is_awaited - AssertionError: Expected mock to have been awaited.
#

Last one @green oriole

red grotto
#

that looks weird

static canyon
#

name isn't passed here in the MockMember but do I need to add display_name still?

static canyon
static canyon
green oriole
#

I'm guessing on a traceback

#

Currently playing domino with my grandma so gl

static canyon
vale ibex
#

Is there a traceback further up in the output?

static canyon
#

Nope

static canyon
vale ibex
#

can you do poetry run task retest and put the full output into a paste

static canyon
#

yep

vale ibex
#

alright, lemme pull you changes and take a look

static canyon
vale ibex
#

Yea, I'm just gonna pull the branch

static canyon
#

๐Ÿ‘

vale ibex
#

What was your diff to fix test_make_embed_content

static canyon
vale ibex
#

๐Ÿ‘

static canyon
#
        self.assertEqual(
            f"{incident.content}\n\n__*Reported {day_timestamp} at {time_timestamp} ({relative_timestamp}).*__",
            embed.description
        )
```works
vale ibex
#

Alright, the problem is the same

#

it's because display_name isn't set

#

MockMember by default has it's name attribute set, but not display_name

#

see tests.helpers.MockMember

static canyon
#

I tried specifying display_name but it didn't fix it

vale ibex
#

it's because Incidents.archive uses incident.author.display_name

#

which comes from the message that get's passed

#

not the member

static canyon
#

Ah right

vale ibex
#

MockMessage uses MockMember for the author

#

which only has member