GoogleCloudPlatform / GoogleCloudPlatform/firebase-extensions

fix(firestore-incremental-capture-pipeline): adjustDate shifts the restore point on non-UTC JVMs

Open Beginner friendly
#1,149 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
124
Forks
67
Avg merge
5d 5h
Merged PRs (30d)
5

Description

### [REQUIRED] Step 2: Describe your configuration

- Extension name: `firestore-incremental-capture`
- Extension version: any; concerns the `firestore-incremental-capture-pipeline` Dataflow job
- Configuration values: only manifests when the pipeline JVM's default timezone is not UTC

### [REQUIRED] Step 3: Describe the problem

`Utils.adjustDate` (firestore-incremental-capture-pipeline/src/main/java/com/pipeline/Utils.java) round-trips the restore timestamp through a zone-less string:

```java
return Instant.parse(providedDate.toString("yyyy-MM-dd'T'HH:mm:ss.SSS"));
```

`providedDate.toString(...)` renders in the JVM's default zone with no offset suffix, and `Instant.parse` interprets the zone-less string as UTC. On a JVM whose default timezone is not UTC, the restore point silently shifts by the zone offset, so the replay window cuts at the wrong moment.

In practice Dataflow workers run UTC, so current jobs are unaffected - this is a latent correctness bug, not a live incident. It also surfaces in any local or test execution of the pipeline in a non-UTC environment.

#### Suggested fix

Use `providedDate.toInstant()` (and `now.minusDays(7).toInstant()` in the 7-day clamp branch) instead of the format/parse round trip. No wire-format or schema impact.

#### Related

Raised by review tooling on firebase/extensions#2938 while the pipeline was vendored there; the pipeline's canonical home is this repo, so tracking it here. Low severity given UTC workers; worth folding into the next pipeline release after v0.1.0 alongside #1147.

Contributor guide

Open the contributing guide

Research direction

Open firestore-incremental-capture-pipeline/src/main/java/com/pipeline/Utils.java and start at Utils.adjustDate. Verify how restore timestamps behave when the JVM default timezone is not UTC, then confirm the pipeline preserves the supplied instant, including the seven-day clamp branch, without changing wire formats or schemas.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, java
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.