Skip to content

Add codebase.md#87

Closed
candour wants to merge 2 commits into
fluffle:masterfrom
candour:master
Closed

Add codebase.md#87
candour wants to merge 2 commits into
fluffle:masterfrom
candour:master

Conversation

@candour
Copy link
Copy Markdown
Contributor

@candour candour commented Feb 27, 2026

Describes the code base


This change is Reviewable

google-labs-jules Bot and others added 2 commits February 27, 2026 02:57
This commit introduces codebase.md, a comprehensive developer guide
tailored for both human contributors and AI agents. It details the
bot's driver-based architecture, the database abstraction layer (and
the 'long slog' migration from MongoDB to BoltDB), and provides
guidance on creating new features and testing handlers.

The documentation maintains a 'funny but accurate' tone as requested,
incorporating project history and the collective disdain for MongoDB.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
…779322245

Add codebase.md developer documentation
@gundalow
Copy link
Copy Markdown
Collaborator

Bots and humans won't read https://github.com/fluffle/sp0rkle/wiki so should that be copied into here (or maybe docs/directory?

Should this he named AGENTS.md?

Comment thread codebase.md

## 5. Pro-Tips and Pitfalls

- **The Global `bot`**: The `bot` package uses a global singleton. It's not "modern Go," but it works. Just be careful with state.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggestions, define how to be careful. What false assumptions might humans & AI have if they are used to more modern Go

Comment thread codebase.md

- **The Global `bot`**: The `bot` package uses a global singleton. It's not "modern Go," but it works. Just be careful with state.
- **Data Loss (The Mongo Curse)**: We hate MongoDB. That's why we're migrating. If you find a data mismatch between Mongo and Bolt, the `db.Both` layer will log a warning. Listen to it.
- **Regex is Your Friend (and Enemy)**: Much of sp0rkle's parsing relies on regex. Use `util/lexer.go` if you want to parse complex strings without descending into madness.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ensure unit tests are added for positive, negative and edge cases.

Comment thread codebase.md
Comment thread codebase.md
- **The Global `bot`**: The `bot` package uses a global singleton. It's not "modern Go," but it works. Just be careful with state.
- **Data Loss (The Mongo Curse)**: We hate MongoDB. That's why we're migrating. If you find a data mismatch between Mongo and Bolt, the `db.Both` layer will log a warning. Listen to it.
- **Regex is Your Friend (and Enemy)**: Much of sp0rkle's parsing relies on regex. Use `util/lexer.go` if you want to parse complex strings without descending into madness.
- **Pollers**: If your feature needs to do something periodically (like checking an RSS feed), use `bot.Poll(myPoller)`.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Pollers are shit, architecturally. They need to be completely decoupled from the connection lifecycle so they can be stopped and started arbitrarily. Also I think I got the API wrong. Needs some thought.

I wouldn't recommend using them in their current state even if they do just about solve the "recurring event" problem.

Comment thread codebase.md
1. Install Go and MongoDB (if you must).
2. Run `go build` in the root.
3. Run the bot: `./sp0rkle --servers irc.yournet.org --nick mybot --channels "#test"`.
4. If you need a database backup, see `backup.sh`. If you lose your data because you didn't have a backup... well, that's the sp0rkle way.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

well, that's the sp0rkle way.

sick burn

sp0rkle has not lost data in >20 years now :-)

Copy link
Copy Markdown
Owner

@fluffle fluffle left a comment

Choose a reason for hiding this comment

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

It's been too long for me to actually have proper context any more, but thanks for sending this :-)

Copy link
Copy Markdown
Collaborator

@gundalow gundalow left a comment

Choose a reason for hiding this comment

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

I think we merge this, then post #90 (which adds AGENTS.md) I'll move it to docs/.

Is codebase.md a new standard filename, I've not seen it before.

@fluffle
Copy link
Copy Markdown
Owner

fluffle commented Mar 2, 2026

Traditionally when reviews happen and comments are made the author goes back to the PR and addresses the comments before it's merged. Call me old-fashioned but I think that's still a valid thing to expect. I don't know how we make Jules do that -- perhaps I needed to "request changes" rather than just snarking -- but you had some valid requests and I think they were worth getting the AI to expend some more tokens on.

@fluffle
Copy link
Copy Markdown
Owner

fluffle commented Mar 2, 2026

Let's try:

@google-labs-jules please address @gundalow's requests to add additional suggestions on unit testing and "how to be careful".

@gundalow
Copy link
Copy Markdown
Collaborator

gundalow commented Mar 2, 2026

Traditionally when reviews happen and comments are made the author goes back to the PR a

Oh, I meant after this is merged. ie resolve all the above comments before merging.

I don't know how we make Jules do that
I think @candour needs to tell the bot to address all the review comments

@candour
Copy link
Copy Markdown
Contributor Author

candour commented Apr 13, 2026

@google-labs-jules please address @gundalow's requests to add additional suggestions on unit testing and "how to be careful".

@candour
Copy link
Copy Markdown
Contributor Author

candour commented Apr 13, 2026

@jules please respond to the PR comments

candour added a commit to candour/sp0rkle that referenced this pull request Apr 13, 2026
…GENTS.md

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@candour candour closed this May 4, 2026
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.

3 participants