Skip to content

Add tripwire tests for the RTAS policy merge - #659

Open
mkuchenbecker wants to merge 6 commits into
linkedin:mainfrom
mkuchenbecker:mkuchenbecker/r2-policy-tripwire
Open

Add tripwire tests for the RTAS policy merge#659
mkuchenbecker wants to merge 6 commits into
linkedin:mainfrom
mkuchenbecker:mkuchenbecker/r2-policy-tripwire

Conversation

@mkuchenbecker

@mkuchenbecker mkuchenbecker commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #652 (base branch mkuchenbecker/r2-rtas-policies-merge). Adds tripwire tests that guard
the RTAS policy merge against a future policy plane being added to Policies without updating
mergePolicies to carry it forward (which would reintroduce the silent policy-drop #652 fixes).

  • Behavioral: populate every object policy plane on the existing table, merge a request that
    omits them, and reflectively assert each plane survives — a new plane that mergePolicies forgets
    comes back null and fails with a pointed message.
  • Structural: pin the exact set of Policies field names, so any add / remove / rename
    (including a primitive the behavioral test can't observe) trips the test and forces a conscious
    merge update.

Testing Done

  • RtasPolicyMergeTripwireTest (both tests) — pass.
  • Teeth-checked: removing a plane's handling from mergePolicies fails the behavioral test with
    "RTAS policy merge dropped Policies.". Spotless clean.

mkuchenbecker and others added 5 commits July 22, 2026 12:35
RTAS re-materialized the policies table property only from the request, so a
replace that omitted policies silently wiped retention, sharing, PII column
tags, replication, and history. Policies are table metadata and must survive a
replace: merge the existing table's policies with the request's, each plane the
request provides winning and every omitted plane carried forward.

Co-authored-by: Copilot <[email protected]>
Capture the merge contract: each plane merged, omitted planes carried forward,
provided planes win (partial merge), planes can be added via RTAS, columnTags
empty-vs-nonempty, and sharingEnabled takes the request value. Adds a unit test
over mergePolicies and an e2e test that RTAS applies a requested policy.

Co-authored-by: Copilot <[email protected]>
Replace the mergePolicies unit test with black-box tests that drive real Spark
SQL against a real embedded OpenHouse server (OpenHouseSparkITest): set policies
via ALTER TABLE ... SET POLICY, run CREATE OR REPLACE TABLE ... AS SELECT, and
assert via SHOW TBLPROPERTIES that retention, sharing, PII column tags, and
history survive the replace.

Also fix RTASTest.testRTAS, which asserted the old buggy behavior (policies
wiped on RTAS); it now asserts the history policy is preserved.

Co-authored-by: Copilot <[email protected]>
Guard mergePolicies against a new policy plane being added to Policies without
teaching the RTAS merge to carry it forward. A behavioral test populates every
object plane on the existing table, merges a request that omits them, and
reflectively asserts each survives; a structural test pins the exact set of
Policies fields so any add/rename/remove (including a primitive) trips it.

Co-authored-by: Copilot <[email protected]>
@mkuchenbecker
mkuchenbecker changed the base branch from main to mkuchenbecker/r2-rtas-policies-merge July 24, 2026 16:40
@mkuchenbecker
mkuchenbecker marked this pull request as ready for review August 4, 2026 16:26
@mkuchenbecker
mkuchenbecker marked this pull request as draft August 4, 2026 16:27
@mkuchenbecker
mkuchenbecker marked this pull request as ready for review August 4, 2026 16:27
@mkuchenbecker
mkuchenbecker changed the base branch from mkuchenbecker/r2-rtas-policies-merge to main August 4, 2026 16:28
@mkuchenbecker

Copy link
Copy Markdown
Contributor Author

@kamanavishnu PTAL

@kamanavishnu kamanavishnu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

"lockState"));

Set<String> actual =
java.util.Arrays.stream(Policies.class.getDeclaredFields())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

minor nit: Add import instead of fully qualified package name ?

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.

2 participants