Skip to content

Commit f65a68c

Browse files
committed
Merge branch 'main' into mkzie2-issue/66714
2 parents eb9e285 + 60677bc commit f65a68c

File tree

87 files changed

+1575
-556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1575
-556
lines changed
Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,76 @@
11
#!/bin/bash
2+
set -euo pipefail
23

3-
# Ensure upstream/main exists
4-
git fetch --depth=50 upstream main:upstream/main
4+
# -----------------------------
5+
# 1. Ensure upstream remote exists
6+
# -----------------------------
7+
# The PR branch comes from either the base repo or a fork.
8+
# We need the base repository's main branch for comparison.
9+
git remote add upstream "https://github.com/${GITHUB_REPOSITORY}.git" 2>/dev/null || true
510

6-
# Determine diff range safely
7-
if git merge-base upstream/main HEAD >/dev/null 2>&1; then
8-
DIFF_RANGE="upstream/main...HEAD"
9-
else
10-
echo "No merge base with upstream/main; falling back to comparing HEAD against upstream/main"
11-
DIFF_RANGE="upstream/main HEAD"
11+
# -----------------------------
12+
# 2. Attempt shallow fetch first
13+
# -----------------------------
14+
# Start with a depth of 50 commits, which covers most PRs.
15+
DEPTH=50
16+
echo "Fetching upstream/main with depth=$DEPTH..."
17+
git fetch upstream main --depth=$DEPTH
18+
19+
# -----------------------------
20+
# 3. Check if a merge-base exists
21+
# -----------------------------
22+
# merge-base finds the common ancestor between the PR branch and main.
23+
# If this fails, it means our shallow history didn't go back far enough.
24+
if ! git merge-base upstream/main HEAD >/dev/null 2>&1; then
25+
echo "No merge base found with depth=$DEPTH, fetching full history..."
26+
27+
# Try unshallowing the entire repo (pulls full commit history).
28+
# If already full, this will be a no-op.
29+
git fetch --unshallow upstream || git fetch upstream main
1230
fi
1331

14-
# Get changed files in src directory
15-
readarray -t ALL_CHANGED_FILES < <(git diff --name-only "$DIFF_RANGE" | grep '^src/' | grep -E '\.(ts|tsx|js|jsx)$' || true)
32+
# -----------------------------
33+
# 4. Define the diff range
34+
# -----------------------------
35+
# Using three-dot notation (A...B) shows only the commits in HEAD
36+
# that aren't in upstream/main (i.e. just the PR changes).
37+
DIFF_RANGE="upstream/main...HEAD"
38+
39+
# -----------------------------
40+
# 5. Collect changed src/ files
41+
# -----------------------------
42+
readarray -t ALL_CHANGED_FILES < <(
43+
git diff --name-only "$DIFF_RANGE" \
44+
| grep '^src/' \
45+
| grep -E '\.(ts|tsx|js|jsx)$' || true
46+
)
1647

17-
# Filter out excluded directories and files
48+
# -----------------------------
49+
# 6. Filter excluded files/dirs
50+
# -----------------------------
1851
CHANGED_FILES=()
1952
for file in "${ALL_CHANGED_FILES[@]}"; do
20-
# Skip excluded directories
53+
# Exclude directories
2154
if [[ "$file" =~ ^src/(CONST|languages|setup|stories|styles|types)/ ]]; then
22-
echo "Skipping excluded directory: $file"
55+
echo "Skipping excluded directory: \"$file\""
2356
continue
2457
fi
25-
26-
# Skip excluded files in src root
27-
filename=$(basename "$file")
58+
59+
# Exclude specific files in src root
60+
filename="$(basename "$file")"
2861
if [[ "$filename" =~ ^(App\.tsx|CONFIG\.ts|Expensify\.tsx|HybridAppHandler\.tsx|NAICS\.ts|NAVIGATORS\.ts|ONYXKEYS\.ts|ROUTES\.ts|SCREENS\.ts|SplashScreenStateContext\.tsx|TIMEZONES\.ts)$ ]]; then
29-
echo "Skipping excluded file: $file"
62+
echo "Skipping excluded file: \"$file\""
3063
continue
3164
fi
3265

33-
# Add to coverage collection
3466
CHANGED_FILES+=("$file")
3567
done
3668

37-
# Check if any files remain for coverage
69+
# -----------------------------
70+
# 7. Output results
71+
# -----------------------------
3872
if [ ${#CHANGED_FILES[@]} -eq 0 ]; then
39-
echo "No relevant src files changed (all changes were in excluded directories/files), skipping coverage"
73+
echo "No relevant src files changed, skipping coverage"
4074
echo "run_coverage=false" >> "$GITHUB_OUTPUT"
4175
exit 0
4276
fi
@@ -45,5 +79,5 @@ echo "Changed src files for coverage:"
4579
printf '%s\n' "${CHANGED_FILES[@]}"
4680
echo "run_coverage=true" >> "$GITHUB_OUTPUT"
4781

48-
# Save changed files for coverage collection
82+
# Save changed files for later coverage steps
4983
printf '%s\n' "${CHANGED_FILES[@]}" > changed_files.txt

.github/workflows/testCoverage.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ jobs:
4545
repository: ${{ steps.get_pr.outputs.repo }}
4646
ref: ${{ steps.get_pr.outputs.ref }}
4747

48-
- name: Fetch Upstream Remote for Base Repository
49-
run: |
50-
git remote add upstream https://github.com/${{ github.repository }}.git
51-
git fetch upstream main
52-
5348
- name: Setup Git for OSBotify
5449
uses: Expensify/GitHub-Actions/setupGitForOSBotify@main
5550
id: setupGitForOSBotify
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const NitroModules = {
2+
createHybridObject: jest.fn(() => ({
3+
getAll: jest.fn(() => Promise.resolve([])),
4+
})),
5+
};
6+
7+
export {
8+
// eslint-disable-next-line import/prefer-default-export
9+
NitroModules,
10+
};

config/webpack/ForceGarbageCollectionPlugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,15 @@ class ForceGarbageCollectionPlugin {
1515
compiler.hooks.done.tap(this.constructor.name, () => {
1616
this.compilationCount++;
1717

18-
// Log memory usage every compilation
1918
const memUsage = process.memoryUsage();
2019
const heapUsedMB = Math.round(memUsage.heapUsed / 1024 / 1024);
2120
const heapTotalMB = Math.round(memUsage.heapTotal / 1024 / 1024);
2221

2322
console.log(`📊 Compilation #${this.compilationCount} - Heap: ${heapUsedMB}MB/${heapTotalMB}MB`);
2423
if (this.compilationCount % 5 === 0) {
2524
console.log(`🗑️ Forcing garbage collection after ${this.compilationCount} compilations`);
26-
// @ts-expect-error - gc is a global function provided when Node.js is started with --expose-gc flag
27-
gc();
25+
gc?.();
2826

29-
// Log memory after garbage collection
3027
const memAfterGC = process.memoryUsage();
3128
const heapAfterMB = Math.round(memAfterGC.heapUsed / 1024 / 1024);
3229
console.log(`✅ Post-GC heap size: ${heapAfterMB}MB (freed ${heapUsedMB - heapAfterMB}MB)`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
4747
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
4848
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
49-
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=332 --cache --cache-location=node_modules/.cache/eslint",
49+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=331 --cache --cache-location=node_modules/.cache/eslint",
5050
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
5151
"lint-watch": "npx eslint-watch --watch --changed",
5252
"shellcheck": "./scripts/shellCheck.sh",

scripts/start-dev-with-auto-restart.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
# This script monitors for heap out of memory errors and automatically restarts
55
# Usage: ./start-dev-with-auto-restart.sh [webpack-dev-server arguments]
66

7-
WDS_ARGS=("$@")
7+
WEBPACK_DEV_SERVER_ARGS=("$@")
8+
readonly RESTART_DELAY=1
89
MAX_RESTARTS=10
910
RESTART_COUNT=0
10-
RESTART_DELAY=1
1111

1212
echo "🚀 Starting webpack-dev-server with auto-restart (max restarts: $MAX_RESTARTS)"
1313

1414
run_wds () {
1515
# Check if platform is Desktop to determine open behavior
16-
if [[ "${WDS_ARGS[*]}" == *"--env platform=desktop"* ]]; then
16+
if [[ "${WEBPACK_DEV_SERVER_ARGS[*]}" == *"--env platform=desktop"* ]]; then
1717
# For Desktop, always use --no-open since app is handled by Electron
18-
node --expose-gc --max-old-space-size=1100 ./node_modules/.bin/webpack-dev-server --no-open "${WDS_ARGS[@]}" --config config/webpack/webpack.dev.ts
18+
node --expose-gc ./node_modules/.bin/webpack-dev-server --no-open "${WEBPACK_DEV_SERVER_ARGS[@]}" --config config/webpack/webpack.dev.ts
1919
else
2020
# For Web, use the provided open flag
21-
node --expose-gc ./node_modules/.bin/webpack-dev-server "$1" "${WDS_ARGS[@]}" --config config/webpack/webpack.dev.ts
21+
node --expose-gc ./node_modules/.bin/webpack-dev-server "$1" "${WEBPACK_DEV_SERVER_ARGS[@]}" --config config/webpack/webpack.dev.ts
2222
fi
2323
}
2424

25-
while [ $RESTART_COUNT -lt $MAX_RESTARTS ]; do
25+
while [[ $RESTART_COUNT -lt $MAX_RESTARTS ]]; do
2626
echo "📊 Attempt #$((RESTART_COUNT + 1)) - Starting webpack-dev-server..."
2727

2828
if [ $RESTART_COUNT -eq 0 ]; then

src/CONST/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ const CONST = {
656656
TRACK_FLOWS: 'trackFlows',
657657
EUR_BILLING: 'eurBilling',
658658
MANUAL_DISTANCE: 'manualDistance',
659+
VACATION_DELEGATE: 'vacationDelegate',
659660
},
660661
BUTTON_STATES: {
661662
DEFAULT: 'default',
@@ -1122,7 +1123,6 @@ const CONST = {
11221123
CHRONOS_OOO_LIST: 'CHRONOSOOOLIST',
11231124
CLOSED: 'CLOSED',
11241125
CREATED: 'CREATED',
1125-
DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action
11261126
DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action
11271127
DELETED_TRANSACTION: 'DELETEDTRANSACTION',
11281128
DISMISSED_VIOLATION: 'DISMISSEDVIOLATION',
@@ -1275,6 +1275,7 @@ const CONST = {
12751275
RECEIPT: 'receipt',
12761276
DATE: 'date',
12771277
MERCHANT: 'merchant',
1278+
DESCRIPTION: 'description',
12781279
FROM: 'from',
12791280
TO: 'to',
12801281
CATEGORY: 'category',
@@ -1593,6 +1594,7 @@ const CONST = {
15931594
UNABLE_TO_RETRY: 'unableToRetry',
15941595
UPDATE_REQUIRED: 426,
15951596
INCORRECT_MAGIC_CODE: 451,
1597+
POLICY_DIFF_WARNING: 305,
15961598
},
15971599
HTTP_STATUS: {
15981600
// When Cloudflare throttles
@@ -6451,6 +6453,9 @@ const CONST = {
64516453
UNAPPROVED_CASH: 'unapprovedCash',
64526454
UNAPPROVED_CARD: 'unapprovedCard',
64536455
},
6456+
ANIMATION: {
6457+
FADE_DURATION: 200,
6458+
},
64546459
},
64556460

64566461
EXPENSE: {

src/ONYXKEYS.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,9 @@ const ONYXKEYS = {
513513
/** Stores the information about the state of side panel */
514514
NVP_SIDE_PANEL: 'nvp_sidePanel',
515515

516+
/** Information about vacation delegate */
517+
NVP_PRIVATE_VACATION_DELEGATE: 'nvp_private_vacationDelegate',
518+
516519
/** Stores draft information while user is scheduling the call. */
517520
SCHEDULE_CALL_DRAFT: 'scheduleCallDraft',
518521

@@ -1199,6 +1202,7 @@ type OnyxValuesMapping = {
11991202
[ONYXKEYS.SHOULD_BILL_WHEN_DOWNGRADING]: boolean | undefined;
12001203
[ONYXKEYS.BILLING_RECEIPT_DETAILS]: OnyxTypes.BillingReceiptDetails;
12011204
[ONYXKEYS.NVP_SIDE_PANEL]: OnyxTypes.SidePanel;
1205+
[ONYXKEYS.NVP_PRIVATE_VACATION_DELEGATE]: OnyxTypes.VacationDelegate;
12021206
[ONYXKEYS.SCHEDULE_CALL_DRAFT]: OnyxTypes.ScheduleCallDraft;
12031207
[ONYXKEYS.IS_FORCED_TO_CHANGE_CURRENCY]: boolean | undefined;
12041208
[ONYXKEYS.IS_COMING_FROM_GLOBAL_REIMBURSEMENTS_FLOW]: boolean | undefined;

src/ROUTES.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ const ROUTES = {
354354
SETTINGS_STATUS_CLEAR_AFTER: 'settings/profile/status/clear-after',
355355
SETTINGS_STATUS_CLEAR_AFTER_DATE: 'settings/profile/status/clear-after/date',
356356
SETTINGS_STATUS_CLEAR_AFTER_TIME: 'settings/profile/status/clear-after/time',
357+
SETTINGS_VACATION_DELEGATE: 'settings/profile/status/vacation-delegate',
357358
SETTINGS_TROUBLESHOOT: 'settings/troubleshoot',
358359
SETTINGS_CONSOLE: {
359360
route: 'settings/troubleshoot/console',

src/SCREENS.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ const SCREENS = {
102102
STATUS_CLEAR_AFTER: 'Settings_Status_Clear_After',
103103
STATUS_CLEAR_AFTER_DATE: 'Settings_Status_Clear_After_Date',
104104
STATUS_CLEAR_AFTER_TIME: 'Settings_Status_Clear_After_Time',
105+
VACATION_DELEGATE: 'Settings_Status_Vacation_Delegate',
105106
STATUS: 'Settings_Status',
106107
PRONOUNS: 'Settings_Pronouns',
107108
TIMEZONE: 'Settings_Timezone',

0 commit comments

Comments
 (0)