Skip to content

fix(engine): stop treating a bumped version token as a dropped write - #1182

Merged
divshekhar merged 1 commit into
reticlehq:mainfrom
drakeo338:claude/984-fix
Sep 29, 2026
Merged

divshekhar merged 1 commit into
reticlehq:mainfrom
drakeo338:claude/984-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

What & why

Refs #984 (umbrella): fixes one of the five reported shapes, write-field-ignored firing on a compare-and-set write.

A CAS write sends the version it read and expects the server to bump it. write-field-ignored had no way to tell that token from an ordinary persisted field, so a bumped version read as a dropped write on an otherwise healthy save — POST /trpc/reports.submit among the four apps reporting it. version, _version, etag, rev and revision are now excluded from the comparison the same way identity keys already are: the changed value proves the write applied, not a field the caller asked the server to keep.

How it was verified

RED: a test reproducing the report (version: 1 sent, version: 2 echoed) failed against main. GREEN: it passes with the fix; a second test confirms a real dropped field next to the same bump is still caught. Baseline 0/2, candidate 2/2.

Gates run

  • pnpm lint && pnpm typecheck && pnpm test:unit (~2 min — always)
  • pnpm test:e2e (~8 min) — touched the tool surface, core, an observer, or telemetry
  • pnpm gate:install (~15 min) — touched reticle init, vite-plugin, next, or babel-plugin
  • pnpm test:e2e:desktop (~3 min) — touched adapters/realm/electron, adapters/realm/tauri, or desktop capture
  • None of the above tiers apply to this change

Checklist

  • Every commit is signed off (git commit -s) — CI's DCO check fails the PR without it. Already pushed? git rebase --signoff origin/main && git push --force-with-lease
  • Tests added/updated (RED → GREEN); the change is covered by a test that would fail without it
  • No any, no free strings (wire strings live in @reticlehq/core), no non-null !
  • No console.log or internal tracking codes left in the diff
  • Each changed file is under the 1000-line cap
  • Docs updated, and a user-facing change adds a new file under .changes/ (never edit CHANGELOG.md — that file is assembled at release time, and editing it is what makes PRs conflict; format in .changes/README.md)
  • Security-affecting? Auth/redaction/trust-boundary changes keep the localhost-only, no-app-data-leaves-the-machine, no-arbitrary-JS posture (usage telemetry stays anonymous + opt-out per docs/telemetry.md) and are covered by a test

A compare-and-set write sends the version it read and expects the
server to bump it. write-field-ignored had no way to tell that token
apart from an ordinary persisted field, so the response's incremented
version read as a dropped write on an otherwise healthy save --
reported on four separate apps, POST /trpc/reports.submit among them
(reticlehq#984).

version, _version, etag, rev and revision are now excluded from the
per-key comparison the same way identity keys already are: the changed
value is the proof the write applied, not a field the caller asked the
server to preserve.

Closes reticlehq#984

Signed-off-by: drakeo338 <[email protected]>
@github-actions

Copy link
Copy Markdown

Thanks for your first pull request to Reticle! A maintainer aims to review within two days. Before then, pnpm verify locally catches most of what CI will, and CONTRIBUTING.md explains the rest. If CI does not start, a maintainer needs to approve it for first-time contributors; that is normal.

@github-actions github-actions Bot added the area/docs Documentation and docs site label Sep 28, 2026
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Fixes false alarm on version token changes in write detection.

The PR should not merge until it preserves detection for ordinary writable fields sharing a version-token name and removes the prohibited field count.

Findings

  1. P1 Writable version fields go undetected ▶
  2. P2 Field count appears in comment ▶

Summary

The PR excludes five version-like field names from the engine’s dropped-write echo comparison and adds CAS regression tests and a changelog entry.

  • A bumped token no longer produces the reported false positive.
  • The name-only exclusion also suppresses evidence when one of those names is an ordinary writable field.
  • A new test comment includes a field-derived count prohibited by repository guidance.

Reviews (1) · Last reviewed commit: "fix(engine): stop treating a bumped vers..."

// for crying wolf.
if (wanted.size !== 1) continue;
if (isIdentityKey(key)) continue;
if (isVersionKey(key)) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Writable version fields go undetected

If an app writes an ordinary field named version, such as a software release, and a successful response echoes the old value, this check skips the field solely because of its name. The same happens for the other four excluded names, even in nested objects. A genuinely ignored write can therefore produce no WRITE_FIELD_IGNORED finding.

* incremented `version: 2` was read as a dropped write — because nothing here distinguishes an
* optimistic-concurrency token from an ordinary persisted field. Reported on four separate apps.
*/
import { describe, expect, it } from 'vitest';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Field count appears in comment

The new comment says the behavior was reported on “four separate apps.” That is a user-derived field count, which the repository's no-field-numbers directive prohibits in shipped code comments. Remove the count before merging; the technical description can stay.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@divshekhar
divshekhar added this pull request to the merge queue Sep 29, 2026
Merged via the queue into reticlehq:main with commit 1dfde48 Sep 29, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation and docs site

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants