Skip to content

[Improvement] Complete v2 audit operation mapping coverage#10553

Open
FANNG1 wants to merge 1 commit intoapache:mainfrom
FANNG1:issue_10537
Open

[Improvement] Complete v2 audit operation mapping coverage#10553
FANNG1 wants to merge 1 commit intoapache:mainfrom
FANNG1:issue_10537

Conversation

@FANNG1
Copy link
Contributor

@FANNG1 FANNG1 commented Mar 26, 2026

What changed

  • Added explicit v2 audit mappings for all known OperationType values in CompatibilityUtils
  • Expanded AuditLog.Operation with the concrete audit operation values needed by v2
  • Added tests to verify:
    • concrete mappings for newly covered operation types
    • all known OperationType values map to a non-unknown audit operation

Why

The previous v2 compatibility mapping only covered part of the listener operation space.
Many supported operations still fell back to UNKNOWN_OPERATION, which made audit output incomplete and inconsistent.

This change makes v2 audit mapping complete for all known operation types and keeps UNKNOWN_OPERATION reserved for truly unknown inputs only.

How it was tested

IT_SPARK_HOME=/Users/fanng/deploy/demo/spark-3.5.3-bin-hadoop3 \
IT_SPARK_ARGS='--conf spark.jars=/Users/fanng/deploy/demo/jars/iceberg-spark-runtime-3.5_2.12-1.9.2.jar,/Users/fanng/deploy/demo/jars/iceberg-aws-bundle-1.9.2.jar --conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions --conf spark.sql.catalog.rest=org.apache.iceberg.spark.SparkCatalog --conf spark.sql.catalog.rest.type=rest --conf spark.sql.catalog.rest.uri=http://127.0.0.1:9001/iceberg/ --conf spark.sql.catalog.rest.header.X-Iceberg-Access-Delegation=vended-credentials' \
IT_TABLE_IDENTIFIER=rest.ab.a1 \
GRAVITINO_ENV_IT=true \
./gradlew :core:test -PskipIT=true --tests 'org.apache.gravitino.audit.v2.TestCompatibilityUtils'

Risks / follow-ups

  • AuditLog.Operation is still shared with legacy audit code, so this change expands the enum surface beyond the legacy formatter coverage.
  • If new OperationType values are added later, the new guard test should fail until the mapping is updated.

@github-actions
Copy link

github-actions bot commented Mar 26, 2026

Code Coverage Report

Overall Project 65.01% +0.1% 🟢
Files changed 76.92% 🟢

Module Coverage
aliyun 1.73% 🔴
api 47.14% 🟢
authorization-common 85.96% 🟢
aws 1.1% 🔴
azure 2.6% 🔴
catalog-common 10.0% 🔴
catalog-fileset 80.02% 🟢
catalog-hive 80.98% 🟢
catalog-jdbc-clickhouse 79.06% 🟢
catalog-jdbc-common 42.89% 🟢
catalog-jdbc-doris 80.28% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 79.23% 🟢
catalog-jdbc-oceanbase 78.38% 🟢
catalog-jdbc-postgresql 82.05% 🟢
catalog-jdbc-starrocks 78.27% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 45.07% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 87.25% 🟢
catalog-lakehouse-paimon 77.71% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 77.83% 🟢
common 49.42% 🟢
core 81.14% -0.12% 🟢
filesystem-hadoop3 76.97% 🟢
flink 38.86% 🔴
flink-runtime 0.0% 🔴
gcp 14.2% 🔴
hadoop-common 10.39% 🔴
hive-metastore-common 45.82% 🟢
iceberg-common 50.21% 🟢
iceberg-rest-server 66.51% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 23.88% 🔴
lance-rest-server 57.84% 🟢
lineage 53.02% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴
server 85.62% 🟢
server-common 70.14% 🟢
spark 32.79% 🔴
spark-common 39.09% 🔴
trino-connector 31.62% 🔴
Files
Module File Coverage
core OperationType.java 100.0% 🟢
CompatibilityUtils.java 99.31% 🟢
AuditLog.java 97.3% 🟢
GravitinoEnv.java 10.98% 🔴

roryqi
roryqi previously approved these changes Mar 26, 2026
@FANNG1 FANNG1 changed the title [Improvement] Complete v2 audit operation mapping coverage [MINOR] docs: clarify Java import guidance in AGENTS.md Mar 27, 2026
@FANNG1 FANNG1 closed this Mar 27, 2026
@FANNG1 FANNG1 reopened this Mar 27, 2026
@FANNG1 FANNG1 changed the title [MINOR] docs: clarify Java import guidance in AGENTS.md [Improvement] Complete v2 audit operation mapping coverage Mar 27, 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.

2 participants