When the Documentation and the Code Don't Agree

Happy Sunday, everyone.

Today's post is a bit of a story and a ramble about a development journey I went on this morning. I've been working on a new tool to help manage the settings for Hive communities, and it sent me down a rabbit hole trying to understand how community accounts are actually created.


The Community Settings Manager

First, here's a sneak peek at the tool I'm building. The goal is to create a simple interface for community owners and moderators to update properties like the title, description, and rules. It's still a work in progress, but it should be ready soon-ish.

community_manager.png

While building this, I wanted to understand the process for creating a community. I knew the account names were hive-XXXXXX, but I wasn't sure how the numbers were generated or if there was a specific protocol to follow.


Down the Rabbit Hole

So, I started by reading the official documentation, which says:

Communities are registered by creating an on-chain account which conforms to /^hive-[1-3]\d{4,6}$/, with the first digit signifying the type.

The documentation goes on to explain the different types:

  • Topics (type 1): Anyone can post.
  • Journals (type 2): Only members can post, but anyone can comment.
  • Councils (type 3): Only members can post and comment.

I never knew "Journals" and "Councils" were even a thing! This seemed like a cool feature to support.

My next question was: how are the numbers in the account name generated? I initially started digging through the condenser (hive.blog) source code, but after a while, I got tired of searching. So, I turned to my new favorite tool, DeepWiki, and had it ingest the condenser and wallet repositories.

deepwiki.png

After my coffee, I finally had some answers. DeepWiki analyzed the wallet source code and told me this:

No Collision Detection: The system does not check if the account already exists before attempting creation. It simply generates a random number and hopes it's not taken, as you suspected.

Oof. But it gets more interesting:

The current implementation doesn't match the documented regex pattern... The actual code only generates numbers in the 100000-199999 range (effectively type "1" communities), and doesn't implement the type system or the full range mentioned in the documentation.

So, it seems the functionality for creating "Journals" and "Councils" might not even be implemented, despite being in the documentation. I'd rather know this now than build options into my tool that aren't really options.

The investigation continues!

As always,
Michael Garcia a.k.a. TheCrazyGM

1.52989245 BEE
7 comments

While I rarely comment these days, @thecrazygm, I do often at least glance through your work and, in this case, read your post word for word.

Wny this one?

I used to support my family programming. Making no claim to being at your level, I am nonetheless aware of what your title brought back to my mind:

Paperwork!?
🙄😒

Oh man!  I don't have
TIME  for that right now ...


You may be different, but updating documentation was always literally the lowest priority I had. Simple reasoning was involved.  I already knew what the code was supposed to be doing!  The end users?  Well ...  They worked for me, so ... 😉

Thankfully I ended my career with a full-time aide who was enormously helpful in staying right with me in keeping all that "complete, current, and accurate" (my old mantra).

🫡 🤝 👋

0.00599063 BEE

Hahaha. It works on my machine!

0.00317025 BEE

Do you think the documentation is wrong or the interface isn't up to date with all the options?

!PAKX
!PIMP
!PIZZA

0.00507648 BEE

View or trade PAKX tokens.

@ecoinstant, PAKX has voted the post by @thecrazygm. (1/2 calls)



Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.

0.00017677 BEE

I'm guessing the options are supported by the chain, probably just took the easy way on the account creation. I'm not sure if peakd has the options either. But I guess there is really only one way to find out.

Let's break stuff! ⚠️🔥

0.00331837 BEE

ive come to learn documentation of Hive is pretty lacking... but hey, I'm also aware of the monumental task it is to clean it up.

This, as steevec said, is probably the best use of AI we could come up with.

0.00339607 BEE

Didn't know too there was more options, but I see where this comes from... and 2 and 3 were probably WIP or long term ideas. Which if you think a bit about it, it would be hard because the way it would work would not be able to prevent the "meaning" of it to be hardcoded anytime by someone, so I guess it was a DOA idea, hence why it probably never continued.

0.00020028 BEE

Congratulations @thecrazygm! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You have been a buzzy bee and published a post every day of the week.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

0.00019627 BEE

First of all, this is s tool that I'm very much looking forward to trying out, as I help manage a community, and secondly, I've seen that so often, where there is a notable difference between the software and its documentation. Documentation almost always lags behind the actual development. The example that you gave is reverse, of course, which is rather interesting in itself. 😁🙏💚✨🤙

0.00019237 BEE

PIZZA!

$PIZZA slices delivered:
@ecoinstant(1/20) tipped @thecrazygm

Come get MOONed!

0.00017324 BEE