Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

DifferV3 does not account for non-round-trippable backend fields, causing unnecessary sync events

Abierto
#427 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
api, backend

Línea de trabajo

Empieza siguiendo la interfaz Backend y la ruta de comparación de DifferV3 para ver dónde se comparan los recursos locales y remotos. Inspecciona backend-api7/src/typing.ts y los transformadores ToADC/FromADC de backend-api7 en busca de los campos no compatibles indicados. Se considera terminado cuando los campos no compatibles ya no provocan diffs ni solicitudes PUT repetidos, mientras que el comportamiento de backend-apisix permanece sin cambios.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Problem

When ADC is used with backends that do not support all SDK-level fields (e.g., backend-api7), DifferV3 produces false diffs every sync cycle because some fields sent in the local state cannot round-trip through the backend.

For example, with backend-api7:

  • route.hosts — API7 EE route model does not have hosts (it is a service-level field)
  • route.remote_addrs — not in API7 EE route typing
  • route.filter_func — not in API7 EE route typing
  • stream_route.sni — not in API7 EE stream_route typing

These fields exist in the ADC SDK schema and are correctly supported by backend-apisix, but backend-api7 transformers (ToADC/FromADC) do not map them. As a result, DifferV3 always detects a diff and triggers PUT requests even when no actual change occurred.

Impact

In Ingress Controller deployments, this causes every route and service to be PUT on every sync cycle (default: every 5 minutes), leading to massive audit log growth (customer case: 8 GB / 4.2M records).

Root Cause

DifferV3 is completely backend-agnostic — it only receives defaultValue from the backend and has no mechanism to know which fields a backend cannot round-trip. The diff comparison includes all fields present in either local or remote state, including fields the backend silently drops.

Proposed Solution

Add an optional normalizeForDiff method to the Backend interface:

interface Backend {
  // ... existing methods ...

  /**
   * Normalize a resource before diff comparison.
   * Called on deep copies of both local and remote resources.
   * Backend should strip fields it cannot round-trip.
   */
  normalizeForDiff?: (
    resourceType: ResourceType,
    resource: object,
  ) => object;
}

DifferV3 would call this normalizer on deep copies of both local and remote items before comparison. BackendAPI7 would implement it to strip non-round-trippable fields. BackendAPISIX would not implement it (all fields are supported).

Non-Round-Trippable Fields Audit (backend-api7)
Resource Field Reason
Route hosts Not in API7 EE route model (service-level)
Route remote_addrs Not in API7 EE route typing
Route filter_func Not in API7 EE route typing
StreamRoute sni Not in API7 EE stream_route typing
Notes on Type-Driven Normalization

backend-api7/src/typing.ts already defines typed interfaces that reflect the supported fields (e.g., typing.Route has no hosts), but these are pure TypeScript interfaces erased at compile time. Future evolution could convert them to Zod schemas for runtime field enumeration.

Lenguaje dominante
Rust
Estrellas
71
Forks
17
Merge medio
2 h 1 min
PR fusionados (30 d)
15

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de api7/adc

Todos los issues de api7/adc

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.