Skip to content

fix(FR-2829): move relay:watch to root and fix schema watch paths#7278

Merged
graphite-app[bot] merged 1 commit into
mainfrom
05-07-fix_fr-2829_move_relay_watch_to_root_and_fix_schema_watch_paths
May 8, 2026
Merged

fix(FR-2829): move relay:watch to root and fix schema watch paths#7278
graphite-app[bot] merged 1 commit into
mainfrom
05-07-fix_fr-2829_move_relay_watch_to_root_and_fix_schema_watch_paths

Conversation

@nowgnuesLee
Copy link
Copy Markdown
Contributor

@nowgnuesLee nowgnuesLee commented May 7, 2026

Resolves #7277(FR-2829)

Why

react/package.json's relay:watch script tells nodemon to watch schema.graphql and client-directives.graphql relative to the script's cwd (react/). The actual schema files live at data/schema.graphql and data/client-directives.graphql (project root). react/schema.graphql does not exist, so nodemon silently watched nothing — relay-compiler was never restarted on schema changes, and the merge side-effect in relay-base.config.js (which writes data/merged_schema.graphql) never re-ran. The compiler kept validating against a stale merged schema.

What

  • Add a working relay:watch script at the root package.json that watches the real data/*.graphql paths and dispatches into the react workspace via pnpm run --prefix ./react relay --watch.
  • Add nodemon as a root devDependency (it was previously only in react/). The script needs nodemon to resolve from the root cwd; using pnpm --filter ./react exec nodemon was rejected because it would shift cwd back into react/ and reintroduce the same path bug.
  • Update scripts/dev.mjs:60 to call the new root script instead of cd react && pnpm run relay:watch.
  • Delete the now-redundant relay:watch script and the nodemon devDep from react/package.json so there is exactly one place that owns the watch behavior. The script and the dep were the only two nodemon references in the workspace.
  • relay-base.config.js is intentionally untouched — the merge side-effect there is correct; only the watch wiring was broken.

Review feedback applied

  • Lockfile sync (must-fix from @nowgnuesLee): regenerated pnpm-lock.05-07-fix_fr-2829_*.yaml (per-branch lockfile, project convention via gitBranchLockfile: true + weekly merge workflow). nodemon now resolves from the root .: importer, removed from the react: importer. Diff is the nodemon move only — no unrelated dependency hash drift.
  • README update (should-fix from Copilot/@nowgnuesLee): updated README.md:234 Commands Reference from cd react && pnpm run relay:watch to pnpm run relay:watch. AGENTS.md:147 was already correct.
  • --prefix consistency (nit from Copilot/@nowgnuesLee): switched the inner dispatch from pnpm --filter ./react run relay --watch to pnpm run --prefix ./react relay --watch to match the rest of the repo (package.json:23, package.json:120, scripts/dev.mjs:61). cwd stays at root for nodemon's watch resolution; only the inner pnpm run is dispatched into react/. Re-ran the smoke test below — still works.

Follow-up simplification

  • Removed the vestigial pnpm --prefix ./react dispatch in relay:watch. Root relay.config.js already defines both react and backend.ai-ui as projects (sources maps both react/src and packages/backend.ai-ui/src), so pnpm run relay --watch from root compiles both projects in a single relay-compiler invocation. The --prefix ./react hop added a cwd change with no functional effect — relay-compiler is config-driven, not cwd-driven, and walks up to the same root relay.config.js either way. Verified via smoke test that both react/src/__generated__/ and packages/backend.ai-ui/src/__generated__/ remain in sync after schema changes.

Test plan

Verification harness:

  • bash scripts/verify.sh — Relay/Lint/Format PASS. TypeScript fails with the same set of pre-existing errors that fail on main (packages/backend.ai-client/src/client.ts implicit-any errors, DeleteForeverVFolderModalV2.tsx BulkPurgeVFoldersV2Input mismatch); confirmed by stashing this PR's changes and re-running on clean main. Unrelated to this change.

Smoke test (the load-bearing one):

  • pnpm run relay:watch starts successfully and logs watching path(s): data/schema.graphql data/client-directives.graphql (correct paths now, not schema.graphql resolving to nowhere).
  • Initial relay-compiler output mentions both projects: [backend.ai-ui] compiling... and [react] compiling..., followed by per-project compiled documents lines (100/66/92 for backend.ai-ui, 414/262/448 for react).
  • touch data/schema.graphql triggers [nodemon] restarting due to changes... and a fresh relay-compiler cycle that again mentions both projects.
  • data/merged_schema.graphql's mtime updates after the touch — proving relay-base.config.js's schema-merge side-effect actually re-runs on schema changes (the original bug).
  • (Recommend reviewer) pnpm run dev end-to-end: confirm the react-relay concurrently pane starts via the root script and behaves the same as before, just with working schema watching.

Copilot AI review requested due to automatic review settings May 7, 2026 06:34
@github-actions github-actions Bot added the size:XS ~10 LoC label May 7, 2026
Copy link
Copy Markdown
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Coverage Report for root-coverage

Status Category Percentage Covered / Total
🔵 Lines 4.77% 28 / 586
🔵 Statements 5.14% 32 / 622
🔵 Functions 7.89% 6 / 76
🔵 Branches 4.98% 18 / 361
File CoverageNo changed files found.
Generated in workflow #473 for commit fc0b319 by the Vitest Coverage Report Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Coverage Report for react-coverage (./react)

Status Category Percentage Covered / Total
🔵 Lines 6.5% 1783 / 27402
🔵 Statements 5.37% 1978 / 36784
🔵 Functions 5.19% 296 / 5699
🔵 Branches 3.77% 1293 / 34255
File CoverageNo changed files found.
Generated in workflow #473 for commit fc0b319 by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Moves Relay watch mode orchestration to the monorepo root so the dev script no longer needs to cd react, and updates watch paths to track the schema files under /data.

Changes:

  • Updated scripts/dev.mjs to run pnpm run relay:watch from the repo root.
  • Removed relay:watch (and nodemon) from react/package.json.
  • Added a new root-level relay:watch script using nodemon to restart Relay when schema/directives change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
scripts/dev.mjs Switches dev concurrently command from cd react && ... to root-level pnpm run relay:watch.
react/package.json Removes the React-package-local relay:watch script and nodemon devDependency.
package.json Adds root relay:watch script with corrected watch paths and adds nodemon to devDependencies.

Comment thread package.json
Comment thread package.json Outdated
Comment thread scripts/dev.mjs
Comment thread package.json
Comment thread package.json Outdated
Comment thread react/package.json
@nowgnuesLee nowgnuesLee force-pushed the 05-07-fix_fr-2829_move_relay_watch_to_root_and_fix_schema_watch_paths branch from 6584fb5 to 0d99eea Compare May 7, 2026 06:47
@nowgnuesLee nowgnuesLee force-pushed the 05-07-fix_fr-2829_move_relay_watch_to_root_and_fix_schema_watch_paths branch from 0d99eea to 1624c5d Compare May 7, 2026 07:22
@nowgnuesLee
Copy link
Copy Markdown
Contributor Author

Follow-up simplification (commit 1624c5d): dropped the pnpm --prefix ./react dispatch in relay:watch. Root relay.config.js already lists both react and backend.ai-ui as projects, so running relay-compiler from the project root compiles both. Smoke test re-verified that both react/src/__generated__/ and packages/backend.ai-ui/src/__generated__/ are still touched on schema changes, and nodemon still picks up data/*.graphql correctly.

@nowgnuesLee nowgnuesLee requested a review from yomybaby May 8, 2026 08:14
Copy link
Copy Markdown
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

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

LGTM

@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 8, 2026

Merge activity

)

Resolves #7277(FR-2829)

## Why

`react/package.json`'s `relay:watch` script tells nodemon to watch `schema.graphql` and `client-directives.graphql` *relative to the script's cwd* (`react/`). The actual schema files live at `data/schema.graphql` and `data/client-directives.graphql` (project root). `react/schema.graphql` does not exist, so nodemon silently watched nothing — `relay-compiler` was never restarted on schema changes, and the merge side-effect in `relay-base.config.js` (which writes `data/merged_schema.graphql`) never re-ran. The compiler kept validating against a stale merged schema.

## What

- Add a working `relay:watch` script at the root `package.json` that watches the real `data/*.graphql` paths and dispatches into the react workspace via `pnpm run --prefix ./react relay --watch`.
- Add `nodemon` as a root `devDependency` (it was previously only in `react/`). The script needs `nodemon` to resolve from the root cwd; using `pnpm --filter ./react exec nodemon` was rejected because it would shift cwd back into `react/` and reintroduce the same path bug.
- Update `scripts/dev.mjs:60` to call the new root script instead of `cd react && pnpm run relay:watch`.
- Delete the now-redundant `relay:watch` script and the `nodemon` devDep from `react/package.json` so there is exactly one place that owns the watch behavior. The script and the dep were the only two `nodemon` references in the workspace.
- `relay-base.config.js` is intentionally untouched — the merge side-effect there is correct; only the watch wiring was broken.

## Review feedback applied

- **Lockfile sync (must-fix from @nowgnuesLee)**: regenerated `pnpm-lock.05-07-fix_fr-2829_*.yaml` (per-branch lockfile, project convention via `gitBranchLockfile: true` + weekly merge workflow). nodemon now resolves from the root `.:` importer, removed from the `react:` importer. Diff is the nodemon move only — no unrelated dependency hash drift.
- **README update (should-fix from Copilot/@nowgnuesLee)**: updated `README.md:234` Commands Reference from `cd react && pnpm run relay:watch` to `pnpm run relay:watch`. `AGENTS.md:147` was already correct.
- **`--prefix` consistency (nit from Copilot/@nowgnuesLee)**: switched the inner dispatch from `pnpm --filter ./react run relay --watch` to `pnpm run --prefix ./react relay --watch` to match the rest of the repo (`package.json:23`, `package.json:120`, `scripts/dev.mjs:61`). cwd stays at root for nodemon's watch resolution; only the inner `pnpm run` is dispatched into `react/`. Re-ran the smoke test below — still works.

## Follow-up simplification

- Removed the vestigial `pnpm --prefix ./react` dispatch in `relay:watch`. Root `relay.config.js` already defines both `react` and `backend.ai-ui` as projects (`sources` maps both `react/src` and `packages/backend.ai-ui/src`), so `pnpm run relay --watch` from root compiles **both** projects in a single relay-compiler invocation. The `--prefix ./react` hop added a cwd change with no functional effect — relay-compiler is config-driven, not cwd-driven, and walks up to the same root `relay.config.js` either way. Verified via smoke test that both `react/src/__generated__/` and `packages/backend.ai-ui/src/__generated__/` remain in sync after schema changes.

## Test plan

Verification harness:
- [x] `bash scripts/verify.sh` — Relay/Lint/Format **PASS**. TypeScript fails with the same set of pre-existing errors that fail on `main` (`packages/backend.ai-client/src/client.ts` implicit-any errors, `DeleteForeverVFolderModalV2.tsx` `BulkPurgeVFoldersV2Input` mismatch); confirmed by stashing this PR's changes and re-running on clean main. Unrelated to this change.

Smoke test (the load-bearing one):
- [x] `pnpm run relay:watch` starts successfully and logs `watching path(s): data/schema.graphql data/client-directives.graphql` (correct paths now, not `schema.graphql` resolving to nowhere).
- [x] Initial relay-compiler output mentions **both** projects: `[backend.ai-ui] compiling...` and `[react] compiling...`, followed by per-project `compiled documents` lines (100/66/92 for backend.ai-ui, 414/262/448 for react).
- [x] `touch data/schema.graphql` triggers `[nodemon] restarting due to changes...` and a fresh `relay-compiler` cycle that again mentions both projects.
- [x] `data/merged_schema.graphql`'s mtime updates after the touch — proving `relay-base.config.js`'s schema-merge side-effect actually re-runs on schema changes (the original bug).
- [ ] (Recommend reviewer) `pnpm run dev` end-to-end: confirm the `react-relay` concurrently pane starts via the root script and behaves the same as before, just with working schema watching.
@graphite-app graphite-app Bot force-pushed the 05-07-fix_fr-2829_move_relay_watch_to_root_and_fix_schema_watch_paths branch from 1624c5d to fc0b319 Compare May 8, 2026 08:30
@graphite-app graphite-app Bot merged commit fc0b319 into main May 8, 2026
12 checks passed
@graphite-app graphite-app Bot deleted the 05-07-fix_fr-2829_move_relay_watch_to_root_and_fix_schema_watch_paths branch May 8, 2026 08:32
@github-pages github-pages Bot temporarily deployed to github-pages May 8, 2026 08:33 Inactive
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.

Move relay:watch to root package.json and use it in dev.mjs (fix broken schema watch paths)

3 participants