This is an automated email from the ASF dual-hosted git repository.

terrymanu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c27b6e5240 Add orphan audit for last production consumers (#39592)
7c27b6e5240 is described below

commit 7c27b6e5240371ea1d1878c506f4fb76be691c7b
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 24 12:07:41 2026 +0800

    Add orphan audit for last production consumers (#39592)
    
    * Support parsing Oracle CREATE TYPE BODY SQL
    
    - Add createTypeBody, plsqlTypeBodySource and typeBodyElement rules to the 
Oracle
      PLSQL grammar, covering MEMBER/STATIC function and procedure bodies, 
CONSTRUCTOR
      FUNCTION with RETURN SELF AS RESULT, and MAP/ORDER MEMBER FUNCTION bodies 
with
      optional declare sections and full PL/SQL statement bodies
    - Reuse the existing body, declareSection and parameterDeclaration building 
blocks
      already exercised by CREATE PACKAGE BODY, CREATE FUNCTION and CREATE 
TRIGGER, and
      dispatch createTypeBody before createType in the execute rule
    - Make REUSE SETTINGS optional in compileTypeClause according to the Oracle 
PL/SQL
      Language Reference, so ALTER TYPE ... COMPILE, COMPILE SPECIFICATION and 
COMPILE
      BODY statements parse without trailing REUSE SETTINGS
    - Build a lightweight OracleCreateTypeBodyStatement carrying the type name 
and
      register the CREATE_TYPE_BODY visitor rule, DDL assert branch and JAXB 
test case
    - Add parser IT cases from issue #27005, the official PL/SQL reference 
examples,
      and the ALTER TYPE COMPILE forms without REUSE SETTINGS
    
    Fixes #27005
    
    * Add orphan audit for last production consumers
    
    * Add orphan audit for last production consumers
---
 .codex/harness/agents/cases.toml | 15 +++++++++++++++
 .codex/harness/agents/run.py     |  2 ++
 AGENTS.md                        | 15 +++++++++++----
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/.codex/harness/agents/cases.toml b/.codex/harness/agents/cases.toml
index 5fe3864395a..ae7c4a035e0 100644
--- a/.codex/harness/agents/cases.toml
+++ b/.codex/harness/agents/cases.toml
@@ -979,6 +979,21 @@ forbidden_actions = ["change_public_contract", 
"edit_code", "edit_non_code", "ad
 required_reasons = ["architecture_report_required", 
"api_interface_design_required", "stable_variation_contract"]
 critical = true
 
+[[cases]]
+id = "last_production_consumer_triggers_orphan_audit"
+group = "coding / architecture"
+description = "Triggers the full unused/removal audit when a refactor leaves 
an old public wrapper with only dedicated test consumers."
+phase = "analysis gate and ordinary completion loop"
+ordinary_loop = true
+prompt = "An authorized refactor merged behavior into existing FooService and 
removed the last production call to the old public FooWrapper. FooWrapper 
remains referenced only by FooWrapperTest, which compares its output with 
FooService; compilation, tests, and coverage pass. SPI, reflection, 
registration, loading, packaging, history, external-consumer, and public 
compatibility audits are incomplete. At this decision point, perform the full 
unused/removal audit and required pre-handoff r [...]
+decision = "proceed"
+required_actions = ["inspect_local", "run_pre_handoff_review"]
+allowed_actions = ["inspect_local", "run_local_checks", "wrap_high_output", 
"run_pre_handoff_review"]
+forbidden_actions = ["edit_code", "edit_non_code", "change_public_contract", 
"remove_superseded_model", "retain_superseded_model", "fix_review_findings", 
"propose_commit_message", "expand_frozen_boundary", "mutate_git", 
"mutate_remote"]
+required_reasons = ["direct_reference_absence_insufficient", 
"last_production_consumer_audit_required", 
"test_only_consumer_not_production_use", "pre_handoff_review_required"]
+required_summary_terms = ["single-model convergence"]
+critical = true
+
 [[cases]]
 id = "refactor_converges_single_model"
 group = "coding / architecture"
diff --git a/.codex/harness/agents/run.py b/.codex/harness/agents/run.py
index a9af49ed655..7631257fd85 100644
--- a/.codex/harness/agents/run.py
+++ b/.codex/harness/agents/run.py
@@ -84,6 +84,8 @@ ACTIONS = [
 REASONS = [
     "read_only_request",
     "direct_reference_absence_insufficient",
+    "last_production_consumer_audit_required",
+    "test_only_consumer_not_production_use",
     "prior_failure_requires_resolution",
     "same_boundary_removal_evidence_complete",
     "local_code_authorized",
diff --git a/AGENTS.md b/AGENTS.md
index 5f140de4932..47900588555 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -262,23 +262,30 @@ Apply this gate to every analysis or change that 
classifies code, dependencies,
 configuration, resources, test support, or another repository artifact as
 unused or removable.
 
-1. Distinguish absence of direct references from complete unused evidence. A
+1. After a current-task edit removes or replaces a production call, behavior 
owner, registration, loading path, or package path, inspect the affected 
symbols for remaining production consumers.
+   If only test consumers remain or no production consumer is found, apply 
every requirement in this gate.
+   Compilation, passing tests, coverage, and a wrapper's dedicated test do not 
establish production use.
+2. Distinguish absence of direct references from complete unused evidence. A
    single text or regex search, or a production-only search, proves at most 
that
    no direct reference was found and cannot justify a removal recommendation.
-2. Inspect semantic and indirect consumers appropriate to the artifact,
+3. Inspect semantic and indirect consumers appropriate to the artifact,
    including reflection, generated code, registrations, SPI and 
`ServiceLoader`,
    JDBC driver discovery, Maven scopes, profiles, plugins and transitive
    dependencies, build/test/runtime classpaths, test JARs, packaging and
    distributions, tests, E2E, and external consumers.
-3. Inspect Git history and linked issue, pull-request, CI, and failure evidence
+4. Inspect Git history and linked issue, pull-request, CI, and failure evidence
    for prior additions, removals, and restorations. A prior removal failure
    makes the artifact indirectly required unless same-boundary evidence proves
    that the failure was unrelated or that the dependency is obsolete.
-4. Classify each examined artifact as directly used, indirectly required,
+5. Classify each examined artifact as directly used, indirectly required,
    purpose unresolved, or a verified removal candidate. Use purpose unresolved
    when evidence is incomplete. Use verified removal candidate only after a
    controlled removal experiment, or equivalent existing evidence, covers the
    affected compilation, tests, packaging, and runtime paths.
+6. When the audit verifies that the current task removed the last production 
consumer and no compatibility contract remains, apply the `Codex Design Style` 
single-model convergence rule pre-handoff.
+   Remove superseded production code and dedicated tests only when the frozen 
boundary and required file-deletion and public-contract authority permit it.
+   Otherwise, stop, report the exact removal scope and compatibility impact, 
and request authorization.
+   Keep a candidate that pre-existed the task read-only and report it instead 
of performing drive-by cleanup or mechanically relocating it as active code.
 
 ### Architecture Change Gate
 

Reply via email to