﻿# Google AIP update masks distinguish selection from replacement

Google AIP update masks distinguish omitted selection, explicit no-op and full replacement; repeated-field indexes and collection wildcards have separate support boundaries.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-aip-update-mask-replacement-boundary/
Language: en

## Identify the resource fields the request will change

A client updates an analysis configuration's description while preserving its source list and retention settings. Google's [standard Update guidance](https://google.aip.dev/134) uses an update mask to identify selected resource fields. The mask is relative to the resource being updated, not the enclosing request message. Review the actual selected paths before treating a partial request body as a safe description-only edit.

## Distinguish omitted and explicit empty masks

Under this guidance, an omitted mask implies the populated non-empty fields. An explicitly supplied empty mask should be a no-op returning the unchanged resource. These are different update instructions, not interchangeable serialization variants. If clearing a field is intended, express its selection according to the service's documented contract rather than relying on an omitted mask to infer every desired default or empty value.

## Treat replacement as a service-level operation

The special top-level wildcard means full replacement. The guidance notes that standard Protobuf mask helpers do not recognize that wildcard as a normal field path; the service must implement the replacement behavior. A client should therefore distinguish documented API support from what a generic local helper accepts. [Compatibility guidance](https://google.aip.dev/180) also separates semantic compatibility from wire acceptance, which matters when a replacement encounters resource fields added after the client was generated.

## Respect the repeated-field boundary

[AIP field-mask guidance](https://google.aip.dev/161) permits selecting an entire repeated field. Standard runtime utilities require repeated fields at a path's leaf and do not permit selecting a particular element by numeric index. Map-entry traversal and collection wildcards are documented as optional non-standard extensions. Do not assume a mask for an individual source-list element works merely because similar dotted paths work for nested messages.

## Review the read-modify-write result

For the intended edit, inspect the effective mask and returned resource, including the fields expected to remain unchanged. [Task contracts](/journal/learn-codex-task-contract/) state the desired configuration change; [tool observations](/journal/learn-codex-tool-observation/) retain the selected paths and result. This makes an update understandable as a specific selection or replacement operation, without treating generic PATCH syntax or a locally accepted mask string as proof of the service's actual mutation semantics.
