Skip to content

Commit 8e8a383

Browse files
adwk67claude
andauthored
feat: Stabilisation (#9)
* Add OPA permission calls to all applicable coprocessor hooks with test coverage for most of them * add claude.md to gitignore and reduce log level to trace for high frequency calls * bump to hbase 2.6.4 * check default namespace permissions on namespace actions * added reflection test to confirm coverage * renamed ctx variable consistently and refactored requirePermission * introduce OpType to add granularity * implement Filter-based preCheckAndPut/preCheckAndDelete overloads * add mutation checks * pass families to permission checker * pass map of key + families to permission checker * check pass-throughs and no-ops * fix 2 warnings * Add OPA policy testing layer design doc Describes a fast intermediate test layer that captures unit-test WireMock payloads, remaps usernames to Rego-compatible principals, and validates the Rego policy logic using the opa test CLI — without integration test overhead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add OPA policy testing implementation plan Five tasks: OpaFixtureWriter class, test wiring, Rego files, Maven plugins (download-maven-plugin + exec-maven-plugin), and end-to-end verification. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add OpaFixtureWriter for capturing WireMock OPA fixtures Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix OpaFixtureWriter concurrency: single monitor, plain int counters Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Wire OpaFixtureWriter into test teardown and WireMock listener Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Filter system-user fixtures; fix listener registration in Variants test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Use @before for listener registration; document fixture filter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add Rego policy file and OPA test suite Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add download-maven-plugin and exec-maven-plugin for OPA policy testing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Move OPA fixtures to target/, add print counts, untrack plan docs - OpaFixtureWriter writes to target/test-rego/fixtures.json (was src/test/rego/fixtures.json) so test runs no longer dirty the working tree - pom.xml opa-policy-test execution updated to match new path - hbase_test.rego: add print() calls so --explain notes reports fixture counts - .gitignore: add /docs/plans/ (plan docs are local-only, not committed) - Remove stale design doc and completed implementation plan from git Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add unit tests for bulk load and lock hooks prePrepareBulkLoad, preCleanupBulkLoad, preBulkLoadHFile (region-level), preLockHeartbeat, and preRequestLock (table, namespace, and region-scope branches) were implemented but had no unit tests. Brings coverage from 83 to 90 passing tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * add final * clarified comment * updated interface check test * make casing consistent with rego rules in integration tests * added readonly tests to match integration test coverage * replace lambda with a more readable loop * bind exec to skip tests so it only runs when the prerequisite files are created * bump maven plugins * google-format, error-prone etc. plugins * bumped opa to 1.12.3 * bump caffeine * consolidate private method with public one --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 87f7e51 commit 8e8a383

14 files changed

Lines changed: 2601 additions & 443 deletions

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
/target/
2-
/dependency-reduced-pom.xml
2+
/dependency-reduced-pom.xml
3+
/CLAUDE.md
4+
.claude/
5+
/target/opa
6+
/docs/plans/

pom.xml

Lines changed: 102 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,25 @@
3737
<maven.compiler.release>${java.version}</maven.compiler.release>
3838
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3939

40-
<cleanthat.version>2.17</cleanthat.version>
41-
<error-prone.version>2.27.1</error-prone.version>
42-
<google-java-format.version>1.19.2</google-java-format.version>
40+
<cleanthat.version>2.25</cleanthat.version>
41+
<error-prone.version>2.31.0</error-prone.version>
42+
<google-java-format.version>1.24.0</google-java-format.version>
4343

44-
<maven-clean-plugin.version>3.3.2</maven-clean-plugin.version>
45-
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
46-
<maven-deploy-plugin.version>3.1.2</maven-deploy-plugin.version>
47-
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
48-
<maven-install-plugin.version>3.1.2</maven-install-plugin.version>
49-
<maven-jar-plugin.version>3.4.1</maven-jar-plugin.version>
50-
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
51-
<maven-site-plugin.version>3.12.1</maven-site-plugin.version>
52-
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
53-
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
44+
<maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
45+
<maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
46+
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
47+
<maven-enforcer-plugin.version>3.6.2</maven-enforcer-plugin.version>
48+
<maven-install-plugin.version>3.1.4</maven-install-plugin.version>
49+
<maven-jar-plugin.version>3.5.0</maven-jar-plugin.version>
50+
<maven-resources-plugin.version>3.5.0</maven-resources-plugin.version>
51+
<maven-site-plugin.version>3.21.0</maven-site-plugin.version>
52+
<maven-surefire-plugin.version>3.5.5</maven-surefire-plugin.version>
53+
<spotless-maven-plugin.version>2.44.5</spotless-maven-plugin.version>
5454

55-
<hbase.version>2.6.0</hbase.version>
55+
<hbase.version>2.6.4</hbase.version>
5656
<hbase.protobuf.version>2.5.0</hbase.protobuf.version>
57-
<caffeine.version>2.8.1</caffeine.version>
57+
<caffeine.version>3.2.0</caffeine.version>
58+
<opa.version>1.12.3</opa.version>
5859
</properties>
5960

6061
<dependencies>
@@ -106,6 +107,12 @@
106107
<artifactId>hbase-testing-util</artifactId>
107108
<version>${hbase.version}</version>
108109
<scope>test</scope>
110+
<exclusions>
111+
<exclusion>
112+
<groupId>org.apache.directory.jdbm</groupId>
113+
<artifactId>apacheds-jdbm1</artifactId>
114+
</exclusion>
115+
</exclusions>
109116
</dependency>
110117
<dependency>
111118
<groupId>org.slf4j</groupId>
@@ -133,6 +140,30 @@
133140
</dependency>
134141
</dependencies>
135142

143+
<profiles>
144+
<profile>
145+
<id>opa-linux-amd64</id>
146+
<activation>
147+
<os><name>Linux</name><arch>amd64</arch></os>
148+
</activation>
149+
<properties><opa.classifier>linux_amd64_static</opa.classifier></properties>
150+
</profile>
151+
<profile>
152+
<id>opa-mac-amd64</id>
153+
<activation>
154+
<os><name>Mac OS X</name><arch>x86_64</arch></os>
155+
</activation>
156+
<properties><opa.classifier>darwin_amd64</opa.classifier></properties>
157+
</profile>
158+
<profile>
159+
<id>opa-mac-arm64</id>
160+
<activation>
161+
<os><name>Mac OS X</name><arch>aarch64</arch></os>
162+
</activation>
163+
<properties><opa.classifier>darwin_arm64</opa.classifier></properties>
164+
</profile>
165+
</profiles>
166+
136167
<build>
137168
<plugins>
138169
<plugin>
@@ -234,6 +265,62 @@
234265
<artifactId>maven-surefire-plugin</artifactId>
235266
<version>${maven-surefire-plugin.version}</version>
236267
</plugin>
268+
<plugin>
269+
<groupId>com.googlecode.maven-download-plugin</groupId>
270+
<artifactId>download-maven-plugin</artifactId>
271+
<version>1.8.1</version>
272+
<executions>
273+
<execution>
274+
<id>download-opa</id>
275+
<phase>process-test-resources</phase>
276+
<goals><goal>wget</goal></goals>
277+
<configuration>
278+
<url>https://github.com/open-policy-agent/opa/releases/download/v${opa.version}/opa_${opa.classifier}</url>
279+
<outputDirectory>${project.build.directory}</outputDirectory>
280+
<outputFileName>opa</outputFileName>
281+
<skipCache>false</skipCache>
282+
</configuration>
283+
</execution>
284+
</executions>
285+
</plugin>
286+
<plugin>
287+
<groupId>org.codehaus.mojo</groupId>
288+
<artifactId>exec-maven-plugin</artifactId>
289+
<version>3.1.0</version>
290+
<executions>
291+
<execution>
292+
<id>chmod-opa</id>
293+
<phase>process-test-resources</phase>
294+
<goals><goal>exec</goal></goals>
295+
<configuration>
296+
<executable>chmod</executable>
297+
<arguments>
298+
<argument>+x</argument>
299+
<argument>${project.build.directory}/opa</argument>
300+
</arguments>
301+
</configuration>
302+
</execution>
303+
<execution>
304+
<id>opa-policy-test</id>
305+
<phase>verify</phase>
306+
<goals><goal>exec</goal></goals>
307+
<configuration>
308+
<executable>${project.build.directory}/opa</executable>
309+
<workingDirectory>${project.basedir}</workingDirectory>
310+
<arguments>
311+
<argument>test</argument>
312+
<argument>src/test/rego/hbase.rego</argument>
313+
<argument>src/test/rego/hbase_test.rego</argument>
314+
<argument>target/test-rego/fixtures.json</argument>
315+
<argument>--explain</argument>
316+
<argument>notes</argument>
317+
<argument>-v</argument>
318+
</arguments>
319+
<skip>${skipTests}</skip>
320+
</configuration>
321+
</execution>
322+
</executions>
323+
</plugin>
237324
<plugin>
238325
<groupId>com.diffplug.spotless</groupId>
239326
<artifactId>spotless-maven-plugin</artifactId>

0 commit comments

Comments
 (0)