Skip to content

fix: improve progress and warning output - #1154

Open
kireetivar wants to merge 19 commits into
fortify:dev/v3.xfrom
kireetivar:p/kireetivar/warn_cleanup
Open

kireetivar wants to merge 19 commits into
fortify:dev/v3.xfrom
kireetivar:p/kireetivar/warn_cleanup

Conversation

@kireetivar

@kireetivar kireetivar commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Improve console output readability.
Implement the agreed warning routing and exception formatting changes in fcli core and Aviator.

Aviator warning
  -> progress writer -> LOG.warn
     -> file log: full exception trace, when enabled
     -> console: masked message and exception details, without stack frames
        -> original stdout/stderr: clear progress and write under one lock
        -> captured/suppressed output: leave terminal progress unchanged
  • Route progress-writer warnings through LOG.warn, instead of printing and recording them separately at DEBUG.
  • Use a progress-aware console appender for complete log events, including warnings and errors from worker threads.
  • Keep original stdout and stderr coordinated, since both can share one terminal.
  • Use UnsynchronizedAppenderBase and resolve terminal width before rendering to avoid lock-order deadlocks.
  • Keep nested captures and suppressed output separate from physical progress.
  • Borrow the captured execution context for worker warnings without closing command-owned resources.
  • Respect an existing worker context and stderr redirect.
  • Remove duplicate Aviator warning paths and warnings sent as progress updates.
  • Add WARN: once. Preserve already-prefixed messages.
  • Move unknown comment-symbol diagnostics and selected internal diagnostics to DEBUG.
  • Document Log4j migration differences and native-image requirements.
  • Keep existing ERROR logging paths; do not add error-specific progress-writer methods.
  • Warn once with the original exception when discarding a corrupt session. Preserve required-lookup exceptions without duplicate logging.
  • Warn on unknown DAST response types and unrecognized audit request IDs. Keep completed duplicates at DEBUG without changing pending work or capacity.

Acceptance criteria

Criterion Coverage
Progress does not overlap warnings or errors Coordinate complete console log events and ordinary output with progress rendering.
Warnings use a consistent format Use one warning path and one WARN: prefix. Keep exception types, messages and causes visible.
Duplicate custom tag warnings appear once per command Preserve existing consolidation and cover it with regression tests.
Audit warnings appear only when applicable Keep unsupported comment-symbol diagnostics at DEBUG, without noisy default-console warnings.

Evidence

  • Before: Worker warnings could share a line with progress. Clearing progress before writing still allowed a concurrent redraw.
    After: Coordinator, appender and wrapper regression tests cover complete writes, nested writers and concurrent warnings.
  • Before: Lazy terminal-width initialization could log while another thread held the render lock.
    After: ProgressTerminalWidthLockOrderTest detects the unsafe order without hanging later tests.
  • Before: A captured warning or nested captured write could clear unrelated terminal progress.
    After: ProgressCaptureIsolationTest covers collection, suppression, worker captures, shared-terminal streams and blocked captures.
  • Before: Each worker warning created and closed a child execution context.
    After: Tests verify exact context reuse, open command-owned Unirest resources, clean worker stacks and existing worker-context precedence.
  • Focused progress tests pass. FcliExecutionContextTest: 8 passed. ProgressCaptureIsolationTest: 4 passed.
  • Six JVM module suites passed: 1,066 tests, with no failures or skipped tests.
    Modules: common-core, aviator-common, aviator, common-action, ai-assist and util.
  • Windows native build passed using build-native.ps1 and GraalVM CE 21.0.2.
  • Linux native build passed using WSL and CI-aligned static-musl flags.
    CI certificate distrust ran against an isolated GraalVM copy, without changing the global trust store.
  • UPX was unavailable. Both binaries are uncompressed. Linux static linking was verified.
  • OutputMaskingSpec and OutputMaskingRPCSpec passed on both binaries: 12 tests per platform, with no failures or skipped tests.
  • Earlier native probes passed for version/help, warning routing, console masking, and the previous ERROR-level behavior.
    Those binaries predate file-only log-level filtering and the review follow-up; native tests were not repeated for these changes.
  • Both debug/progress probes exited successfully, including invalid terminal-width initialization. No Logback initialization errors or hangs were reported.
  • File logs contain warnings and DEBUG output. However, the early argument-log masking check failed; see the finding below.
  • Native warning-with-throwable formatting was not tested. Unit coverage does not replace this native check.
  • Live SSC/Aviator SAST and DAST audits have not been run.
  • Review follow-up: 36 focused tests passed. After simplifying assertions, the 11 affected tests passed again.
    These overlap the earlier 36. Coverage includes session lookups, DAST anomalies, duplicates, and exhausted-retry reporting.

Open validation finding

Both native binaries write the synthetic action --secret value to the early argument log when --debug enables file logging.
Console masking checks pass. This finding concerns the file log, not console warning output.

Source inspection shows that FcliExecutionStrategy.logVersionAndArgs() runs before action-defined masks are registered.
The argument logger, action mask registration and file-log masking converter are unchanged from the branch base.
This points to an existing masking issue. A baseline native binary was not tested.
This PR does not change that separate registration order.

Blast Radius: CLI

Core logging and progress changes affect all fcli commands, including nested commands and RPC/MCP executions.

Observable changes:

  • --log-level filters the file log only. Console warnings remain visible, including with --log-level=ERROR.
  • Console exceptions show full type names, messages and cause details, without stack frames. Enabled file logs retain full traces.
  • Routed warnings use the progress-writer logger name in the file log.
  • Some Aviator diagnostics now require DEBUG.
  • Worker stderr fallback applies masking. Console encoding is explicitly UTF-8.
  • Original stdout/stderr share one rendering lock. A blocked original stream can delay progress and console logs.
    Captured and suppressed output does not take this lock.

Context propagation for unrelated direct LOG.* calls on worker threads remains outside this change.
Log4j requires separately tested exception patterns; its %ex{0} is not equivalent to Logback's pattern.

fix: `fcli`: Prevent console output from overlapping progress
fix: `fcli aviator`: Standardize warnings and reduce diagnostic noise

kireetivar and others added 8 commits November 2, 2026 10:32
Serialize console events and visible progress without holding a Logback appender monitor. Preserve worker stderr masking and routing, add severity-aware progress APIs, register native encoder metadata, and cover concurrency with regression tests.
Route audit diagnostics through one warning/error path, preserve throwable causes, normalize warning prefixes, and remove duplicate progress warnings. Include logger, correlation, and audit regression tests.
Move unknown comment-marker and unreadable-session diagnostics to DEBUG. Cover comment-marker behavior and document exception rendering and warning-level filtering.
Remove writeError*/errorWithException and restore the original LOG.error calls and AviatorLoggerImpl.error behavior. Warning routing is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The lazy terminal width initializer can log, and the console appender needs the render lock to emit. Resolving the width in a pre-render hook avoids a lock-order deadlock. Add a regression test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ProgressWriterPrintStreamWrapper cleared progress and wrote in two steps, so another thread could redraw progress in between. Do both under the render coordinator lock. Add regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep captured and suppressed output separate from terminal progress. Borrow the captured execution context for worker warnings without closing command resources, while preserving active worker contexts and stderr redirects.

Add capture isolation and context lifecycle regression tests, and document the output coordination rules for US 2287146.
Remove the null-logger fallback and placeholder conversion. Exercise the normal Aviator warning path in regression tests without swallowing initialization errors.

Restore the unchanged progress interface and wrapper to their original content, removing newline-only changes from the US 2287146 branch diff.
@kireetivar
kireetivar marked this pull request as ready for review November 2, 2026 10:16
@kireetivar kireetivar self-assigned this Nov 2, 2026
Preserve the common-fpr extraction and warning cleanup. Resolve correlation test imports against the extracted FPR types, retaining direct Aviator warning coverage and DEBUG-only comment-symbol diagnostics.

Validate with 739 JVM tests, 12 output masking and RPC functional tests, and a fresh fcli shadow JAR build.
Apply --log-level to the file appender threshold. Keep the root logger at WARN or the requested more detailed level so console warnings remain visible. Add regression coverage and update the logging documentation for US 2287146.
Report optional lookup failures once with the original exception. Preserve required lookup exceptions without duplicate logging. Cover both paths for US 2287146.
Warn on unknown response types and unrecognized audit request IDs without advancing work or releasing capacity. Keep completed duplicates at DEBUG and preserve error handling. Add regression coverage for US 2287146.
Verify one visible ERROR and a RETRY_LIMIT_EXCEEDED result with its reason. Check that late duplicates do not repeat completion or release capacity. Preserve DEBUG telemetry for US 2287146.
Explain captured stderr and worker redirect precedence. Document session and DAST warning policies and the blocking behavior of original console streams for US 2287146.

This branch has not been deployed

No deployments
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