Skip to content

Commit 3e52278

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude-showApproverRowForDynamicExternalWorkflow
Co-authored-by: Krishna <Krishna2323@users.noreply.github.com> # Conflicts: # src/pages/workspace/members/WorkspaceInviteMessageComponent.tsx
2 parents a02bac1 + 2e879b0 commit 3e52278

1,251 files changed

Lines changed: 58385 additions & 58456 deletions

File tree

Some content is hidden

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

‎.claude/settings.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
"mcp__sentry__search_issue_events",
5454
"mcp__sentry__search_issues",
5555
"mcp__sentry__whoami",
56-
"Bash(agent-device *)",
57-
"Bash(echo \"$(npm root -g)/agent-device/skills/agent-device\")"
56+
"Bash(agent-device *)"
5857
]
5958
},
6059
"enabledPlugins": {

‎.claude/skills/agent-device/SKILL.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: agent-device
33
description: Drive iOS and Android devices for the Expensify App - testing, debugging, performance profiling, bug reproduction, and feature verification. Use when the developer needs to interact with the mobile app on a device.
4-
allowed-tools: Bash(agent-device *) Bash(npm root *) Bash(scripts/is-hybrid-app.sh)
4+
allowed-tools: Bash(agent-device *) Bash(scripts/is-hybrid-app.sh)
55
---
66

77
# agent-device
@@ -12,7 +12,7 @@ These checks evaluate at skill load. If any line shows `FAIL`, stop and surface
1212

1313
`agent-device` version: !`R=0.20.0; V=$(agent-device --version 2>/dev/null); [ -n "$V" ] && [ "$(printf '%s\n%s\n' "$R" "$V" | sort -V | head -1)" = "$R" ] && echo "OK ($V)" || echo "FAIL (need v$R+, got: ${V:-not installed}). Fix: npm install -g agent-device@latest"`
1414

15-
Bundled CLI skills dir: !`D="$(npm root -g)/agent-device/skills/agent-device"; test -s "$D/SKILL.md" && echo "OK ($D)" || echo "FAIL (missing $D/SKILL.md). Fix: npm install -g agent-device@latest"`
15+
CLI guide: !`agent-device help workflow >/dev/null 2>&1 && echo "OK (agent-device help workflow)" || echo "FAIL (agent-device help workflow unavailable). Fix: npm install -g agent-device@latest"`
1616

1717
HybridApp mode: !`M=$(scripts/is-hybrid-app.sh 2>/dev/null | tail -1); [ "$M" = "true" ] && echo "OK (HybridApp)" || echo "FAIL (got: ${M:-unknown}). This skill only supports the HybridApp build - ensure the Mobile-Expensify submodule is present."`
1818

@@ -117,7 +117,7 @@ After pressing the action, verify the expected destination or control state with
117117

118118
### Canonical skill references
119119

120-
Read these files directly for device automation guidance (bootstrap, exploration, verification, debugging): !`echo "$(npm root -g)/agent-device/skills/agent-device"`
120+
For device automation guidance (exploration, verification, debugging), run `agent-device help workflow`. Topic guides: `agent-device help <topic>`, for example `react-native`, `debugging`, `scripting`, `batch`.
121121

122122
## Flows
123123

‎.claude/skills/app-coding-standards/SKILL.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ Coding standards for the Expensify App. Each standard is a standalone file in `r
5757
- [CONSISTENCY-15](rules/consistency-15-plain-comment-style.md) — Write comments as plain, natural sentences
5858
- [CONSISTENCY-16](rules/consistency-16-no-ai-jargon.md) — No AI-generated jargon in code or comments
5959
- [CONSISTENCY-17](rules/consistency-17-plural-form.md) — Pluralize with PluralForm, not ternaries on a count
60+
- [CONSISTENCY-18](rules/consistency-18-comment-non-obvious-code.md) — Comment code that is not self-explanatory
61+
- [CONSISTENCY-19](rules/consistency-19-copy-grammar-and-case.md) — User-facing copy is grammatical and sentence case
62+
- [CONSISTENCY-20](rules/consistency-20-function-names.md) — Name functions with a verb that says what they do
6063

6164
### Clean React Patterns
6265
- [CLEAN-REACT-PATTERNS-0](rules/clean-react-0-compiler.md) — React Compiler compliance
@@ -74,6 +77,8 @@ Coding standards for the Expensify App. Each standard is a standalone file in `r
7477
- [UI-1](rules/ui-1-correct-loading-indicator.md) — Use the correct loading indicator based on navigation context
7578
- [UI-2](rules/ui-2-new-page-scrollview.md) — New pages must be scrollable
7679
- [UI-3](rules/ui-3-no-inline-styles.md) — Do not use inline style objects
80+
- [UI-4](rules/ui-4-layout-spacing-tokens.md) — Type and responsive insets come from tokens
81+
- [UI-5](rules/ui-5-reuse-existing-styles.md) — Reuse an existing style or StyleUtils helper instead of adding a new one
7782

7883
## Usage
7984

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
ruleId: CONSISTENCY-18
3+
title: Comment code that is not self-explanatory
4+
---
5+
6+
## [CONSISTENCY-18] Comment code that is not self-explanatory
7+
8+
### Reasoning
9+
10+
What the next contributor cannot recover from the code is the reason behind it: the constraint, the bug, the API quirk, the deliberate trade-off. `STYLE.md` asks for this on non-obvious optimizations ("leave a code comment explaining the reasoning to aid reviewers and future contributors"), and the same standard holds for any non-obvious branch, workaround, or magic-looking condition. A comment that exists but is too unclear to understand fails the same way as a missing one. `CONSISTENCY-14` covers the opposite failure, a comment that only restates the code.
11+
12+
### Incorrect
13+
14+
```ts
15+
if (report?.isOptimisticReport && !hasPendingAction && lastVisibleActionCreated < cutoff) {
16+
scheduleCleanup(report);
17+
}
18+
```
19+
20+
### Correct
21+
22+
```ts
23+
// Optimistic reports created before the cutoff never received a server response, so they are
24+
// cleaned up here. Otherwise they linger in Onyx and the LHN shows a report that does not exist.
25+
if (report?.isOptimisticReport && !hasPendingAction && lastVisibleActionCreated < cutoff) {
26+
scheduleCleanup(report);
27+
}
28+
```
29+
30+
---
31+
32+
### Review Metadata
33+
34+
Flag ONLY when ONE of these is true:
35+
36+
- The changed code adds a non-obvious branch, workaround, magic-looking condition or ordering dependency with no comment explaining why it is needed
37+
- A changed comment is unclear or not correct English to the point that its meaning is ambiguous
38+
39+
**DO NOT flag if:**
40+
41+
- The comment only restates the code. That is `CONSISTENCY-14`
42+
- The comment's wording or punctuation style is the problem. That is `CONSISTENCY-15`
43+
- The comment documents props or JSDoc params (`CONSISTENCY-10`), is a `TODO`/`FIXME` (`CONSISTENCY-11`), a file header description (`CONSISTENCY-13`), or an eslint-disable justification (`CONSISTENCY-5`)
44+
- The code is self-evident and simply has no comment. Absence of a comment is only a violation where the code is genuinely non-obvious
45+
- Minor grammar or phrasing preferences that do not change the meaning
46+
- The code is a test or story
47+
48+
**Search Patterns** (hints for reviewers):
49+
- added conditions combining three or more clauses with no adjacent comment
50+
- `setTimeout`, `requestAnimationFrame`, `InteractionManager` and similar deferral calls with no adjacent comment
51+
- added `//` and `/* */` comments whose meaning is unclear
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
ruleId: CONSISTENCY-19
3+
title: User-facing copy is grammatical and sentence case
4+
---
5+
6+
## [CONSISTENCY-19] User-facing copy is grammatical and sentence case
7+
8+
### Reasoning
9+
10+
All user-visible copy lives in `src/languages/*` (`CONSISTENCY-7`), and the non-English files are generated from `src/languages/en.ts`, so a mistake in the English string ships to users and is carried into every translation. Two failures are mechanical to spot in a diff of that file. A grammar or spelling error reads as careless in the product. Title Case breaks the Expensify convention of capitalizing only the first word of a header, label, button or menu item, proper nouns and product names excepted, and once one Title Case entry lands the next contributor copies it.
11+
12+
### Incorrect
13+
14+
```ts
15+
// src/languages/en.ts
16+
export default {
17+
workspace: {
18+
inviteMessage: 'Invite a new members to you workspace',
19+
editCard: 'Edit Card Details',
20+
saveButton: 'Save Changes',
21+
},
22+
};
23+
```
24+
25+
### Correct
26+
27+
```ts
28+
// src/languages/en.ts
29+
export default {
30+
workspace: {
31+
inviteMessage: 'Invite new members to your workspace',
32+
editCard: 'Edit card details',
33+
saveButton: 'Save changes',
34+
},
35+
};
36+
```
37+
38+
---
39+
40+
### Review Metadata
41+
42+
Flag ONLY when BOTH of these are true:
43+
44+
- The changed code adds or edits a user-visible string in `src/languages/en.ts`
45+
- The string has at least one of these problems:
46+
- A clear grammar or spelling error: wrong agreement, a wrong or missing word, a misspelling, a wrong homophone (`you`/`your`, `its`/`it's`)
47+
- A word after the first is capitalized, and it is not a proper noun, product name, acronym, or interpolated variable
48+
49+
**DO NOT flag if:**
50+
51+
- The capitalized words are proper nouns or product names (`Expensify Card`, `QuickBooks Online`, `NetSuite`, `New Expensify`)
52+
- The string is an acronym or initialism (`VBA`, `ACH`, `SSO`)
53+
- The wording is grammatical and the concern is only style, tone, or a phrasing preference
54+
- A label, button or menu item is a terse fragment by design (`Save`, `Add expense`), which is not a grammar error
55+
- The copy comes verbatim from Figma or has marketing approval. The reviewer confirms that, and it overrides this rule
56+
- The string is in a non-English language file. Those are generated from `en.ts`
57+
- The string is not user-visible (log lines, test fixtures, keys, error codes)
58+
59+
**Search Patterns** (hints for reviewers):
60+
- added or changed string literals in `src/languages/en.ts`
61+
- `: '[A-Z][a-z]+ [A-Z]` (a second capitalized word in a quoted string)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
ruleId: CONSISTENCY-20
3+
title: Name functions with a verb that says what they do
4+
---
5+
6+
## [CONSISTENCY-20] Name functions with a verb that says what they do
7+
8+
### Reasoning
9+
10+
A function name that starts with a verb tells the caller what the function does without a trip to its body. A name made only of nouns or adjectives, such as `reportTotal`, reads as a value, so the reader cannot tell that the function computes something or what it returns.
11+
12+
### Incorrect
13+
14+
```ts
15+
function reportTotal(transactions: Transaction[]): number {
16+
// ...
17+
}
18+
```
19+
20+
### Correct
21+
22+
```ts
23+
function getReportTotal(transactions: Transaction[]): number {
24+
// ...
25+
}
26+
```
27+
28+
---
29+
30+
### Review Metadata
31+
32+
Flag ONLY when ALL of these are true:
33+
34+
- The changed code **declares** a new or renamed function (a function declaration, or an arrow function or function expression assigned to a `const`/`let`)
35+
- The name does not start with a verb, so it reads as a value rather than an action (e.g. `reportTotal`, `policyMembers`)
36+
37+
**DO NOT flag if:**
38+
39+
- The function is a React component, a higher-order component (`withX`), or a hook (`useX`)
40+
- The function is an Onyx selector, which ends in `Selector` by convention (e.g. `isQBORefreshTokenExpiringSoonSelector`)
41+
- The function is a conversion that follows the `toX()` / `fromX()` idiom (e.g. `toSafeReturnPath`)
42+
- The name starts with `on` or `handle`, which [CONSISTENCY-12](consistency-12-callback-named-for-action.md) covers
43+
- A parent class, an interface, a library, or another external contract sets the name
44+
- The function already exists and the PR does not rename it
45+
- The file is a test or story
46+
47+
**Search Patterns** (hints for reviewers):
48+
- `function [a-z]` / `const [a-z][A-Za-z]* = (` / `const [a-z][A-Za-z]* = async (`
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
ruleId: UI-4
3+
title: Type and responsive insets come from tokens
4+
---
5+
6+
## [UI-4] Type and responsive insets come from tokens
7+
8+
### Reasoning
9+
10+
Per `STYLING.md`, font sizes come from `<Text variant="...">` and paddings or margins that differ between narrow and wide layouts come from `useLayoutSpacing()`. Writing `shouldUseNarrowLayout ? styles.ph5 : styles.ph8` decides the card inset at the call site, so every card row has to agree by hand and a design change means editing dozens of files. `rulesdir/no-raw-typography` and `rulesdir/no-layout-spacing-conditional` enforce both.
11+
12+
### Incorrect
13+
14+
```tsx
15+
function CardRow() {
16+
const {shouldUseNarrowLayout} = useResponsiveLayout();
17+
return (
18+
<View style={[styles.flexRow, shouldUseNarrowLayout ? styles.ph5 : styles.ph8]}>
19+
<Text style={{fontSize: 15}}>Title</Text>
20+
</View>
21+
);
22+
}
23+
```
24+
25+
### Correct
26+
27+
```tsx
28+
function CardRow() {
29+
const {cardPaddingHorizontal} = useLayoutSpacing();
30+
return (
31+
<View style={[styles.flexRow, cardPaddingHorizontal]}>
32+
<Text variant="textStrong">Title</Text>
33+
</View>
34+
);
35+
}
36+
```
37+
38+
See `useLayoutSpacing`'s implementation for available options. Tokens live in `src/styles/layoutSpacing.ts`; add a new one there rather than writing a ternary.
39+
40+
---
41+
42+
### Review Metadata
43+
44+
Flag ONLY when ALL of these are true:
45+
46+
- The changed code picks a horizontal inset helper by layout flag where the pair spells the card padding values (the `5` step narrow, the `8` step wide, e.g. `styles.ph5 : styles.ph8`, `styles.mhn5 : styles.mhn8`), or sets a raw `fontSize` / `lineHeight`
47+
- A matching token exists (`cardPadding*`, `pageGutter*`, or a `Text` variant)
48+
49+
**DO NOT flag if:**
50+
51+
- The conditional picks vertical spacing only (`pt`, `pb`, `pv`, `mt`, `mb`, `mv`, `gap`)
52+
- The values are not a card inset or page gutter and no token exists yet (suggest adding one instead)
53+
- The code is inside `src/styles/`
54+
55+
**Search Patterns** (hints for reviewers):
56+
- `shouldUseNarrowLayout ? styles.p`
57+
- `shouldUseNarrowLayout ? styles.m`
58+
- `isSmallScreenWidth ? styles.p`
59+
- `fontSize:`
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
ruleId: UI-5
3+
title: Reuse an existing style or StyleUtils helper instead of adding a new one
4+
---
5+
6+
## [UI-5] Reuse an existing style or StyleUtils helper instead of adding a new one
7+
8+
### Reasoning
9+
10+
Per `STYLING.md`, styles belong to the shared style system. Before a new entry is added to `src/styles`, the equivalent usually already exists - either as a utility style (spacing, flex, text) or as a `StyleUtils` function in `src/styles/utils/index.ts` (e.g. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`). A duplicate style is invisible to the next contributor, drifts from the original when one copy is updated, and bypasses theming when it hardcodes what a helper derives.
11+
12+
### Incorrect
13+
14+
```ts
15+
// src/styles/index.ts
16+
const styles = {
17+
myCardWrapper: {
18+
backgroundColor: theme.componentBG,
19+
borderColor: theme.componentBG,
20+
padding: 8,
21+
},
22+
};
23+
```
24+
25+
### Correct
26+
27+
```tsx
28+
function Card() {
29+
return <View style={[StyleUtils.getBackgroundAndBorderStyle(theme.componentBG), styles.p2]} />;
30+
}
31+
```
32+
33+
---
34+
35+
### Review Metadata
36+
37+
Flag ONLY when ALL of these are true:
38+
39+
- The changed code adds a new named style to `src/styles` (or a local style object built in a component)
40+
- An equivalent already exists in `src/styles`, or the same shape can be produced by an existing `StyleUtils` function
41+
- Swapping in the existing style or helper renders identically: every property the new style sets comes out with the same value
42+
43+
**DO NOT flag if:**
44+
45+
- No existing style or `StyleUtils` helper produces the same result, and the new style is genuinely novel
46+
- Swapping in the closest helper would change how the style renders (for example `getBackgroundAndBorderStyle` paints the border in the background color and sets no `borderWidth`, so it cannot replace a style with a separate border color or width)
47+
- The style is a one-off override required by a third-party component's API
48+
- The new entry is itself a `StyleUtils` function intended for reuse
49+
- The code is a test or story
50+
51+
**Search Patterns** (hints for reviewers):
52+
- added keys in `src/styles/index.ts` / `src/styles/utils/`
53+
- `backgroundColor:` and `borderColor:` set to the same value (`getBackgroundAndBorderStyle`)
54+
- `padding:` / `margin:` / `flex:` numeric literals in a new style object

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,9 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
8686
- [ ] iOS: mWeb Safari
8787
- [ ] MacOS: Chrome / Safari
8888
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
89-
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
90-
- [ ] I verified that comments were added to code that is not self explanatory
91-
- [ ] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
92-
- [ ] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
89+
- [ ] I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
9390
- [ ] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
94-
- [ ] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
9591
- [ ] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
96-
- [ ] If a new CSS style is added I verified that:
97-
- [ ] A similar style doesn't already exist
98-
- [ ] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
9992
- [ ] If new assets were added or existing ones were modified, I verified that:
10093
- [ ] The assets are optimized and compressed (for SVG files, run `npm run compress-svg`)
10194
- [ ] The assets load correctly across all supported platforms.

0 commit comments

Comments
 (0)