You need to sign in or sign up before continuing.
  1. 12 May, 2025 1 commit
    • Alfredo Di Napoli's avatar
      Port DB operations to transactional API · 53512f89
      Alfredo Di Napoli authored
      This gigantic commit ports the existing DB operations in GGTX to use the
      transactional API, meaning that we can now compose DB operations and
      they will all run in the same Postgres transaction using the same
      connection, which will eliminate those class of bugs where concurrent DB
      access might result in an inconsistent state.
      
      On top of that, we simplify some parts of the API, for which a summary
      is given below:
      
      1. The `NodeStoryEnv` management has been greatly simplified; in the new
         API we don't need an external connection pool to be passed and we
         don't have to pass IO actions, we can just pass DB operations,
         therefore we can greatly simplify the API to just pass mostly pure
         values;
      
      2. Due to the fact that our `DBTx` monad can't do arbitrary IO (which is
         a good thing) we cannot fire Central Exchange notifications
         immediately. Rather that happens now is that we collect the
         `CEMessage` to be sent and we fire them in the relevant concrete
         monad after we finished with the DB transaction. This means that in
         principle there would be a small delay between the DB operation
         taking place and the notification firing but in practice the latency
         should be negligible and bear in mind this is typically what we want:
         if we have a long DB Tx that triggers an error in the middle we don't
         want to be sending out CE messages prematurely if the overall
         operation didn't succeed!
      
      3. There are still a few places in the codebase where we couldn't make
         things fully compositional with regards to the DBTx API, because we
         had Servant handlers which had DB operations mixed with other IO
         effectful computations (or other things like the notification from
         the `MonadJobStatus`). For now we are splitting these functions by
         manually running the partial DB operations, and while this is not
         ideal it can be fixed in subsequent merge requests.
      
      4. The `WorkerEnv` doesn't use `IOException` as its `MonadError`
         anymore, as for consistency we can just use `BackendInternalError` by
         adding a `InternalWorkerError` data constructor accepting the
         `IOException` triggered by the Worker monad.
      
      More testing is needed, with particular attention to performance
      (regression) but this should hopefully offer a decent baseline.
      53512f89
  2. 24 Apr, 2025 1 commit
  3. 18 Dec, 2024 1 commit
  4. 18 Nov, 2024 2 commits
    • Alfredo Di Napoli's avatar
      BREAKING: rename unpublish to unshare · 17909a7e
      Alfredo Di Napoli authored
      Previously there was no symmetry in the name of the share endpoint,
      which is meant to be used to generate a publicly-accessible URL to view
      a node, and the previously-called "unpulish" endpoint.
      
      The problem is that now the "unpublish" name would clash with the dual
      of publishing a node. To avoid the problem, this commit renames the old
      "unpublish" endpoint to be "unshare", so that now it's clear that is the
      inverse operation of "share".
      17909a7e
    • Alfredo Di Napoli's avatar
      A NodeTree now stores a publish policy · 3dc86d39
      Alfredo Di Napoli authored
      This allows the frontend to correctly display a different icon in case a
      node has been published with edits enabled or not.
      3dc86d39
  5. 14 Nov, 2024 1 commit
  6. 11 Nov, 2024 11 commits
    • Alfredo Di Napoli's avatar
      Enforce policy for published nodes for read/write · 48bab856
      Alfredo Di Napoli authored
      This commit splits the policy checks we do on node operations into
      "read" checks and "write" checks, so that we can enforce different kind
      of policies based on the state of a node (i.e. published or not).
      48bab856
    • Alfredo Di Napoli's avatar
      Refactors NodeNodeCategory · 121f8a4b
      Alfredo Di Napoli authored
      This commit refactors the `NodeNodeCategory` so that we create a better
      hierarchy to account for node publication, including all the policies it
      might have.
      121f8a4b
    • Alfredo Di Napoli's avatar
      Properly display published folders in trees · 35fd225e
      Alfredo Di Napoli authored
      It also:
      
      * Removes UserNodePublic from typesWhiteList in isNodeReadOnly
      35fd225e
    • Alfredo Di Napoli's avatar
      Database.Query.Tree refactoring · 8c908150
      Alfredo Di Napoli authored
      This commit refactors a bit the internal of the
      `Gargantext.Database.Query.Tree` module so that it removes a lot of
      repetitive boilerplate and paves the way to more interesting features.
      
      It also:
      
      * Adds the `isUserNode` boolean query
      * Adjust source and target in publishNode and unpublishNode
      * Pass the currently-logged-in user to tree API functions
      8c908150
    • Alfredo Di Napoli's avatar
      Correct FrontendError for policy check failures · cb49e82a
      Alfredo Di Napoli authored
      It also:
      
      * Amends tests for policy checks status code changes
      * Fix a bug in isNodeReadOnly
      * Adds a function to return all the nodes ids for the published
        nodes. Next we need to modify `findShared` & co to make sure that
        published notes will show somewhere in the users' tree.
      cb49e82a
    • Alfredo Di Napoli's avatar
      Improve isNodeReadOnly query · 3d91bc98
      Alfredo Di Napoli authored
      Now this query accounts correctly for recursive children.
      
      It also:
      
      * Adds basic publish/unpublish works
      * Add Move API tests scaffolding
      3d91bc98
    • Alfredo Di Napoli's avatar
      Introduce the NodeNodeCategory · 487ddd4c
      Alfredo Di Napoli authored
      Now a `NodeNodePoly` stores a typed `NodeNodeCategory`, we can use
      to enforce invariants and making lookups more efficient.
      487ddd4c
    • Alfredo Di Napoli's avatar
      insertNodeNode is now private · b3a00112
      Alfredo Di Napoli authored
      This commit makes this function private to the `Table.NodeNode` module
      as it's fairly low-level, and it doesn't let us embed logic to ensure we
      are creating a valid node2node relationship. Better use one of the other
      specialised functions.
      b3a00112
    • Alfredo Di Napoli's avatar
      Remove InsertDB class, add publishNode and shareNode · 76b51c0c
      Alfredo Di Napoli authored
      This commit removes the `InsertDB` typeclass, an indirection which
      wasn't very useful as it was being used in exactly one place in the
      whole codebase (i.e. the share code).
      
      Talking about share, this commit refactors things ever so slightly so
      that we have a dedicated `shareNode` operation rather than using the
      low-level `insertNodeNode`.
      76b51c0c
    • Alfredo Di Napoli's avatar
      Basic implementation of isNodeReadOnly · c700b016
      Alfredo Di Napoli authored
      c700b016
    • Alfredo Di Napoli's avatar
      Split NodeAPIEndpoint · ab0a0edf
      Alfredo Di Napoli authored
      This commit splits the old `NodeAPIEndpoint` type into three;
      
      * `NodeAPIEndpoint`, which will also contain the freeze endpoint;
      * `AnnuaireAPIEndpoint`, which is the plain old node API without extra
        features;
      * `CorpusAPIEndpoint`, which will also contain the publishin endpoint.
      
      This split ensures that we don't add endpoints which do not belong to
      all three categories, like before.
      
      Furthermore this adds a public nodes SQL queries.
      It also adds tests for getUserRootPublicNode
      ab0a0edf
  7. 09 Sep, 2024 1 commit
    • Grégoire Locqueville's avatar
      Remove useless code, dependencies, warnings · 802e0cdf
      Grégoire Locqueville authored
      - Re-enable orphan warnings that were manually disabled in many modules
      - Remove non-Haskell files that were just sitting in the source tree
      - Remove modules that were not called from anywhere
      - Remove unused dependencies
      
      This is not exhaustive by any means. In particular, some more weeding out
      can be achieved by looking at individual functions and even branches of
      functions. Weeder can help with that.
      802e0cdf
  8. 09 Apr, 2024 1 commit
  9. 25 Mar, 2024 1 commit
  10. 21 Mar, 2024 1 commit
  11. 12 Oct, 2023 1 commit
  12. 11 Oct, 2023 1 commit
  13. 10 Oct, 2023 1 commit
  14. 09 Feb, 2023 1 commit
  15. 01 Jun, 2022 1 commit
  16. 20 Jan, 2022 3 commits
  17. 04 Jan, 2022 1 commit
  18. 29 Sep, 2021 1 commit
  19. 09 Mar, 2021 1 commit
  20. 16 Feb, 2021 1 commit
  21. 23 Dec, 2020 1 commit
  22. 22 Dec, 2020 1 commit
  23. 18 Sep, 2020 1 commit
  24. 31 Aug, 2020 1 commit
  25. 25 Jul, 2020 1 commit
  26. 22 Jul, 2020 2 commits