Repository navigation
Trim CLAUDE.md of code-derivable content - #98560
roryabraham merged 22 commits into
Conversation
kacper-mikolajczak
left a comment
There was a problem hiding this comment.
LGTM 🎉
Leaving a few comments to spark the discussion, not neccessarily to request a change.
| **ALWAYS run these steps after making code changes, before committing:** | ||
|
|
||
| 1. **ESLint**: Run `npm run lint-changed` to catch lint errors early. | ||
| 2. **TypeScript**: Run `npm run typecheck-tsgo` after changes that may affect typing (types, interfaces, or function signatures). It is ~10x faster and usually stricter than tsc. CI validates with `npm run typecheck` (tsc), which remains the required merge gate. | ||
| 3. **React Compiler**: If you added new React components/hooks or modified existing ones, run `npm run react-compiler-compliance-check check-changed` to verify they compile with React Compiler. This applies the same rules as CI, evaluated against BOTH the Babel and OXC compilers: new components/hooks must compile, existing compiled files must not regress, and changes must not introduce new memoization divergence (one compiler memoizing a file while the other does not). See `contributingGuides/REACT_COMPILER.md` for details and common fixes. | ||
|
|
||
| ### Testing | ||
|
|
||
| - **Unit Tests**: Jest with React Native Testing Library | ||
| - **Performance Tests**: Reassure framework | ||
| 1. **Oxfmt**: Run `npm run fmt` on every file you modified. This is mandatory - CI will reject unformatted code. | ||
| 2. **ESLint**: Run `npm run lint-changed` to catch lint errors early. | ||
| 3. **TypeScript**: Run `npm run typecheck-tsgo` after changes that may affect typing (types, interfaces, or function signatures). It is ~10x faster and usually stricter than tsc. CI validates with `npm run typecheck` (tsc), which remains the required merge gate. | ||
| 4. **React Compiler**: If you added new React components/hooks or modified existing ones, run `npm run react-compiler-compliance-check check-changed` to verify they compile with React Compiler. This applies the same rules as CI, evaluated against BOTH the Babel and OXC compilers: new components/hooks must compile, existing compiled files must not regress, and changes must not introduce new memoization divergence (one compiler memoizing a file while the other does not). See `contributingGuides/REACT_COMPILER.md` for details and common fixes. |
There was a problem hiding this comment.
If they are required 'always', possibly could be turned into a hook on push, but I doubt we want to go full-husky way - it depends on how impactful it is for devs. What do you think?
There was a problem hiding this comment.
The fmt is already in the PostToolUse hook. It's the biggest value, imo. Not sure what to do with the rest.
I agree that we may lack a universal /check before pushing. That could prevent some obvious mistakes
There was a problem hiding this comment.
Isn't it lacking parity for mobile?
There was a problem hiding this comment.
What would you add here? There is some information in the Mobile Device Testing section, and there is a separate CLADUE.md inside Mobile-Expensify
There was a problem hiding this comment.
TBH, I would remove it as we have done for other general project commands.
For the parity to be met, referencing npm run <platform> - but as said above, does not look like we really need it altogether.
There was a problem hiding this comment.
I thought that URL information https://dev.new.expensify.com:8082/ may be useful, but the same information is in the playwright-app-testing skill.
I will remove this section
### Dev Server
- **Location**: Runs on HOST machine (not in VM)
- **URL**: `https://dev.new.expensify.com:8082/`
- **Start command**: `npm run web`
- **VM is only for**: Backend services (Auth, Bedrock, Integration-Server, Web-Expensify)
|
|
||
| ### Post-Edit Checklist (IMPORTANT) | ||
|
|
||
| **ALWAYS run these steps after making code changes, before committing:** |
There was a problem hiding this comment.
suggestion: Create a single validate.sh script that runs all of these and produces very condensed output of what failed. Tell claude to just run scripts/validate.sh
We're also missing cspell here.
There was a problem hiding this comment.
I will add cspell here.
The tsgo is much longer, 16s, than other checks 1-3s
I wonder if it's worth bundling them together
However, I think there is some room for improvement to organise our local checks and integration with agents, but I would think about it later after merging this PR to avoid merge conflicts.
| @@ -323,39 +123,3 @@ | |||
| ### Mobile Device Testing | |||
|
|
|||
| Use the `/agent-device` skill to drive the App on iOS and Android (simulators or real devices) for interactive testing, performance profiling, bug reproduction, and device-specific debugging. Requires `npm install -g agent-device` - the skill's pre-flight check will surface the install instruction if missing. | |||
There was a problem hiding this comment.
Why don't we add agent-device as a dev dependency then trim this from here and the skill?
| Use the `/agent-device` skill to drive the App on iOS and Android (simulators or real devices) for interactive testing, performance profiling, bug reproduction, and device-specific debugging. Requires `npm install -g agent-device` - the skill's pre-flight check will surface the install instruction if missing. | |
| Use the `/agent-device` skill to drive the App on iOS and Android (simulators or real devices) for interactive testing, performance profiling, bug reproduction, and device-specific debugging. |
There was a problem hiding this comment.
Maybe we can just remove this part since there is a pre-flight check.
About adding it to the dependency. Not sure what the percentage of people is who actually use an agent-device. The pre-flight check in the skill will install it for people that needs it.
There was a problem hiding this comment.
I agree with the concern of yours @roryabraham. However declaring agent-device as devDeps does not make it executable and we'd need still to make it such (which is now resolved via global installation).
Correct me if I am wrong but, devs would need to add its binaries to the path pointing to node_modules or we would need to add it as a script in package.json.
With that said, I agree with @adamgrzybowski that we already reference the skill which instructions surface the installation caveat - for me +1 to applying Rory's suggestion, unless you see other cool alternative 🤞
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
…ove-agent-setup # Conflicts: # CLAUDE.md
…ove-agent-setup # Conflicts: # Mobile-Expensify
|
Thanks for the comments, @roryabraham and @kacper-mikolajczak. I think all comments should be addressed FYI, this was my last day before vacation. I’ll be back on September 1st. If you need anything, @mateuuszzzzz will be there to help push this PR forward |
…ove-agent-setup # Conflicts: # Mobile-Expensify
|
@carlosmiceli Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26fac67905
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| React Compiler auto-memoizes object literals, callbacks, JSX, and derived values inside components and hooks (excluding `tests/`). Two different compilers run it: `babel-plugin-react-compiler` on native/Jest (see `babel.config.js`) and `oxc-transform-react` on web (see `config/rsbuild/`). They do not always agree, so a file can be memoized on one platform but not the other. The compliance check and the ESLint processor both run BOTH compilers via the shared helpers in `config/reactCompiler/` and only relax manual-memoization rules when both compilers memoize the file. | ||
| React Compiler auto-memoizes code in components and hooks (excluding `tests/`). Two different compilers run it: `babel-plugin-react-compiler` on native/Jest (see `babel.config.js`) and `oxc-transform-react` on web (see `config/rsbuild/`). They do not behave identically. The compliance check and the ESLint processor run BOTH compilers via the shared helpers in `config/reactCompiler/` and only relax manual-memoization rules when both compilers memoize the file. | ||
|
|
||
| Do not use `useMemo`, `useCallback`, or `React.memo` in components or hooks that compile with React Compiler. |
There was a problem hiding this comment.
Limit the memoization ban to files memoized by both compilers
When only one compiler memoizes a component or hook, this blanket prohibition tells agents not to add the manual memoization needed on the other platform. contributingGuides/REACT_COMPILER.md lines 40-44 explicitly prescribe useMemo/useCallback to resolve compiler divergence, and config/eslint/processors/eslint-processor-react-compiler-compat.mjs lines 8-17 preserves the corresponding lint messages unless both compilers memoize the file. Qualify this rule so it applies only when both compilers successfully memoize the file.
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.59-0 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.59-5 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
CLAUDE.md(the Claude Code project instruction file loaded into context at the start of every session) of content the agent can easily derive from the codebase or doesn't need, following Anthropic's context-engineering guidelines.Fixed Issues
$ #98570
PROPOSAL:
Tests
Offline tests
QA Steps
No QA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — documentation-only change (
CLAUDE.md), no app behavior affected.Android: mWeb Chrome
N/A — documentation-only change (
CLAUDE.md), no app behavior affected.iOS: Native
N/A — documentation-only change (
CLAUDE.md), no app behavior affected.iOS: mWeb Safari
N/A — documentation-only change (
CLAUDE.md), no app behavior affected.MacOS: Chrome / Safari
N/A — documentation-only change (
CLAUDE.md), no app behavior affected.