Skip to content

Commit 91c643d

Browse files
committed
feat: 接通 Maven Javadoc 多文件诊断与稳定修复任务
1 parent 63e09f7 commit 91c643d

23 files changed

Lines changed: 1823 additions & 48 deletions

‎README.md‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ codeguard comments java . --java-home /absolute/jdk21 --maven-tool /absolute/mvn
846846

847847
The independent `java_comments_feedback 0.1.0` wrapper preserves the existing report under `native_observation`; the old `lint java --checker javadoc` protocol remains unchanged. Budget precedence is CLI, registered environment, project default, then built-in default. All native child work shares one deadline. Feedback exposes target kind, budget, observations and next actions. Zero local diagnostics still means `coverage_proven=false`, `delivery_decision=not_evaluated`, exit3 (130 on cancellation). No implicit installation or source changes occur.
848848

849-
**Scope limitation:** Maven multi-file workbench integration remains incomplete; standalone files can explicitly bind --workspace as described below. Trusted closure remains incomplete. This entry creates no fake tasks and does not close findings from a local probe. Replace the absolute tool paths and offline-repository digest with real current values.
849+
**Scope limitation:** Maven multi-file task synchronization is connected; Maven original-task verification, trusted closure/recurrence and actual host acceptance remain incomplete; standalone files can explicitly bind --workspace as described below. Trusted closure remains incomplete. This entry creates no fake tasks and does not close findings from a local probe. Replace the absolute tool paths and offline-repository digest with real current values.
850850

851851
### Javadoc project workbench integration (source increment)
852852

@@ -863,7 +863,7 @@ flowchart LR
863863
C -->|Failure| H[Visible persistence error without fake tasks]
864864
```
865865

866-
Missing configuration or incomplete execution creates preparation records, not source violations or new mandatory delivery obligations. Feedback exposes `workbench.status/new_findings/new_blockers/next`. Persistence failures return no fake tasks. Briefs and task text include evidence, rule basis, scope, steps, recheck and closure conditions. Local zero diagnostics leave prior tasks open with `task_verify_status=local_observation_only`; original-task rechecks are described below. Maven multi-file workbench integration remains incomplete; explicit-file integration is described below, as do trusted closure and actual host acceptance.
866+
Missing configuration or incomplete execution creates preparation records, not source violations or new mandatory delivery obligations. Feedback exposes `workbench.status/new_findings/new_blockers/next`. Persistence failures return no fake tasks. Briefs and task text include evidence, rule basis, scope, steps, recheck and closure conditions. Local zero diagnostics leave prior tasks open with `task_verify_status=local_observation_only`; original-task rechecks are described below. Maven multi-file task synchronization is connected; Maven original-task verification, trusted closure/recurrence and actual host acceptance remain incomplete; explicit-file integration is described below, as do trusted closure and actual host acceptance.
867867

868868
### Recheck the original Javadoc task (source increment)
869869

@@ -886,7 +886,7 @@ flowchart LR
886886
F -->|No| H[Continue rule repair or environment recovery]
887887
```
888888

889-
Current protocols: bound-workbench wrapper `java_comments_feedback 0.4.0`, Javadoc brief0.3, native container `javadoc_task_recheck 0.2.0`, public `task_verification_preview 0.27.0`. Older schemas remain readable. `task_verify_status=local_observation_only` means local rechecks are connected; trusted closure remains unaccepted. Zero diagnostics after documentation repair only records an absence candidate and leaves the task open. Whitelist approval, full project-rule attribution and actual host acceptance remain independent work. Maven multi-file workbench remains incomplete; explicit-file integration is described below.
889+
Current protocols: bound-workbench wrapper `java_comments_feedback 0.4.0`, Javadoc brief0.3, native container `javadoc_task_recheck 0.2.0`, public `task_verification_preview 0.27.0`. Older schemas remain readable. `task_verify_status=local_observation_only` means local rechecks are connected; trusted closure remains unaccepted. Zero diagnostics after documentation repair only records an absence candidate and leaves the task open. Whitelist approval, full project-rule attribution and actual host acceptance remain independent work. Maven multi-file task synchronization is connected; Maven original-task verification, trusted closure/recurrence and actual host acceptance remain incomplete; explicit-file integration is described below.
890890

