Skip to content
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

Completely Refactoer #120

Closed
wants to merge 105 commits into from
Closed

Completely Refactoer #120

wants to merge 105 commits into from

Conversation

TTWNO
Copy link
Member

@TTWNO TTWNO commented Jun 18, 2023

  • Make odilia-common comparable on any architecture with std.
  • Add checks for wasm32-wasi and wasm32-unknown-unknown compilation of odilia-common.
  • Move atspi-client logic back into Odilia via more internal cache traits. This can be re-exported later, but the whole AccessibleExt system has to go, it doesn't work with this new architecture very well.
  • Purify most odilia/src/events/* functions to (Try)From<$atspi_event> for Vec<OdiliaEvent>.
  • For the ones that can not, fill in a trait that accomplishes the following for the type:
  • 1. Allows the ${event}FunctionParams structure to be created from ($event, &state).
  • 2. Allow (Try)From<${event}FunctionParams for Vec<OdiliaEvent>.
  • 3. Tests all existing cases extensively.
  • Since state is made up of many smaller pieces of state, create a trait that can convert an &State into a collection of state-pieces necessary to complete the application of a single OdiliaEvent. The resulting code should look similar to: <$odilia_evnet>::get_state_pieces(&State) -> ${odilia_event}States; then $[odilia_event}State.apply_changes(). Only within apply_changes should there by mutable access to any part of the state. Before this, you may use Arc<T>, RwLock<T>, or T if it is thread-safe.
  • Tests the modification of state via changes given in the form of Vec<OdiliaEvent>. Test for all major events. No need for 100%.
  • Add a CI test for benchmarking (just to make sure the benchmarks still compile when changes are made).

This basically sets the stage for the plugin system.
Now, state is stored entirely separate to the types, and can be queried through provided functions like query_parent(Accessible) -> Accessible which will be implemented as guest-available functions once the plugin system is ready.

Note: this PR DOES NOT implement any kind of plugin system, it merely sets everything up to be easy to test the core, and easy to integrate pre-* and post-* hooks on each major category of event.

Although I'll be taking suggestions, I will not be doing a formal code review because there simply are not the available man hours for that. The new testing should suffice as proof of sound reasoning.

@codecov
Copy link

codecov bot commented Jun 18, 2023

Codecov Report

Attention: Patch coverage is 58.41727% with 289 lines in your changes are missing coverage. Please review.

Project coverage is 42.36%. Comparing base (cf57b7e) to head (b97991d).
Report is 2 commits behind head on main.

❗ Current head b97991d differs from pull request most recent head cf8a0a2. Consider uploading reports for the commit cf8a0a2 to get more accurate results

Files Patch % Lines
cache/src/lib.rs 21.50% 73 Missing ⚠️
common/src/cache.rs 2.22% 44 Missing ⚠️
odilia/src/events/objects/text_changed.rs 87.76% 23 Missing ⚠️
cache/src/cache_ref.rs 34.48% 19 Missing ⚠️
odilia/src/events/objects/children_changed.rs 86.56% 18 Missing ⚠️
common/src/errors.rs 10.52% 17 Missing ⚠️
odilia/src/events/cache/add_accessible.rs 0.00% 14 Missing ⚠️
odilia/src/events/cache/remove_accessible.rs 0.00% 14 Missing ⚠️
odilia/src/events/objects/text_caret_moved.rs 0.00% 14 Missing ⚠️
odilia/src/events/objects/state_changed.rs 83.11% 13 Missing ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #120       +/-   ##
===========================================
+ Coverage   14.15%   42.36%   +28.20%     
===========================================
  Files          16       22        +6     
  Lines        1533     1100      -433     
===========================================
+ Hits          217      466      +249     
+ Misses       1316      634      -682     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

TTWNO added 14 commits June 18, 2023 04:06
1. Use type aliases to define state field types (for use outside the state module).
2. std::sync::Mutex -> parking_lot::RwLock (parking lot and rw lock are more efficient)
…can not be poisoned; impl Debug on the Operation type
These are conceptually separated by being direct *internal* events that modify Odilia's state.
As opposed to events, which are generally recieved from the outside.

Also adds a few more Defualt implementations.
@francipvb
Copy link

Hello,

Currently I've started to work on the project. What kind of refactors you are doing at this time?

Thank you.

@TTWNO TTWNO linked an issue Feb 29, 2024 that may be closed by this pull request
@TTWNO TTWNO closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants