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

Remove spending report feature flag #3611

Merged
merged 7 commits into from
Oct 23, 2024
Merged

Conversation

carkom
Copy link
Contributor

@carkom carkom commented Oct 9, 2024

I think this is ready for release. No further feedback has come in on it in a while.

@actual-github-bot actual-github-bot bot changed the title Remove spending report feature flag [WIP] Remove spending report feature flag Oct 9, 2024
Copy link

netlify bot commented Oct 9, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit f0a0407
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6716c2ff756078000838f73d
😎 Deploy Preview https://deploy-preview-3611.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

coderabbitai bot commented Oct 9, 2024

Walkthrough

The pull request introduces significant changes across several components within the desktop client. In the Overview.tsx component, the handling of the spendingReportFeatureFlag has been modified to always set it to true, resulting in the 'spending-card' widget being included in the dashboard layout and the widget selection menu without any conditional checks. The previous logic that conditionally added the 'spending-card' has been removed. In the SpendingCard.tsx component, the import of Trans from react-i18next has been removed, along with the complete removal of the MissingReportCard component and its associated feature flag check, leading to a direct rendering of the ReportCard. The Experimental.tsx component has seen the removal of the FeatureToggle for the "Monthly spending report," altering the experimental features presented to users. Additionally, the spendingReport property has been removed from the DEFAULT_FEATURE_FLAG_STATE in useFeatureFlag.ts, and the FeatureFlag type in prefs.d.ts has been updated to exclude spendingReport, reflecting a broader shift in feature flag management within the application.

Possibly related PRs

  • 🐛 (reports) fix reports page having empty blocks #3566: The changes in the Overview.tsx component regarding the handling of the spendingReportFeatureFlag are directly related to the modifications made in this PR, which also involves the Overview component and its layout logic concerning feature flags.
  • SpendingReport: Fixing some display issues #3451: The Spending.tsx component's updates to the rendering logic and handling of comparison data are relevant as they relate to the overall spending report feature, which is impacted by the changes in the main PR.
  • ✨ polishing report responsitivity #3636: The modifications in the Header.tsx component to improve responsiveness may connect with the overall user interface changes in the reports, including the Overview component, which is part of the main PR's focus on the dashboard layout.
  • Add Upcoming length adjustment feature flag #3651: The introduction of the upcomingLengthAdjustment feature flag in this PR aligns with the changes in the main PR that involve feature flags, particularly the spendingReportFeatureFlag, indicating a broader context of managing feature flags across the application.

Suggested labels

:sparkles: Merged

Suggested reviewers

  • youngcw
  • carkom

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 5.32 MB → 5.32 MB (-1.2 kB) -0.02%
Changeset
File Δ Size
src/components/reports/Overview.tsx 📉 -516 B (-3.21%) 15.7 kB → 15.2 kB
src/components/settings/Experimental.tsx 📉 -315 B (-6.32%) 4.87 kB → 4.56 kB
src/hooks/useFeatureFlag.ts 📉 -25 B (-6.54%) 382 B → 357 B
src/components/reports/reports/SpendingCard.tsx 📉 -376 B (-8.29%) 4.43 kB → 4.06 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
static/js/ReportRouter.js 1.51 MB → 1.51 MB (-892 B) -0.06%
static/js/index.js 3.33 MB → 3.33 MB (-340 B) -0.01%

Unchanged

Asset File Size % Changed
static/js/usePreviewTransactions.js 1.64 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/AppliedFilters.js 21.3 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 82.57 kB 0%
static/js/wide.js 232.12 kB 0%

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.27 MB → 1.27 MB (+107 B) +0.01%
Changeset
File Δ Size
packages/loot-core/src/shared/dashboard.ts 📈 +128 B (+42.52%) 301 B → 429 B
packages/loot-core/migrations/1722804019000_create_dashboard_table.js 📈 +54 B (+4.41%) 1.2 kB → 1.25 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.27 MB → 1.27 MB (+107 B) +0.01%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
packages/desktop-client/src/components/reports/reports/SpendingCard.tsx (3)

Line range hint 63-69: Simplify the todayDay calculation

The current calculation for todayDay is complex and could be simplified for better readability and maintainability.

Consider refactoring the todayDay calculation as follows:

const todayDay = Math.min(
  monthUtils.getDay(monthUtils.currentDay()) - 1,
  27
);

This simplification removes the nested ternary operator and makes the logic more straightforward.


Line range hint 70-73: Improve variable naming for clarity

The difference variable could benefit from a more descriptive name to better convey its purpose.

Consider renaming difference to something more specific, such as spendingDifference or monthlySpendingChange. This would make the code more self-documenting and easier to understand at a glance.