891891
### Explicit Java file workbench (source increment)
892892

@@ -899,4 +899,17 @@ codeguard task verify CG-<task-identity> . --java-home /absolute/jdk21 --format
899899

900900
Observation0.2, brief0.3 and recheck0.2 add `observation_scope`: `explicit_file_probe` means an explicitly selected file and requires null configuration references; `configured_project_probe` still selects main sources through original project configuration. Task rechecks preserve the original mode. Adding a POM later cannot turn a file probe into a project check. Lines only locate evidence; original rule/file/anchor identity stays stable. A missing JDK creates preparation tasks only. Local zero diagnostics or synchronization never closes a task.
901901

902-
The bound-workbench wrapper is now `java_comments_feedback 0.4.0`, public verification is `task_verification_preview 0.27.0`; older schemas remain available. Human output also shows workbench status, task identity, mode, next step and recheck arguments. Maven multi-file workbench integration, trusted closure/recurrence and actual host acceptance remain incomplete.
902+
The bound-workbench wrapper is now `java_comments_feedback 0.4.0`, public verification is `task_verification_preview 0.27.0`; older schemas remain available. Human output also shows workbench status, task identity, mode, next step and recheck arguments. Maven multi-file task synchronization is connected; Maven original-task verification, trusted closure/recurrence and actual host acceptance remain incomplete.
903+
904+
### Maven Javadoc multi-file workbench (source increment)
905+
906+
In an initialized workspace, `comments java` with explicit Maven context persists native multi-file observations under `.codeguard/reports/` and creates stable repair tasks. Missing configuration or incomplete execution creates preparation tasks. A bounded source/POM snapshot is captured before native execution and checked again before persistence. Import revalidates current hashes, build-root ownership, the original POM, observed tool identities, rules and locations, then recomputes finding projections. Tampered or changed inputs cannot create new source findings. Consumed historical reports retain their original digest receipts after source edits.
907+
908+
```bash
909+
codeguard comments java . --maven-tool /absolute/mvn --java-home /absolute/jdk21 --maven-repo /absolute/offline-repo --repo-sha256 <actual-repository-digest> --format json
910+
codeguard next . --format json
911+
```
912+
913+
The Maven-bound wrapper is `java_comments_feedback 0.5.0`, the saved observation is `maven_javadoc_workbench_observation 0.1.0`, and the inner repair brief is0.4 with `observation_scope=configured_maven_multifile_probe`. Existing JDK file/project wrappers and recheck protocols remain available. Feedback includes the stable task, evidence, native rule, allowed scope and original Maven rescan arguments. `task_verify_status=not_integrated` explicitly identifies the missing Maven task-verification integration; a JDK single-file check cannot substitute for it. Preparation tasks restore the environment, repeat scans reuse the task, and local zero diagnostics do not close historical tasks.
914+
915+
This covers the existing simple static-POM direct-replay probe. Effective models, complex projects, Maven original-task verification, trusted closure/recurrence, actual hosts and release acceptance remain open. This increment uses controlled Maven process fixtures and does not claim actual plugin execution. See `tests/acceptance/maven-javadoc-workbench.md`.

