Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Claudius Link
Claudius Link
@realn2s@infosec.exchange  路  activity timestamp 2 weeks ago

#Cursor generate roughly 1k lines of Python.
This included the (pseudo) code for querying #Bookwyrm. I would have preferred to generate this later (as a second step) But maybe it my mistake. I was prompting it wrong. I shouldn't have mentioned anything I didn't directly want.

Without looking at the Bookwyrm client code in detail, I doubt that it will work as my instance ( @realn2s@bookwyrm.social) require #2fa 馃し馃徎

Checking the HumbleBundle client code I noticed several things

It contained a ton of normalization code. Of which I'm not sure if it is necessary (it might as well be, but I would leave it out for now. As it much harder to figure out that code isn't required but get executed nevertheless, than noticing that code is missing)

The authentication was done through a session cookie you had to extract form the browser. Cursor proposed to write it to an env file (that doesn't feel terrible secure 馃槵)

The Humble bundle client could either get the session cookie passed, or it would query the env 馃槵. I don't consider this good programming practice.

The code looks like it handles HumbleBundle games as well. This was requested and is additional code which shouldn't be there.

Reading through the code it looked about right. But it was too mich code, too much gold plating for me to be confident that the code really would be working.

Cursor provided no way to test the code apart from running it. And I'm not going to run it with my understanding.

On the positive side
I learned about the Click command line option "parsing" library

and about the dataclass decorator in #Python

Next step, let's try if Cursor can iteratively fixe some of my "issues"

2/n

  • Copy link
  • Flag this post
  • Block
Claudius Link
Claudius Link
@realn2s@infosec.exchange replied  路  activity timestamp 2 weeks ago

#Cursor generate roughly 1k lines of Python.
This included the (pseudo) code for querying #Bookwyrm. I would have preferred to generate this later (as a second step) But maybe it my mistake. I was prompting it wrong. I shouldn't have mentioned anything I didn't directly want.

Without looking at the Bookwyrm client code in detail, I doubt that it will work as my instance ( @realn2s@bookwyrm.social) require #2fa 馃し馃徎

Checking the HumbleBundle client code I noticed several things

It contained a ton of normalization code. Of which I'm not sure if it is necessary (it might as well be, but I would leave it out for now. As it much harder to figure out that code isn't required but get executed nevertheless, than noticing that code is missing)

The authentication was done through a session cookie you had to extract form the browser. Cursor proposed to write it to an env file (that doesn't feel terrible secure 馃槵)

The Humble bundle client could either get the session cookie passed, or it would query the env 馃槵. I don't consider this good programming practice.

The code looks like it handles HumbleBundle games as well. This was requested and is additional code which shouldn't be there.

Reading through the code it looked about right. But it was too mich code, too much gold plating for me to be confident that the code really would be working.

Cursor provided no way to test the code apart from running it. And I'm not going to run it with my understanding.

On the positive side
I learned about the Click command line option "parsing" library

and about the dataclass decorator in #Python

Next step, let's try if Cursor can iteratively fixe some of my "issues"

2/n

  • Copy link
  • Flag this comment
  • Block
Claudius Link
Claudius Link
@realn2s@infosec.exchange replied  路  activity timestamp 2 weeks ago

@realn2s@bookwyrm.social

@realn2s@bookwyrm.social

The #Cursor prompt:

Remove the Bookwyrm code for now

removed nearly 300 lines of code and touched every file 馃槺

Removing "unnecessary" only deleted 6 lines (so the problem maybe wasn't as bad as I initially thought)

Remove all "game" related code surprisingly added on LOC, a comment.
But funny enough it made the code far clearer to understand. Where previously "gamekeys" were used now it was "order_keys". Additionally, the comment that the get_gamekeys() method returns all order keys was added (not sure if this is true)

Sidenote: Switching the variable naming to suddenly use an '_' is a bit strange.

OK let's try one more thing before wrapping up this experiment and start over with smaller steps.

Let's try to add UnitTests!

3/n

#VibeCoding

  • Copy link
  • Flag this comment
  • Block
Claudius Link
Claudius Link
@realn2s@infosec.exchange replied  路  activity timestamp 2 weeks ago

@realn2s@bookwyrm.social

I asked #Cursor to generate unit tests for the project.
The result? Does it spark joy (or confidence)?
馃槵

Again, not really 馃槙

Nope, that is not a good unit test. This test check the setting of an internal property. This should actually be an implementation detail.

Screenshot of an unit test, basically testing the setting of an internal property
Whole code:

 def test_init_with_cookie(self):
        """Test initialization with session cookie."""
        client = HumbleBundleClient(session_cookie="test_cookie")
        assert client.session_cookie == "test_cookie"
        assert client.session is not None
Screenshot of an unit test, basically testing the setting of an internal property Whole code: def test_init_with_cookie(self): """Test initialization with session cookie.""" client = HumbleBundleClient(session_cookie="test_cookie") assert client.session_cookie == "test_cookie" assert client.session is not None
Screenshot of an unit test, basically testing the setting of an internal property Whole code: def test_init_with_cookie(self): """Test initialization with session cookie.""" client = HumbleBundleClient(session_cookie="test_cookie") assert client.session_cookie == "test_cookie" assert client.session is not None
  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About 路 Code of conduct 路 Privacy 路 Users 路 Instances
Bonfire social 路 1.0.1-alpha.40 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct