Skip to content

chore: upgrade apollo-compiler to v2.0.0-beta.1 - #10121

Draft
tninesling wants to merge 12 commits into
tninesling/upgrade-compiler-v2-beta0from
tninesling/upgrade-compiler-v2-beta1
Draft

chore: upgrade apollo-compiler to v2.0.0-beta.1#10121
tninesling wants to merge 12 commits into
tninesling/upgrade-compiler-v2-beta0from
tninesling/upgrade-compiler-v2-beta1

Conversation

@tninesling

@tninesling tninesling commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Upgrades apollo-compiler from v2.0.0-beta.0 to v2.0.0-beta.1 and apollo-federation-types shape from 0.9.0-preview.0 to 0.9.0-preview.1.

The main API change in beta.1 is the removal of Component<T> in favor of Node<T>:

  • Component<T> -> Node<T>: The Component wrapper that tracked ComponentOrigin has been removed. All uses of Component<T> become Node<T>.
  • ComponentName -> Node<Name>: Type alias replaced with the concrete type.
  • ComponentOrigin -> Option<ExtensionId>: Origin tracking simplified. Most code that inspected ComponentOrigin::Definition vs ComponentOrigin::Extension now checks Option<ExtensionId> (None = definition, Some = extension).
  • DirectiveList unified: ast::DirectiveList and schema::DirectiveList were merged into a single DirectiveList type, allowing us to deduplicate several helper functions in compat.rs.

Notable changes by area

apollo-federation/src/schema/position.rs (-352 lines net): Simplified insert_directive, remove_directive, and field accessor methods now that Component<T> is gone. Many methods that previously needed to construct Component wrappers with origins can pass Node<T> directly.

apollo-federation/src/compat.rs: Removed duplicate functions that existed to bridge ast::DirectiveList vs schema::DirectiveList — now a single DirectiveList type.

apollo-federation/src/connectors/: Updated directive construction, schema expansion, and JSON selection apply_to for the new Node-based API.

apollo-federation/src/merge.rs / merger/: Updated all merge operations to use Node<T> instead of Component<T>.

apollo-router/src/: Switched #[expect(clippy::result_large_err)] to #[allow(...)] on 6 functions where the lint fires on Rust 1.98 (CI) but not 1.97 (local), avoiding unfulfilled-expectation errors.

Checklist

  • PR description explains the motivation for the change and relevant context for reviewing
  • Changeset is included for user-facing changes
  • Changes are compatible
  • Documentation completed
  • Performance impact assessed and acceptable
  • Tests added and passing
    • Unit tests
    • Integration tests

Exceptions

  • No changeset needed: internal dependency upgrade, no user-facing behavior change.
  • No new docs needed: no API or config surface changes.

@apollo-librarian

apollo-librarian Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

1 new, 20 changed, 0 removed
+ graphos/routing/(latest)/upgrade/from-router-v2.mdx
* graphos/routing/(latest)/configuration/yaml.mdx
* graphos/routing/(latest)/customization/native-plugins.mdx
* graphos/routing/(latest)/customization/coprocessor/index.mdx
* graphos/routing/(latest)/customization/rhai/index.mdx
* graphos/routing/(latest)/observability/graphos/graphos-reporting.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/index.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/apm-guides/datadog/router-instrumentation.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/apm-guides/datadog/connecting-to-datadog/datadog-agent/datadog-agent-traces.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/apm-guides/jaeger/jaeger-traces.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/apm-guides/zipkin/zipkin-traces.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/enabling-telemetry/conditions.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/enabling-telemetry/selectors.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/enabling-telemetry/spans.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/enabling-telemetry/standard-instruments.mdx
* graphos/routing/(latest)/observability/router-telemetry-otel/telemetry-pipelines/trace-exporters/overview.mdx
* graphos/routing/(latest)/performance/caching/response-caching/faq.mdx
* graphos/routing/(latest)/security/demand-control.mdx
* graphos/routing/(latest)/self-hosted/containerization/proxy-certificates.mdx
* graphos/routing/(latest)/upgrade/from-router-v1.mdx
* graphos/routing/(latest)/_sidebar.yaml

Build ID: e08d7f48a04fb7be87a7ea87
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/e08d7f48a04fb7be87a7ea87


✅ AI Style Review — No Changes Detected

No MDX files were changed in this pull request.

Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@mergify

mergify Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 1 protections blocking · waiting on ⛓️ dependency

Protection Waiting on
🔴 ⛓️ Depends-On Requirements ⛓️ dependency

🔴 ⛓️ Depends-On Requirements

Waiting for

This rule is failing.

Requirement based on the presence of Depends-On in the body of the pull request

@tninesling
tninesling force-pushed the tninesling/upgrade-compiler-v2-beta1 branch 2 times, most recently from ac1db3d to 412a157 Compare August 31, 2026 19:48
@tninesling
tninesling force-pushed the tninesling/upgrade-compiler-v2-beta1 branch 2 times, most recently from eacc29b to f84c98e Compare September 1, 2026 14:38
Migrates Component<T> to Node<T>, ComponentName to Node<Name>,
and ComponentOrigin to Option<ExtensionId>. Deduplicates compat.rs
functions where ast::DirectiveList and schema::DirectiveList were
unified into a single DirectiveList type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tninesling
tninesling force-pushed the tninesling/upgrade-compiler-v2-beta1 branch from f84c98e to 7448700 Compare September 1, 2026 15:14
tninesling and others added 11 commits September 1, 2026 10:50
Remove needless borrows, useless type conversions, redundant clones,
and no-op as_ref calls introduced by the apollo-compiler v2 API changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix import ordering in link/mod.rs and replace explicit closure clone
with .cloned() in query_plan_soundness.rs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix import ordering in link/mod.rs (group_imports=StdExternalCrate)
- Replace .map(|c| c.clone()) with .cloned() in query_plan_soundness.rs
- Remove unfulfilled #[expect(clippy::result_large_err)] attributes
  in apq, websocket, and persisted_queries modules (type sizes changed
  with compiler v2, lint no longer fires)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sion compat

The lint fires on CI (Rust 1.98) but not locally (1.97). Switch from
#[expect] to #[allow] so it suppresses on 1.98 without causing an
unfulfilled-expectation error on 1.97.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… beta1

The beta1 upgrade commit inadvertently reverted is_array()/is_object()
calls back to closed_tuple/empty_object accepts patterns from the
pre-shape-0.8 API. Restore them.

Also update shape pretty_print assertions (List<T> -> [...T],
Error<"msg"> -> Unknown (err "msg")), schema serialization expectation
(@link placement), and dhat memory thresholds for compiler v2 beta1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When both the link and federation specs are explicitly linked in the
input, compiler v2 keeps both @link directives together on the extend
schema definition rather than placing the link spec on the base schema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the input has `extend schema @link(link/v1.0) @link(federation/v2.0)`,
the parser gives both directives an ExtensionId. The link spec's @link
should live on the base `schema { ... }` definition, not on `extend schema`.

After collecting link metadata, we now strip the ExtensionId from the
link spec's @link directive so the serializer places it on the base
schema definition. This keeps the output consistent regardless of whether
the link spec was explicitly linked or implicitly added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The beta1 Component->Node migration replaced
`Component { origin: schema_definition.origin_to_use(), ... }` with
`Node::new(...)`, losing the logic that chose whether the link-to-link
@link directive should go on the schema definition or an extension.

Restore the origin_to_use() call in add_to_schema so the directive gets
the correct ExtensionId, matching pre-upgrade serialization behavior.

Also remove the promote_link_spec_directive workaround that was papering
over the symptom in expand_schema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The shape crate's public API is identical between preview.0 and
preview.1, so the has_own_errors/any_object/any_array changes were
not required. Restoring beta0 versions of connector method files
to keep the changeset minimal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Compiler v2 unified DirectiveList types, so the duplicate function
that existed for the separate AST DirectiveList is no longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…st is unified

Compiler v2 consolidated Node<Directive> and Component<Directive> into
a single Node<Directive> type, so the AppliedDirective associated type
that abstracted over both wrappers is no longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant