Skip to content

fix: incremental watermark, short-credential disclosure, and a stale build (F9, F10, F13) - #140

Closed
jrosskopf wants to merge 1 commit into
mainfrom
fix/release-review-remainder
Closed

jrosskopf wants to merge 1 commit into
mainfrom
fix/release-review-remainder

Conversation

@jrosskopf

@jrosskopf jrosskopf commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

The last three findings from the release review.

F9 — the incremental watermark pointed two refreshes back

fetchSnapshotInfo runs before the refresh writes anything, so the newest existing snapshot is the last completed refresh. previousSnapshot* carried index 1 — one further back — while CONFIG_REFERENCE documented it as "Last refresh timestamp" and its own example used it as the watermark:

WHERE updated_at > TIMESTAMP '{{cache.previousSnapshotTimestamp}}'

So an append template re-read every row the previous refresh had already appended, silently. And a table's second-ever refresh had no previous at all, so the incremental section didn't render and it reloaded everything. Merge mode masked it — duplicates collapse on the primary key — which is why it survived.

Behaviour change: incremental refreshes now load a narrower, correct window.

A second docs defect found while checking: {{cache.currentSnapshotTimestamp}} is documented and has never existed — the implemented name is {{cache.snapshotTimestamp}}. A template using the documented name renders an empty string, which inside WHERE ... > TIMESTAMP '' is a SQL error. Same class as the config keys that were documented and never read.

F10 — short credentials were returned verbatim by _dryRun

The scrub skipped values under four bytes, so a three-character password or PIN interpolated through conn.* came back to any caller — and MCP is unauthenticated by default.

Redacting them regardless is not the fix either. Scrubbing works by value, since the key is gone by the time the SQL is rendered, and a one-byte secret matches ordinary text. Measured: redacting "a" rewrote the middle of an unrelated file path.

So the preview is withheld when a connection holds a credential too short to replace safely, with a message saying why. Neither leaking nor mangling. Tested both ways.

F13 — the tracing-off tree was stale

Rebuilt from scratch against all the merged work; flapi-lib compiles and links clean.

Correcting the finding on one point: both binary resolvers (conftest.py:107, otel_helpers.py:30) default to release, not debug — so the integration runs did exercise the right binary. The stale tree was real; the consequence claimed for it was not.

My own test failed on this, correctly

The watermark test asserted the old index-1 contract. Restructured so the scenario still discriminates — table A moves twice, then B, so the catalog's newest belongs to B while A's own is older — and it now also asserts the watermark is A's last refresh rather than the one before it.

755 unit, 378 standalone integration, all green.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…build (F9, F10, F13)

F9 - the incremental watermark pointed two refreshes back.

  fetchSnapshotInfo runs BEFORE the refresh writes anything, so the newest
  existing snapshot is already the last completed refresh. previousSnapshot*
  carried index 1 instead - one further back - while CONFIG_REFERENCE
  documented previousSnapshotTimestamp as "Last refresh timestamp" and its
  example used it as

      WHERE updated_at > TIMESTAMP '{{cache.previousSnapshotTimestamp}}'

  So an append template re-read every row the previous refresh had already
  appended, silently, and a table's second-ever refresh had no previous at
  all - the incremental section did not render and it reloaded everything.
  Merge mode masked it: duplicates collapse on the primary key.

  BEHAVIOUR CHANGE: incremental refreshes now load a narrower, correct
  window.

  A second docs defect found while checking it: {{cache.currentSnapshotTimestamp}}
  is documented and has NEVER existed - the implemented name is
  {{cache.snapshotTimestamp}}. A template using the documented name renders
  an empty string, which inside WHERE ... > TIMESTAMP '' is a SQL error.
  Same class as the config keys that were documented and never read.

F10 - short credentials were returned verbatim by _dryRun.

  The scrub skipped values under four bytes, so a three-character password or
  PIN interpolated through conn.* came back to any caller, and MCP is
  unauthenticated by default.

  Redacting them regardless is not the fix either: scrubbing works by value,
  because the key is gone by the time the SQL is rendered, and a one-byte
  secret matches ordinary text. Measured - redacting "a" rewrote the middle
  of an unrelated file path and broke the preview.

  So the preview is WITHHELD when a connection holds a credential too short
  to replace safely, with a message saying why. Neither leaking nor mangling.
  Tested both ways: a short secret withholds, a normal connection still gets
  its preview.

F13 - the tracing-off tree was stale.

  Rebuilt from scratch against all the merged work; flapi-lib compiles and
  links clean. Correcting the finding on one point: both binary resolvers
  (conftest.py:107 and otel_helpers.py:30) default to RELEASE, not debug, so
  the integration runs did exercise the right binary.

My own watermark test failed on the F9 change, correctly: it asserted the old
index-1 contract. Restructured so the scenario still discriminates - table A
moves twice, then B, so the catalog's newest belongs to B while A's own is
older - and it now also asserts the watermark is A's LAST refresh rather than
the one before it.

755 unit tests, 378 standalone integration tests.
@jrosskopf

Copy link
Copy Markdown
Contributor Author

Superseded by #144, the v26.09.23 release candidate, which carries this work plus the fixes its integration CI was failing on. Closing in favour of that PR.

@jrosskopf jrosskopf closed this Sep 23, 2026
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