Skip to content

feat: add limit option for error/warning display in publish command#2634

Merged
JivusAyrus merged 10 commits intomainfrom
suvij/limt-the-errors-listed-on-publish-schema
Mar 12, 2026
Merged

feat: add limit option for error/warning display in publish command#2634
JivusAyrus merged 10 commits intomainfrom
suvij/limt-the-errors-listed-on-publish-schema

Conversation

@JivusAyrus
Copy link
Copy Markdown
Member

@JivusAyrus JivusAyrus commented Mar 11, 2026

Summary by CodeRabbit

  • New Features

    • Added a -l, --limit option to cap displayed composition errors, warnings, and deployment errors.
    • Publish responses now include total counts for composition errors, composition warnings, and deployment errors.
    • Truncation warnings shown when displayed items are fewer than the totals.
  • Tests

    • Expanded tests covering truncation warnings, counts accuracy, limit behavior, and fail/suppress interactions.
    • Test config adjusted to auto-restore mocks between tests.

Checklist

COMPLETES ENG-9168

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 11, 2026

Router-nonroot image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-9e82fcca0f31ae04f7396dfc09cc9fa626b2cd69-nonroot

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 90.54054% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.90%. Comparing base (fbbd11f) to head (a6b99ac).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cli/src/commands/subgraph/commands/publish.ts 92.98% 4 Missing ⚠️
...e/bufservices/subgraph/publishFederatedSubgraph.ts 82.35% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2634       +/-   ##
===========================================
- Coverage   62.90%   39.90%   -23.00%     
===========================================
  Files         244      969      +725     
  Lines       25826   121820    +95994     
  Branches        0     5469     +5469     
===========================================
+ Hits        16245    48609    +32364     
- Misses       8209    71517    +63308     
- Partials     1372     1694      +322     
Files with missing lines Coverage Δ
...e/bufservices/subgraph/publishFederatedSubgraph.ts 89.67% <82.35%> (ø)
cli/src/commands/subgraph/commands/publish.ts 87.40% <92.98%> (ø)

... and 746 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a numeric limit to PublishFederatedSubgraph requests, returns a counts summary in responses, server-side truncates returned composition/deployment lists to the limit, CLI accepts -l/--limit and prints truncation warnings, and tests updated to assert counts and truncation behavior.

Changes

Cohort / File(s) Summary
Protocol / Generated Protos
proto/wg/cosmo/platform/v1/platform.proto, connect/src/wg/cosmo/platform/v1/platform_pb.ts
Added limit (int32) to PublishFederatedSubgraphRequest, introduced SubgraphPublishStats message, and added optional counts to PublishFederatedSubgraphResponse with generated typings.
Backend service
controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts
Apply a clamped req.limit to truncate returned compositionErrors/compositionWarnings/deploymentErrors in all response paths and add a top-level counts object reflecting total (untruncated) counts.
CLI command
cli/src/commands/subgraph/commands/publish.ts
Added CLI option -l, --limit <number> and wired limit into the publish payload; CLI prints truncation warnings when returned lists are truncated.
CLI tests
cli/test/publish-schema.test.ts, cli/test/check-schema.test.ts, cli/vite.config.ts
Added test scaffolding and mocks for publish responses, new truncation warning tests, adjusted schemaPath usage, removed manual mock restores and enabled restoreMocks: true in Vitest config.
Controlplane tests
controlplane/test/subgraph/publish-subgraph.test.ts
Added tests asserting presence/values of counts, verifying counts reflect total errors/warnings and that limit truncates returned lists while counts remain accurate.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and specifically describes the main change: adding a limit option to control error/warning display in the publish command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cli/src/commands/subgraph/commands/publish.ts (1)

110-144: ⚠️ Potential issue | 🟠 Major

Make --limit require an integer value.

With [number], Commander.js treats this as an optional option-argument that can accept no value and become true. Since Number(true) evaluates to 1, --limit without an argument silently defaults to 1 instead of the provided default of 50. Additionally, the current validation accepts decimal numbers like 1.5 even though the value is sent as int32. Change to <number> to require a value, and add !Number.isInteger(limit) to reject non-integers.

Suggested fix
   command.option(
-    '-l, --limit [number]',
+    '-l, --limit <number>',
     'The maximum number of composition errors, warnings, and deployment errors to display.',
-    '50'
+    '50',
   );
@@
-    if (Number.isNaN(limit) || limit <= 0 || limit > limitMaxValue) {
+    if (!Number.isInteger(limit) || limit <= 0 || limit > limitMaxValue) {
       program.error(
         pc.red(`The limit must be a valid number between 1 and ${limitMaxValue}. Received: '${options.limit}'`),
       );
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/src/commands/subgraph/commands/publish.ts` around lines 110 - 144, Change
the Commander option definition for limit from an optional argument to a
required numeric argument by replacing '[number]' with '<number>' in the
command.option call that defines '-l, --limit'; then, in the publish command
action where you parse and validate the limit (the const limit =
Number(options.limit) block), add an additional check rejecting non-integer
values by including !Number.isInteger(limit) alongside the existing NaN/range
checks so decimals like 1.5 or a bare `--limit` (which currently becomes true)
are rejected.
🧹 Nitpick comments (1)
cli/test/publish-schema.test.ts (1)

25-50: Add one test that exercises --limit itself.

This helper never appends --limit, so the new cases only verify how the command formats an already-truncated response. A regression in CLI parsing/validation or request wiring for the new flag would still pass here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/test/publish-schema.test.ts` around lines 25 - 50, The test helper
runPublish never appends the new --limit flag, so tests that intend to exercise
the CLI's limit parsing only validate handling of truncated responses; update
runPublish to accept an optional limit (e.g., add failOnCompositionError?:
boolean; failOnAdmissionWebhookError?: boolean; suppressWarnings?: boolean;
limit?: number) and when opts.limit is provided push both '--limit' and
String(opts.limit) onto the args array before creating the mock client and
invoking program.parseAsync; reference the runPublish function and the args
array so tests can pass limit to exercise real CLI flag wiring.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli/src/commands/subgraph/commands/publish.ts`:
- Around line 225-230: The truncation warning is using raw response lengths
(resp.compositionErrors.length, etc.) which can misreport items that were
suppressed/not actually rendered; update the three calls to
printTruncationWarning (the one guarded by options.failOnCompositionError and
the other two around lines ~262-266 and ~306-310) to pass a computed
displayedCounts object instead of raw resp counts—compute displayedCounts from
the same branches/flags that control actual output (e.g., respect
--suppress-warnings, whichTable/printing branches, and the program.error paths
that short-circuit printing) so the numbers reflect only items that were
actually rendered, then call printTruncationWarning(displayedCounts, {...}) in
each place.

---

Outside diff comments:
In `@cli/src/commands/subgraph/commands/publish.ts`:
- Around line 110-144: Change the Commander option definition for limit from an
optional argument to a required numeric argument by replacing '[number]' with
'<number>' in the command.option call that defines '-l, --limit'; then, in the
publish command action where you parse and validate the limit (the const limit =
Number(options.limit) block), add an additional check rejecting non-integer
values by including !Number.isInteger(limit) alongside the existing NaN/range
checks so decimals like 1.5 or a bare `--limit` (which currently becomes true)
are rejected.

---

Nitpick comments:
In `@cli/test/publish-schema.test.ts`:
- Around line 25-50: The test helper runPublish never appends the new --limit
flag, so tests that intend to exercise the CLI's limit parsing only validate
handling of truncated responses; update runPublish to accept an optional limit
(e.g., add failOnCompositionError?: boolean; failOnAdmissionWebhookError?:
boolean; suppressWarnings?: boolean; limit?: number) and when opts.limit is
provided push both '--limit' and String(opts.limit) onto the args array before
creating the mock client and invoking program.parseAsync; reference the
runPublish function and the args array so tests can pass limit to exercise real
CLI flag wiring.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1652a1f6-9f34-44f1-9aca-62cf975156ab

📥 Commits

Reviewing files that changed from the base of the PR and between 0ea3e7d and 172d8df.

⛔ Files ignored due to path filters (1)
  • connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go is excluded by !**/*.pb.go, !**/gen/**
📒 Files selected for processing (5)
  • cli/src/commands/subgraph/commands/publish.ts
  • cli/test/publish-schema.test.ts
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts
  • controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts
  • proto/wg/cosmo/platform/v1/platform.proto

Comment thread cli/src/commands/subgraph/commands/publish.ts
Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
controlplane/test/subgraph/publish-subgraph.test.ts (1)

1369-1371: Prefer using Vitest's toBeGreaterThanOrEqual matcher for clearer assertions and better failure messages.

The current boolean comparison pattern works but produces less informative failure messages when tests fail.

♻️ Suggested improvement
       // When limit is 1, only 1 error should be returned but counts reflects the total
       expect(publishResp.compositionErrors.length).toBe(1);
       // The total count should be equal to or greater than what's returned
-      expect(publishResp.counts!.compositionErrors! >= publishResp.compositionErrors.length).toBe(true);
+      expect(publishResp.counts!.compositionErrors!).toBeGreaterThanOrEqual(publishResp.compositionErrors.length);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@controlplane/test/subgraph/publish-subgraph.test.ts` around lines 1369 -
1371, Replace the boolean comparison assertion with Vitest's clearer matcher:
update the assertion that currently checks
"expect(publishResp.counts!.compositionErrors! >=
publishResp.compositionErrors.length).toBe(true)" to use toBeGreaterThanOrEqual
so it reads as an explicit numeric comparison between
publishResp.counts!.compositionErrors! and publishResp.compositionErrors.length;
keep the existing first assertion for publishResp.compositionErrors.length and
only change the second to use
expect(publishResp.counts!.compositionErrors!).toBeGreaterThanOrEqual(publishResp.compositionErrors.length)
to improve failure messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@controlplane/test/subgraph/publish-subgraph.test.ts`:
- Around line 1369-1371: Replace the boolean comparison assertion with Vitest's
clearer matcher: update the assertion that currently checks
"expect(publishResp.counts!.compositionErrors! >=
publishResp.compositionErrors.length).toBe(true)" to use toBeGreaterThanOrEqual
so it reads as an explicit numeric comparison between
publishResp.counts!.compositionErrors! and publishResp.compositionErrors.length;
keep the existing first assertion for publishResp.compositionErrors.length and
only change the second to use
expect(publishResp.counts!.compositionErrors!).toBeGreaterThanOrEqual(publishResp.compositionErrors.length)
to improve failure messages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af8e4232-8737-402d-a4eb-614d44dfddf6

📥 Commits

Reviewing files that changed from the base of the PR and between 172d8df and 13fa314.

📒 Files selected for processing (2)
  • cli/src/commands/subgraph/commands/publish.ts
  • controlplane/test/subgraph/publish-subgraph.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • cli/src/commands/subgraph/commands/publish.ts

Comment thread connect/src/wg/cosmo/platform/v1/platform_pb.ts Outdated
Comment thread cli/test/publish-schema.test.ts Outdated
Comment thread cli/test/publish-schema.test.ts
Comment thread controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts Outdated
Comment thread controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts Outdated
Comment thread controlplane/test/subgraph/publish-subgraph.test.ts Outdated
Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli/src/commands/subgraph/commands/publish.ts`:
- Around line 110-114: The --limit option is defined as an optional value
('[number]') which allows boolean/float values; change the option signature to
required-value ('-l, --limit <number>') and ensure the parsed value is converted
to a Number and validated with Number.isInteger and the existing min/max checks
(the option is declared via command.option and later validated), rejecting
non-integers (e.g., fractional "3.5") and preserving the default 50 when absent;
update the parsing/validation logic that currently only checks isNaN/range to
also assert Number.isInteger(parsedLimit) and throw or exit with a clear error
if it fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5061365e-c7cc-4e1f-8a4c-e636e3323847

📥 Commits

Reviewing files that changed from the base of the PR and between 13fa314 and 354afa0.

⛔ Files ignored due to path filters (1)
  • connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go is excluded by !**/*.pb.go, !**/gen/**
📒 Files selected for processing (3)
  • cli/src/commands/subgraph/commands/publish.ts
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts
  • proto/wg/cosmo/platform/v1/platform.proto
🚧 Files skipped from review as they are similar to previous changes (1)
  • proto/wg/cosmo/platform/v1/platform.proto

Comment thread cli/src/commands/subgraph/commands/publish.ts
@comatory
Copy link
Copy Markdown
Contributor

We should probably document the --limit/-l flag in cosmo docs as well.

Copy link
Copy Markdown
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: 1

🧹 Nitpick comments (1)
controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts (1)

757-767: Consider the counts consistency in the composition error path.

When composition fails, counts.deploymentErrors reflects deploymentErrors.length from subgraphRepo.update(), but the response returns deploymentErrors: []. This is fine for backward compatibility, but clients may find it unexpected that counts.deploymentErrors could be non-zero while the returned deploymentErrors array is empty.

If this is intentional (showing total counts regardless of what's displayed), consider documenting this behavior. If counts should only reflect what's returned, then deploymentErrors: 0 would be more consistent here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts`
around lines 757 - 767, When returning early on composition failure in
publishFederatedSubgraph (the branch checking compositionErrors.length > 0),
ensure counts and the returned deploymentErrors are consistent: either set
counts.deploymentErrors = 0 before the return so it matches the returned
deploymentErrors: [] (preferred), or return the actual deploymentErrors array
from subgraphRepo.update() instead of an empty array; update the code that
computes or overrides counts (the variable named counts) in this branch to
reflect the chosen behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@controlplane/test/subgraph/publish-subgraph.test.ts`:
- Around line 1311-1371: The test currently doesn't verify that the limit
actually truncated results because the fixture might only produce one
composition error; update the assertion after the publishFederatedSubgraph call
(where publishResp is created) to ensure the total reported count is strictly
greater than the number of returned errors (e.g., assert
publishResp.counts!.compositionErrors! > publishResp.compositionErrors.length)
so the test fails if limit had no truncation effect; alternatively, if you
prefer to guarantee multiple errors from the fixture, expand the schema passed
to client.publishFederatedSubgraph for subgraphName2 to include multiple
conflicting definitions so publishResp.counts!.compositionErrors! > 1 and then
assert counts is greater than the returned compositionErrors length.

---

Nitpick comments:
In `@controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts`:
- Around line 757-767: When returning early on composition failure in
publishFederatedSubgraph (the branch checking compositionErrors.length > 0),
ensure counts and the returned deploymentErrors are consistent: either set
counts.deploymentErrors = 0 before the return so it matches the returned
deploymentErrors: [] (preferred), or return the actual deploymentErrors array
from subgraphRepo.update() instead of an empty array; update the code that
computes or overrides counts (the variable named counts) in this branch to
reflect the chosen behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1da8d43e-5fb7-4b4e-8a4d-f07e35b0319c

📥 Commits

Reviewing files that changed from the base of the PR and between 354afa0 and 4b81e4d.

📒 Files selected for processing (2)
  • controlplane/src/core/bufservices/subgraph/publishFederatedSubgraph.ts
  • controlplane/test/subgraph/publish-subgraph.test.ts

Comment thread controlplane/test/subgraph/publish-subgraph.test.ts Outdated
Copy link
Copy Markdown
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.

🧹 Nitpick comments (3)
cli/test/publish-schema.test.ts (2)

250-270: Test could also verify no warning truncation message is shown.

The test verifies the warnings table isn't displayed when --suppress-warnings is set, but it doesn't explicitly assert that the truncation warning doesn't mention composition warnings. Consider adding an assertion to confirm no "composition warnings" appears in any truncation message.

Suggested additional assertion
     const warningTableCalls = logSpy.mock.calls.filter(
       ([arg]) => typeof arg === 'string' && arg.includes('warnings were produced'),
     );
     expect(warningTableCalls).toHaveLength(0);
+
+    // Verify truncation warning doesn't mention composition warnings when suppressed
+    const truncationCalls = logSpy.mock.calls.filter(
+      ([arg]) => typeof arg === 'string' && arg.includes('truncated'),
+    );
+    expect(truncationCalls).toHaveLength(0);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/test/publish-schema.test.ts` around lines 250 - 270, The test 'does not
show warnings truncation when suppressWarnings is set' currently only asserts no
"warnings were produced" truncation calls; update the test (the call to
runPublish and subsequent checks using logSpy and warningTableCalls) to also
assert that no truncation message mentions "composition warnings" (e.g., filter
logSpy.mock.calls for strings containing "composition warnings" or similar
truncation phrasing and expect length 0) so the test explicitly verifies
suppression hides composition warning truncation text.

86-101: Consider enabling restoreMocks: true in Vitest config.

The test setup spies on console.log, process.stderr.write, and process.exit but doesn't explicitly restore them in afterEach. While this may work if Vitest is configured to auto-restore mocks, explicitly adding restoreMocks: true to vite.config.ts (as suggested in a prior review) would be more robust and eliminate the need for manual restoration across all test files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/test/publish-schema.test.ts` around lines 86 - 101, The tests in
publish-schema.test.ts call vi.spyOn(console, 'log'), vi.spyOn(process.stderr,
'write') and vi.spyOn(process, 'exit') but rely on global restoration; enable
automatic mock restoration by setting restoreMocks: true in the Vitest
configuration (test.restoreMocks = true) so vi.spyOn mocks are reset between
tests; after adding this setting you can drop any manual restore logic tied to
these spies in tests (they will be auto-restored), ensuring consistent cleanup
for tests that use vi.spyOn.
cli/vite.config.ts (1)

11-11: Verify that restoreMocks is the intended scope.

restoreMocks is broader than just clearing leaked mock calls: Vitest runs .mockRestore() before each test, which also restores original spy implementations/descriptors. If this package only needs per-test call isolation, clearMocks is the less disruptive setting. (v3.vitest.dev)

Optional narrower config
-    restoreMocks: true,
+    clearMocks: true,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/vite.config.ts` at line 11, The config currently sets restoreMocks: true
which restores original implementations before each test; if you only need
per-test call isolation swap it to clearMocks: true in the Vite/Vitest config
(replace the restoreMocks property with clearMocks: true in the exported
config). If you actually need restoring of spies/implementations keep
restoreMocks but add a comment explaining why; reference the restoreMocks /
clearMocks keys in vite.config.ts to make the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cli/test/publish-schema.test.ts`:
- Around line 250-270: The test 'does not show warnings truncation when
suppressWarnings is set' currently only asserts no "warnings were produced"
truncation calls; update the test (the call to runPublish and subsequent checks
using logSpy and warningTableCalls) to also assert that no truncation message
mentions "composition warnings" (e.g., filter logSpy.mock.calls for strings
containing "composition warnings" or similar truncation phrasing and expect
length 0) so the test explicitly verifies suppression hides composition warning
truncation text.
- Around line 86-101: The tests in publish-schema.test.ts call vi.spyOn(console,
'log'), vi.spyOn(process.stderr, 'write') and vi.spyOn(process, 'exit') but rely
on global restoration; enable automatic mock restoration by setting
restoreMocks: true in the Vitest configuration (test.restoreMocks = true) so
vi.spyOn mocks are reset between tests; after adding this setting you can drop
any manual restore logic tied to these spies in tests (they will be
auto-restored), ensuring consistent cleanup for tests that use vi.spyOn.

In `@cli/vite.config.ts`:
- Line 11: The config currently sets restoreMocks: true which restores original
implementations before each test; if you only need per-test call isolation swap
it to clearMocks: true in the Vite/Vitest config (replace the restoreMocks
property with clearMocks: true in the exported config). If you actually need
restoring of spies/implementations keep restoreMocks but add a comment
explaining why; reference the restoreMocks / clearMocks keys in vite.config.ts
to make the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1f62b58a-e4bb-4ea2-8477-1b57fe671c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 4b81e4d and ab33134.

📒 Files selected for processing (4)
  • cli/src/commands/subgraph/commands/publish.ts
  • cli/test/check-schema.test.ts
  • cli/test/publish-schema.test.ts
  • cli/vite.config.ts
💤 Files with no reviewable changes (1)
  • cli/test/check-schema.test.ts

Copy link
Copy Markdown
Contributor

@StarpTech StarpTech left a comment

Choose a reason for hiding this comment

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

LGTM

@JivusAyrus JivusAyrus merged commit 1d0085d into main Mar 12, 2026
54 of 56 checks passed
@JivusAyrus JivusAyrus deleted the suvij/limt-the-errors-listed-on-publish-schema branch March 12, 2026 13:47
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.

3 participants