Guardrails Not Honored With Migration

by ADMIN 38 views

Description of the Bug

The bug in question revolves around the migration of settings in Trio 0.5.0, specifically the spread interval for FPU (Food Protein Utilization) calculations. The issue arises when a user is able to set the spread interval to a value outside of the designated guardrails, which are intended to prevent such settings. In this case, the user was initially able to set the spread interval to 90 minutes, despite the UI resetting it to 60 minutes during onboarding. However, when the user attempted to confirm the ability to set above the guardrail, the system only allowed them to increase the spread interval up to 60 minutes, effectively honoring the guardrail.

The Consequences of Ignoring Guardrails

When the spread interval is set outside of the guardrails, FPU calculations result in a very large number of 1g carb entries over an extended period of time. This can have significant consequences, including inaccurate tracking and potentially misleading insights for users. The importance of adhering to guardrails cannot be overstated, as they are designed to prevent such issues and ensure the integrity of the data.

Steps to Reproduce the Behavior

To reproduce the behavior, follow these steps:

  1. Build Trio 0.2.5: Begin by building the Trio 0.2.5 version of the application.
  2. Set FPU Spread Interval to 90: Set the FPU spread interval to 90 minutes.
  3. Update to Trio 0.5.0: Update the application to Trio 0.5.0.
  4. After Onboarding, Spread Interval Will Say 60: After completing the onboarding process, the spread interval will display 60 minutes, despite the initial setting of 90 minutes.
  5. Allow Increase to 90: The user will be able to increase the spread interval to 90 minutes, despite the UI resetting it to 60 minutes during onboarding.
  6. Set Outside of Guardrails: If the user sets the spread interval outside of the designated guardrails, it will cause the mentioned issue with FPU calculations.

Expected Behavior

The expected behavior is for the guardrails to be honored and migrated settings outside of those limits to be either reset to default or set to the closest in-bounds limit. This ensures that the integrity of the data is maintained and prevents issues such as inaccurate tracking and misleading insights.

Technical Details

@MikePlante1 was able to replicate the issue and provided additional context. The technical details of the issue are as follows:

  • Trio Version: Version Number: Trio 0.5.0, Repo: nightscout/trio (dev)

Conclusion

The issue of guardrails not being honored with migration is a critical one, as it can have significant consequences for users. The expected behavior is for the guardrails to be honored and migrated settings outside of those limits to be either reset to default or set to the closest in-bounds limit. By addressing this issue, we can ensure the integrity of the data and prevent issues such as inaccurate tracking and misleading insights.

Recommendations

To resolve this issue, the following recommendations are made:

  1. Review Guardrail Logic: Review the guardrail logic to ensure that it is functioning as intended.
  2. Implement Migration Logic: Implement migration logic that honors guardrails and resets or adjusts settings outside of those limits.
  3. Test Thoroughly: Thoroughly test the application to ensure that the issue is resolved and the expected behavior is achieved.

Q: What is the purpose of guardrails in Trio 0.5.0?

A: Guardrails are designed to prevent users from setting settings outside of designated limits, ensuring the integrity of the data and preventing issues such as inaccurate tracking and misleading insights.

Q: What is the issue with the current implementation of guardrails in Trio 0.5.0?

A: The current implementation of guardrails in Trio 0.5.0 does not honor the designated limits, allowing users to set settings outside of those limits. This can have significant consequences, including inaccurate tracking and potentially misleading insights.

Q: What are the consequences of ignoring guardrails in Trio 0.5.0?

A: When the spread interval is set outside of the guardrails, FPU calculations result in a very large number of 1g carb entries over an extended period of time. This can have significant consequences, including inaccurate tracking and potentially misleading insights.

Q: How can I reproduce the behavior of the issue?

A: To reproduce the behavior, follow these steps:

  1. Build Trio 0.2.5: Begin by building the Trio 0.2.5 version of the application.
  2. Set FPU Spread Interval to 90: Set the FPU spread interval to 90 minutes.
  3. Update to Trio 0.5.0: Update the application to Trio 0.5.0.
  4. After Onboarding, Spread Interval Will Say 60: After completing the onboarding process, the spread interval will display 60 minutes, despite the initial setting of 90 minutes.
  5. Allow Increase to 90: The user will be able to increase the spread interval to 90 minutes, despite the UI resetting it to 60 minutes during onboarding.
  6. Set Outside of Guardrails: If the user sets the spread interval outside of the designated guardrails, it will cause the mentioned issue with FPU calculations.

Q: What is the expected behavior of the guardrails in Trio 0.5.0?

A: The expected behavior is for the guardrails to be honored and migrated settings outside of those limits to be either reset to default or set to the closest in-bounds limit. This ensures that the integrity of the data is maintained and prevents issues such as inaccurate tracking and misleading insights.

Q: How can I help resolve this issue?

A: You can help resolve this issue by:

  1. Reviewing the guardrail logic: Review the guardrail logic to ensure that it is functioning as intended.
  2. Implementing migration logic: Implement migration logic that honors guardrails and resets or adjusts settings outside of those limits.
  3. Testing thoroughly: Thoroughly test the application to ensure that the issue is resolved and the expected behavior is achieved.

Q: What is the current status of the issue?

A: The issue is currently being investigated and resolved. We appreciate your patience and understanding as we work to resolve this issue.

Q: How can I stay up-to-date with the latest information on this issue?

A: You can stay up-to-date with the latest information on this issue by:

  1. Following the Trio 0.5.0 GitHub repository: Follow the Trio 0.5.0 GitHub repository to receive updates on the issue.
  2. Checking the Trio 0.5.0 changelog: Check the Trio 0.5.0 changelog for updates on the issue.
  3. Reaching out to the Trio 0.5.0 support team: Reach out to the Trio 0.5.0 support team for assistance and updates on the issue.