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

Fixes DISCO-2470: Implement the foundation of a Firefox Suggest component #5723

Merged
merged 33 commits into from Jul 21, 2023

Commits on Jul 20, 2023

  1. Initial scaffolding for a Suggest component.

    This commit adds a new component to fetch search suggestions from
    Remote Settings and store them in an SQLite database.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    19a06ea View commit details
    Browse the repository at this point in the history
  2. suggest: Open database connections lazily.

    Before, creating a provider would block the calling thread until the
    database was set up. Now, migrations will run the first time the
    database is accessed, which we already expect to happen on a background
    thread.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    643cae3 View commit details
    Browse the repository at this point in the history
  3. suggest: Build config changes for Kotlin UniFFI bindings.

    This commit adds an empty UniFFI interface for the new Suggest
    component.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    a564ef3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5b65098 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e9dfbe4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a57579a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    591b789 View commit details
    Browse the repository at this point in the history
  8. suggest: Fix Clippy lints.

    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    32fe892 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7faef03 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5506349 View commit details
    Browse the repository at this point in the history
  11. suggest: Rename SuggestionProvider to SuggestStore.

    In other uses, "provider" refers to the source of a suggestion, like
    adM, Wikipedia, AMO, etc. Since `SuggestionProvider` aggregates
    suggestions from all these sources, calling it a "provider" could be
    confusing, especially if we support filtering suggestions from specific
    sources in the future.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    f406f10 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5badadc View commit details
    Browse the repository at this point in the history
  13. suggest: Replace the SuggestionQuery builder with a dictionary.

    The Gecko JS UniFFI bindings don't support synchronous function calls
    yet (https://bugzilla.mozilla.org/show_bug.cgi?id=1842433), so the
    builder API will be a little awkward to use on Desktop.
    
    This commit replaces the builder with a dictionary, with default
    fields to make it more ergonomic.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    061a9ac View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    11352c1 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    d816056 View commit details
    Browse the repository at this point in the history
  16. suggest: Refactor full_keyword.

    This commit adds documentation and tests for `full_keyword`, and
    reimplements it using the Rust iterator methods.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    d964697 View commit details
    Browse the repository at this point in the history
  17. suggest: Support clearing the suggestions store.

    This commit exposes `SuggestDb.clear()` as `SuggestStore.clear()`, and
    ensures that it removes all icons in addition to suggestions and
    metadata.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    43248d6 View commit details
    Browse the repository at this point in the history
  18. suggest: Clarify internal vs. public interfaces.

    This commit changes the visibility of crate-internal types and methods
    from `pub` to `pub(crate)`, and clarifies the difference between the two
    error types:
    
    * `SuggestApiError` is the public error type, for all errors that should
      be handled by the application.
    * `Error` is the internal error type, used in the implementation of the
      component, and is not part of the public interface.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    f99aca0 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    cdc3971 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    c4a4a96 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    54d8a08 View commit details
    Browse the repository at this point in the history
  22. suggest: Refactor database transaction management.

    This commit makes it possible to combine multiple database accesses
    into a single transaction. Previously, each `SuggestDb` method would
    lock the database connection, and optionally run its own transaction
    before releasing the lock. This meant that a single logical operation,
    like ingesting all suggestions from an attachment, would involve
    multiple transactions.
    
    This commit moves the database accesses into a new `SuggestDao` type,
    which takes a reference to an existing locked connection. The new
    `SuggestDb::{read, write}` methods handle locking and transaction
    management, and take a closure that receives a `SuggestDao` for reading
    and writing.
    
    Co-authored-by: Tif Tran <ttran@mozilla.com>
    linabutler and tiftran committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    b25c815 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    b372e9f View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    959ac2c View commit details
    Browse the repository at this point in the history
  25. suggest: Open SQLite connections with SQLITE_OPEN_NO_MUTEX.

    `SuggestDb` already protects the connection with a Rust mutex, so
    SQLite's per-connection mutex is unnecessary.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    548e941 View commit details
    Browse the repository at this point in the history
  26. suggest: Rename IngestLimits to SuggestIngestionConstraints.

    This commit also generalizes `IngestLimits.records` to
    `SuggestIngestionConstraints.max_suggestions`, since the partitioning
    scheme and number of suggestions per Remote Settings attachment is an
    implementation detail.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    46bdeba View commit details
    Browse the repository at this point in the history
  27. suggest: Clarify "fetching" in docs and type names.

    "Fetching" is a bit of an overloaded term that can refer to querying
    ingested suggestions, or downloading records from Remote Settings. To
    reduce confusion, let's replace those uses with more precise
    terminology:
    
    * "Downloading" for when we request suggestions from Remote Settings.
    * "Ingesting" for storing the downloaded suggestions in the database.
    * "Querying" for when the application requests ingested suggestions.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    690a143 View commit details
    Browse the repository at this point in the history
  28. suggest: Don't pass SuggestionQuery [ByRef].

    This matches how we pass dictionaries across the FFI boundary in our
    other components.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    1e7bd53 View commit details
    Browse the repository at this point in the history
  29. suggest: Include the collection name in the "last ingest" metadata key.

    A bit of future-proofing, in case we support multiple Remote Settings
    collections in the future.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    a427eb2 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    3c52626 View commit details
    Browse the repository at this point in the history
  31. suggest: Clarify type names for downloaded suggestions.

    This commit renames:
    
    * `RemoteSuggestion` to `DownloadedSuggestion` and
      `SuggestDataAttachmentContents` to `DownloadedSuggestDataAttachment`,
      for consistency with the "downloading" terminology.
    * `RemoteRecordId` to `SuggestRecordId`, for consistency with the other
      Remote Settings types.
    linabutler committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    a95dcb5 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    44e61d3 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    c43a481 View commit details
    Browse the repository at this point in the history