Skip to content

Conversation

@kaichaosun
Copy link
Contributor

No description provided.

@kaichaosun kaichaosun requested review from jazzz and osmaczko January 31, 2026 01:17
Copy link
Collaborator

@jazzz jazzz left a comment

Choose a reason for hiding this comment

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

I'm not against adding Just to make working with the repository easier to work with - especially as more complex tasks are added.

However this usecase seems unneeded. Examples exist to allow developers to see how to use the library and act as a starting point for exploration. Running all of them often seems counter productive.

Is there a reason I am missing?

Comment on lines +9 to +13
run-examples:
cargo run --example double_ratchet_basic
cargo run --example serialization_demo
cargo run --example storage_demo
cargo run --example out_of_order_demo
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some of these examples are hidden behind feature flags. If we want people to be able to run examples easily then it would make sense to remove the storage feature as it doesn't seem that optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The storage feature has been removed in this PR: #30, please review this PR too when you see fit.

cargo test

# Run all examples
run-examples:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this actually valuable? How often does someone want to run all the examples at once?

This seems like it is trying to perform the same job as integration tests.

Copy link
Contributor Author

@kaichaosun kaichaosun Feb 1, 2026

Choose a reason for hiding this comment

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

Yep, I run this command for the PRs I made after this change, before I was running such demos one by one, and easily forgot one and introduce bug.

In my previous experience, I see a lot of failing demos or even no demos in some of logos messaging repos, I want to avoid such scenarios happened in libchat.

Copy link
Collaborator

@jazzz jazzz Feb 2, 2026

Choose a reason for hiding this comment

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

Agreed.

However if the goal is to ensure that demo code isn't broken, then it should be ensured via CI and tests.

Add tests that ensure specific behaviour you are looking for and then add cargo test --examples to ensure they meet the expected results.

Simply executing the examples doesn't ensure they are operating correctly.

Copy link
Contributor Author

@kaichaosun kaichaosun Feb 3, 2026

Choose a reason for hiding this comment

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

Yes, CI will be added later.
Tests is not clearly show the workflow like demos, that's why most rust libraries contains examples directory, which is good in may ways.
Running examples ensures it successful, without such helper, it will be hard to check all the examples easily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also updated the readme to indicate just is not mandatory, and using Cargo as an option to get started.

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