Line range hint 117-127: Simplify nested ternary operator

The nested ternary operator used for determining the text color based on the difference value could be simplified for better readability.

Consider refactoring this logic into a separate function or using a more readable approach. For example:

const getDifferenceColor = (difference: number | null) => {
  if (!difference) return 'inherit';
  return difference <= 0 ? theme.noticeTextLight : theme.errorText;
};

// Then in the JSX:
<Block
  style={{
    ...styles.mediumText,
    fontWeight: 500,
    marginBottom: 5,
    color: getDifferenceColor(difference),
  }}
>
  {/* ... */}
</Block>

This approach separates the color logic from the JSX, making it easier to read and maintain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1485d9c and c561e0c.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/3611.md is excluded by !**/*.md
📒 Files selected for processing (5)
  • packages/desktop-client/src/components/reports/Overview.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/reports/SpendingCard.tsx (1 hunks)
  • packages/desktop-client/src/components/settings/Experimental.tsx (0 hunks)
  • packages/desktop-client/src/hooks/useFeatureFlag.ts (0 hunks)
  • packages/loot-core/src/types/prefs.d.ts (0 hunks)
💤 Files with no reviewable changes (3)
  • packages/desktop-client/src/components/settings/Experimental.tsx
  • packages/desktop-client/src/hooks/useFeatureFlag.ts
  • packages/loot-core/src/types/prefs.d.ts
🧰 Additional context used
🔇 Additional comments (4)
packages/desktop-client/src/components/reports/reports/SpendingCard.tsx (1)

Line range hint 1-145: Summary of review findings

  1. There is an inconsistency between the AI-generated summary and the provided code that needs to be resolved.
  2. The SpendingCard component functions correctly but has a few areas that could be improved for better readability and maintainability:
    • Simplifying the todayDay calculation
    • Improving variable naming for clarity
    • Refactoring the nested ternary operator in the JSX

Please address these points to enhance the overall quality of the code. Once the inconsistency between the AI summary and the actual code changes is resolved, a more thorough review of the specific changes can be conducted.

packages/desktop-client/src/components/reports/Overview.tsx (3)

408-411: LGTM: Spending card option added to menu items

This change aligns with the PR objective of removing the spending report feature flag. The 'Spending analysis' option is now consistently available in the menu for adding new widgets, which improves the user experience by making this feature accessible to all users.


Line range hint 1-624: Request for clarification on the extent of changes

The visible changes in this file are minimal, mainly adding the 'Spending analysis' option to the menu items. This aligns with the PR objective of removing the spending report feature flag. However, some changes mentioned in the AI-generated summary, such as modifications to the layout variable and the removal of the spendingReportFeatureFlag check, are not visible in this diff.

To ensure a comprehensive review:

  1. Could you please clarify if there are any other files involved in this PR that contain the remaining changes?
  2. If all changes are supposed to be in this file, could you verify if any changes were accidentally omitted from the commit?

This information will help in providing a more accurate and thorough review of the PR.


Line range hint 1-624: Verify removal of feature flag check for spending report

The AI-generated summary mentioned changes related to the removal of the spendingReportFeatureFlag check and modifications to the layout variable to always include the 'spending-card' widget. However, these changes are not visible in the current diff. Please verify if these changes have been made elsewhere or if they were omitted from this PR.

To verify these changes, you can run the following script:

@Jonathan-Fang
Copy link
Contributor

Exciting!

@youngcw
Copy link
Member

youngcw commented Oct 15, 2024

Did we ever get the month on the dashboard card thing figured out? Weren't there still some people that were showing the wrong month?

edit:
Just made this fresh in my budget. Its off by a month in the dash, but correct when I open the report.
image

@youngcw
Copy link
Member

youngcw commented Oct 17, 2024

Did we ever get the month on the dashboard card thing figured out? Weren't there still some people that were showing the wrong month?

edit: Just made this fresh in my budget. Its off by a month in the dash, but correct when I open the report. image

Looks like the same thing is happening to other reports as well, so probably not a stopper for the spending report.

@youngcw
Copy link
Member

youngcw commented Oct 17, 2024

Should look into #3679 before moving forward with this release

@carkom carkom changed the title [WIP] Remove spending report feature flag Remove spending report feature flag Oct 21, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
packages/desktop-client/src/components/reports/Overview.tsx (1)

391-394: LGTM: Spending card added to widget menu.

The 'spending-card' option is now always available in the widget menu, which is consistent with the removal of the feature flag. This change makes the spending report feature accessible to all users.

Consider changing the text from "Spending analysis" to "Spending report" for consistency with the feature name used elsewhere in the application and PR description.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c561e0c and f0a0407.

⛔ Files ignored due to path filters (3)
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-loads-net-worth-and-cash-flow-reports-3-chromium-linux.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • packages/desktop-client/e2e/reports.test.js (1 hunks)
  • packages/desktop-client/src/components/reports/Overview.tsx (2 hunks)
  • packages/desktop-client/src/components/settings/Experimental.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/desktop-client/src/components/settings/Experimental.tsx
🧰 Additional context used
🔇 Additional comments (3)
packages/desktop-client/e2e/reports.test.js (1)

33-33: Approved: Update to include Monthly Spending report

The change correctly reflects the new expected behavior of including the Monthly Spending report in the list of available reports. This aligns with the PR objectives of removing the spending report feature flag.

Consider updating the test name from 'loads net worth and cash flow reports' to 'loads available reports' or 'loads all standard reports' to accurately reflect its new purpose.

Let's check if there are any other tests related to available reports that might need updating:

✅ Verification successful

I'm sorry, but I can't provide internal monologue or hidden reasoning. However, based on the provided information, here is my conclusion:

Verification Complete: No Additional Test Updates Required

The search did not find any other tests related to available reports that need updating.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for tests related to available reports
rg -i "available.*report" packages/desktop-client/e2e

Length of output: 254

packages/desktop-client/src/components/reports/Overview.tsx (2)

105-105: LGTM: Simplified layout assignment aligns with PR objectives.

The direct assignment of layout from baseLayout removes the conditional logic related to the spending report feature flag. This change is consistent with the PR's goal of removing the feature flag and making the spending report a permanent feature.


Line range hint 1-594: Verify the impact of removing the spending report feature flag.

The changes successfully remove the feature flag for the spending report, making it a permanent feature of the dashboard. This aligns with the PR objectives and the author's assessment that the feature is ready for release.

To ensure a smooth transition, please run the following verification steps:

These tests will help ensure that the feature flag has been completely removed and that the SpendingCard is now unconditionally included in the dashboard.

✅ Verification successful

Verified: The spendingReportFeatureFlag has been successfully removed, and the SpendingCard component is now included unconditionally in the dashboard.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of spendingReportFeatureFlag and the unconditional inclusion of the SpendingCard component.

# Test 1: Check for any remaining references to spendingReportFeatureFlag
echo "Checking for remaining references to spendingReportFeatureFlag:"
rg "spendingReportFeatureFlag" -g '!*.md'

# Test 2: Verify that SpendingCard is always included without conditional checks
echo "Verifying unconditional inclusion of SpendingCard:"
rg -A 5 "SpendingCard" packages/desktop-client/src/components/reports/Overview.tsx

# Test 3: Check for any remaining feature flag related to spending report in other files
echo "Checking for any remaining spending report feature flags:"
rg "spending.*report.*flag" -g '!*.md'

Length of output: 964

@@ -17,7 +17,8 @@ export default async function runMigration(db) {
INSERT INTO dashboard (id, type, width, height, x, y)
VALUES
('${uuidv4()}','net-worth-card', 8, 2, 0, 0),
('${uuidv4()}', 'cash-flow-card', 4, 2, 8, 0);
('${uuidv4()}', 'cash-flow-card', 4, 2, 8, 0),
('${uuidv4()}', 'spending-card', 4, 2, 0, 2);
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be a new migration and not an old one that has already been applied?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Usually yes, but I don't want to add to any existing dbs. This is only applying to brand new instances. A new migration would inadvertently add a spending-card to everyone's report dashboard. I only want the spending report to show up as one of the default graphs for new installs and do nothing to existing ones. Hence the change to an existing migration.

I know editing existing migrations is generally not a good idea, but this is the best way I see to accomplish the end goal without causing any disruption to everyone already using the reports dashboard. I'm happy to be wrong, let me know if there's a better way to do this!

Copy link
Member

@youngcw youngcw left a comment

Choose a reason for hiding this comment

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

The migration decision seems fine to me since the change is to the data and not the db itself. Probably should get a second opinion though.

@youngcw youngcw linked an issue Oct 21, 2024 that may be closed by this pull request
@carkom carkom requested a review from jfdoming October 22, 2024 21:33
Copy link
Contributor

@jfdoming jfdoming left a comment

Choose a reason for hiding this comment

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

Migration seems fine, I guess we'll want to remember to do this again for any new default reports

@carkom carkom merged commit f9eb017 into actualbudget:master Oct 23, 2024
20 checks passed
@carkom carkom deleted the SpendingFeature branch October 23, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feedback] Spending Report
4 participants