Skip to content

Fix public facing #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2024
Merged

Fix public facing #4

merged 5 commits into from
May 6, 2024

Conversation

herzogp
Copy link
Contributor

@herzogp herzogp commented May 3, 2024

[X] setup_complete - make a struct for the data, and then json-ify it here

[X] Same for sdk_info function in internal

[X] LibHandler::output feels wrong to me. It feels like it should either take a string (&str) or it should take an object that is Serializable and do the serialization itself. With appropriate adjustments to callers. Or possibly the subclasses should implement the &str version and the trait should have the method that deals with &Value and with Serializable types

Serializeable is actually serde::Serialize: https://docs.rs/serde/latest/serde/trait.Serialize.html

[X] For LocalHandler, would it make more sense to have a true local handler and a no-op handler, and have the new return the appropriate one?

no change in end-user behavior, just a difference in how we implement. So instead of having a class with ifs for the no-op and op cases, we make that two different classes and use the common trait/interface. Then new becomes more like a factory method.

[X] assert/mod.rs - line 32 has a debug println!

[X] In CatalogInfo and AssertionInfo, why is assert_type a &str and a String? Why not an AssertType? (prefer the typed version)

[X] Make typed classes for location and antithesis_assert. Use Serde to serialize where needed.

[X] In assert_helper, maybe add some comments about what some of the top-level things are doing. For example, are we putting the whole thing in {}? Mention that? And the NAME and FUN_NAME - give an example of what those outputs look like; that kind of thing.

[X] How did you solve the unreachable namespace collision?
Using these macro names: assert_always! assert_sometimes! assert_always_or_unreachable!, assert_reachable!, assert_unreachable!

[X] Is there a place I can see the rendered rust docs?
afaik the docs are not public yet. For now, checkout the 'main' branch of the repo on a system that has cargo available, and use cargo doc --open

[X] I would tend to make AssertionInfo not clone arguments in new, but rather take arguments by ownership. Then callers could clone or not clone depending on their needs. The idea would be that if someone has a string they don't need any more, they can just pass it in and we won't need to do an unnecessary clone (String -> &str -> String).

herzogp added 3 commits May 3, 2024 10:29
- Defined structs for use by setup_complete and sdk_info to simplify
the implementation and better document what these JSON messages
actually contain.

- Defined structs for location and antithesis_assert to simplify
the implementation and better document what these JSON messages
actually contain.

- Update LibHandler::output to accept (message &str) which is
intended to be JSON formatted UTF-8 text.

- General source cleanup and removal of debug/trace print statements

- Use AssertType directly rather than represent it as a text string

- Add comments to the assert_helper macro to clarify its implmentation

- Improve the interface to the assert_raw() function so that
ownership of its parameters will be transferred to assert_raw().
The exception is the `details` parameter which is always passed
by borrowed reference.
@herzogp herzogp requested a review from wsx-antithesis May 3, 2024 20:25
@herzogp herzogp merged commit b6ae489 into main May 6, 2024
1 check passed
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.

2 participants