‎README.zh-CN.md‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ flowchart LR
869869
F -->|否| H[按规则继续修复或恢复环境]
870870
```
871871

872-
当前版本:绑定工作台包装 `java_comments_feedback 0.4.0`、Javadoc修复简报0.3、原生复检容器 `javadoc_task_recheck 0.2.0`、公开 `task_verification_preview 0.27.0`。旧schema保持可读;`task_verify_status=local_observation_only` 表示已接通局部复检,正式可信关闭仍未验收。补齐文档后的零诊断只记录消失候选并保持open;白名单审批、原完整项目规则归因与实际宿主仍需独立完成。Maven多文件工作台仍未接通;显式文件工作台见下方。
872+
当前版本:绑定工作台包装 `java_comments_feedback 0.4.0`、Javadoc修复简报0.3、原生复检容器 `javadoc_task_recheck 0.2.0`、公开 `task_verification_preview 0.27.0`。旧schema保持可读;`task_verify_status=local_observation_only` 表示已接通局部复检,正式可信关闭仍未验收。补齐文档后的零诊断只记录消失候选并保持open;白名单审批、原完整项目规则归因与实际宿主仍需独立完成。Maven多文件任务同步已接通,Maven原任务复检、可信关闭/复发及真实宿主验收仍待完成;显式文件工作台见下方。
873873

874874
### 显式 Java 文件工作台(源码增量)
875875

@@ -882,4 +882,17 @@ codeguard task verify CG-<任务身份> . --java-home /absolute/jdk21 --format j
882882

883883
持久观察0.2、修复简报0.3及原任务复检0.2增加 `observation_scope`:`explicit_file_probe` 为显式单文件诊断,配置引用必须为空;`configured_project_probe` 仍按项目原配置筛选主源码。原任务复检沿首次模式,不能因为后来新增POM把文件探针变成项目检查。行号只定位,稳定身份仍按原规则/文件/锚点归并。缺JDK只产生准备任务;局部零诊断及同步仍不关闭原任务。
884884

885-
当前绑定工作台包装为 `java_comments_feedback 0.4.0`,公开任务复检为 `task_verification_preview 0.27.0`;旧schema保留。Human输出也显示工作台状态、任务身份、模式、下一步与复检参数。Maven多文件工作台、可信关闭/复发及真实宿主验收仍待完成。
885+
当前绑定工作台包装为 `java_comments_feedback 0.4.0`,公开任务复检为 `task_verification_preview 0.27.0`;旧schema保留。Human输出也显示工作台状态、任务身份、模式、下一步与复检参数。Maven多文件任务同步已接通,Maven原任务复检、可信关闭/复发及真实宿主验收仍待完成。
886+
887+
### Maven Javadoc 多文件工作台(源码增量)
888+
889+
已初始化项目使用显式 Maven 上下文运行 `comments java` 时,原生多文件诊断保存到 `.codeguard/reports/` 并归并稳定修复任务;缺配置或未完成执行生成准备任务。工作台在原生执行前捕获有界源码/POM快照,保存前再核对当前字节;导入时重新核对摘要、构建根、原POM、工具观察身份、规则和位置,并重算问题投影。篡改、越界或输入变化不产生新的源码问题。已消费历史报告按原摘要收据保留,不因后来修复源码反复变成导入失败。
890+
891+
```bash
892+
codeguard comments java . --maven-tool /absolute/mvn --java-home /absolute/jdk21 --maven-repo /absolute/offline-repo --repo-sha256 <实际仓库摘要> --format json
893+
codeguard next . --format json
894+
```
895+
896+
Maven绑定包装为 `java_comments_feedback 0.5.0`,保存观察为 `maven_javadoc_workbench_observation 0.1.0`,修复简报内部版本0.4且 `observation_scope=configured_maven_multifile_probe`。JDK文件/项目模式保留0.4包装及已有复检协议。反馈包含稳定任务身份、证据引用、原生规则、允许范围和原Maven重扫argv。`task_verify_status=not_integrated` 明示Maven原任务复检尚未接通,不能套用JDK单文件复检;准备任务只恢复环境,不修改无关源码。重复扫描不重复建任务,局部零诊断不关闭历史任务。
897+
898+
当前只覆盖既有简单静态POM直接重放探针;完整生效模型、复杂项目、Maven原任务复检、可信关闭/复发、真实宿主及发行仍需验收。本轮验证使用受控Maven进程夹具,不冒充真实插件执行。详见 `tests/acceptance/maven-javadoc-workbench.md`。

‎crates/codeguard-cli/src/java_comments_command.rs‎

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::discovery::discover;
77
use crate::java_javadoc_command::{Args, observe};
88
use crate::java_javadoc_scan::{NativeContext, observe_project};
99
use codeguard_adapters::legacy_registry;
10-
use codeguard_runtime::NativeObservation;
10+
use codeguard_runtime::{NativeObservation, SourceSnapshot};
1111
use serde_json::json;
1212
use std::collections::{BTreeSet, HashSet};
1313
use std::path::PathBuf;
@@ -129,6 +129,7 @@ pub fn run(args: &[String]) -> ExitCode {
129129
}
130130
let deadline = Instant::now() + Duration::from_millis(timeout);
131131
let cancelled = AtomicBool::new(false);
132+
let mut maven_snapshot = None;
132133
let mut report = json!({"schema_version":"0.1.0", "report_type":"java_comments_feedback", "operation":"comments", "language":"java", "category":"comments", "target_kind":"unavailable", "command_status":"incomplete", "exit_code":3, "reason":"target_unavailable", "execution_budget":budget_record(timeout, source), "native_observation":null, "discovery":null, "coverage_proven":false, "authority":"local_unverified", "delivery_decision":"not_evaluated", "workbench_status":"not_integrated", "next_actions":["依据原生诊断修复注释或配置;使用相同原生上下文重新执行 comments java", "Javadoc 持久任务适配尚未接通,不能据此关闭任务"]});
133134
if let Ok(path) = target.canonicalize() {
134135
if path.is_file() {
@@ -157,6 +158,27 @@ pub fn run(args: &[String]) -> ExitCode {
157158
.get("java")
158159
.map(|language| language.source_files.clone())
159160
.unwrap_or_else(BTreeSet::new);
161+
if maven_tool.is_some() {
162+
let paths: BTreeSet<PathBuf> = sources
163+
.iter()
164+
.map(PathBuf::from)
165+
.chain(
166+
discovery
167+
.checker_configurations
168+
.iter()
169+
.filter(|c| c.checker_id == "java.maven.javadoc")
170+
.map(|c| PathBuf::from(&c.configuration_ref)),
171+
)
172+
.collect();
173+
maven_snapshot = SourceSnapshot::capture(
174+
&path,
175+
paths,
176+
100_001,
177+
16 * 1024 * 1024,
178+
128 * 1024 * 1024,
179+
)
180+
.ok();
181+
}
160182
report["native_observation"] = observe_project(
161183
&path,
162184
&sources,
@@ -185,13 +207,26 @@ pub fn run(args: &[String]) -> ExitCode {
185207
.filter(|p| p.is_dir() && p.join(".codeguard/workspace.json").exists())
186208
});
187209
if let Some(root) = root {
188-
report["schema_version"] = json!("0.4.0");
189-
report["workbench"] = crate::javadoc_workbench::connect(&root, &report);
210+
let maven = report["native_observation"]["probe_mode"] == "maven_multifile";
211+
report["schema_version"] = json!(if maven { "0.5.0" } else { "0.4.0" });
212+
report["workbench"] = if maven {
213+
crate::maven_javadoc_workbench::connect(&root, &report, maven_snapshot.as_ref())
214+
} else {
215+
crate::javadoc_workbench::connect(&root, &report)
216+
};
190217
report["workbench_status"] = report["workbench"]["status"].clone();
191-
report["next_actions"] = json!([
192-
"按本次显式文件或项目配置模式核对原生诊断与工作台简报",
193-
"按原任务运行task verify保存原工具复检;可信关闭尚未接通,局部零诊断不能关闭任务"
194-
]);
218+
if maven {
219+
report["next_actions"] = json!([
220+
"依据Maven原生诊断及稳定任务恢复环境或修复注释,使用相同原POM、Maven、JDK和固定离线仓库重跑comments java",
221+
"Maven原任务task verify及可信关闭尚未接通,零诊断和勾选不能关闭任务"
222+
]);
223+
}
224+
if !maven {
225+
report["next_actions"] = json!([
226+
"按本次显式文件或项目配置模式核对原生诊断与工作台简报",
227+
"按原任务运行task verify保存原工具复检;可信关闭尚未接通,局部零诊断不能关闭任务"
228+
]);
229+
}
195230
}
196231
let exit = if codeguard_runtime::sigint_cancellation_requested()
197232
|| report["reason"] == "request_cancelled"

‎crates/codeguard-cli/src/lib.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ pub mod java_comments_command;
151151
#[cfg(unix)]
152152
mod javadoc_workbench;
153153
#[cfg(unix)]
154+
mod maven_javadoc_workbench;
155+
#[cfg(unix)]
154156
mod javadoc_task_recheck;
155157
mod java_javadoc_scan;
156158
#[cfg(unix)]

0 commit comments

Comments
 (0)