Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

use delta queries for calendar events #2154

Merged
merged 4 commits into from
Jan 19, 2023
Merged

use delta queries for calendar events #2154

merged 4 commits into from
Jan 19, 2023

Conversation

ryanfkeepers
Copy link
Contributor

Description

Hacks the beta version call into the events api
when iterating through items, allowing us to run
delta-based queries for calendar events.

Does this PR need a docs update or release note?

  • ⛔ No

Type of change

  • 🌻 Feature

Issue(s)

Test Plan

  • ⚡ Unit test
  • 💚 E2E

Hacks the beta version call into the events api
when iterating through items, allowing us to run
delta-based queries for calendar events.
@ryanfkeepers ryanfkeepers added the enhancement New feature or request label Jan 17, 2023
@ryanfkeepers ryanfkeepers self-assigned this Jan 17, 2023
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 17, 2023 22:54 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 17, 2023 22:54 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 17, 2023 22:55 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 17, 2023 22:55 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 17, 2023 22:55 — with GitHub Actions Inactive
Comment on lines +213 to +214
// Note that the delta item body is skeletal compared to the actual event struct. Lucky
// for us, we only need the item ID. As a result, even though we hacked the version, the
Copy link
Contributor

Choose a reason for hiding this comment

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

can you check that items don't get skipped accidentally due to us selecting the bare minimum fields? Tbh, I'm not sure if this is a feature or a "bug" in how Graph works, but using $select can sometimes cause a delta endpoint to skip returning results if they don't match what's in the $select. For example, not having isRead in the select for emails will cause emails where the isRead flag has been changed to be skipped because it doesn't update the mod time. This will take some playing around and is probably easiest to do with GraphExplorer/postman

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, good call out. I'll do some manual testing. This might be especially interesting in this case, because the delta body for an event are only able to contain the id, startTime, and endTime. Hopefully the delta will catch changes on unrepresented properties, like renames and etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, two findings.

  1. everything works. Changes to name, desc, attendees, etc, are all picked up by the delta.
  2. we're not allowed to select values in the first place (see the error below). If anything, we're lucky that the client is tossing the use of options for us.
    "error": {
        "code": "ErrorInvalidUrlQuery",
        "message": "The following parameters are not supported with change tracking over the 'SyncEvents' resource: '$orderby, $filter, $select, $expand, $search'."
    }

// for us, we only need the item ID. As a result, even though we hacked the version, the
// response body parses properly into the v1.0 structs and complies with our wanted interfaces.
// Likewise, the NextLink and DeltaLink odata tags carry our hack forward, so the rest of the code
// works as intended (until, at least, we want to _not_ call the beta anymore).
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 18, 2023 18:44 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 18, 2023 18:44 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 18, 2023 18:44 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 18, 2023 18:44 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 18, 2023 18:44 — with GitHub Actions Inactive
@aviator-app
Copy link
Contributor

aviator-app bot commented Jan 18, 2023

Aviator status

Aviator will automatically update this comment as the status of the PR changes.

This PR was merged using Aviator.

@aviator-app aviator-app bot temporarily deployed to Testing January 18, 2023 23:32 Inactive
@aviator-app aviator-app bot temporarily deployed to Testing January 18, 2023 23:32 Inactive
@aviator-app aviator-app bot temporarily deployed to Testing January 18, 2023 23:32 Inactive
@aviator-app aviator-app bot temporarily deployed to Testing January 18, 2023 23:33 Inactive
@aviator-app aviator-app bot temporarily deployed to Testing January 18, 2023 23:33 Inactive
@aviator-app aviator-app bot added the blocked Upstream item prevents completion label Jan 18, 2023
@aviator-app
Copy link
Contributor

aviator-app bot commented Jan 18, 2023

PR failed to merge with reason: some CI status(es) failed.
Failed CI(s): Test-Suite-Trusted

@aviator-app aviator-app bot removed the blocked Upstream item prevents completion label Jan 19, 2023
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 19, 2023 01:11 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 19, 2023 01:11 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 19, 2023 01:12 — with GitHub Actions Inactive
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 19, 2023 01:12 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 19, 2023 01:12 — with GitHub Actions Inactive
@ryanfkeepers ryanfkeepers temporarily deployed to Testing January 19, 2023 01:12 — with GitHub Actions Inactive
@aviator-app aviator-app bot merged commit 51e29f2 into main Jan 19, 2023
@aviator-app aviator-app bot deleted the issue-2022-poc branch January 19, 2023 01:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request mergequeue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants