docs: tambah doc comment, logging, dan inline comments di semua 255 file

Meliputi:
- File-level //! doc comment: tujuan file, alur kerja, komponen utama
- Function-level /// doc comment: apa, parameter, return, flow, edge cases
- Struct/enum/trait /// doc comment: peran, field docs
- Tracing logging (tracing::info!/debug!/trace!/warn!/error!) di setiap fungsi
- Inline comments untuk variable dan branching logic penting
- Seluruh 8 crates di workspace: zesdex-backend, zesdex-cms, zesdex-entities,
  zesdex-iam, zesdex-infra, zesdex-ipc, zesdex-middleware, zesdex-utils
- Build: 0 errors, 242/242 tests passed
This commit is contained in:
asepharyana
2026-07-19 17:05:47 +07:00
parent 6680795ce7
commit 5aaedbf787
255 changed files with 5666 additions and 743 deletions
+22
View File
@@ -8,11 +8,21 @@ use ratatui::style::{Modifier, Style};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Borders, Paragraph};
use ratatui::Frame;
use tracing;
/// Render the persistent right-hand dashboard: Workflow, Tasks, and Usage
/// widgets stacked in three roughly-equal vertical thirds.
///
/// Flow: check whether the workflow engine has active agents (which
/// determines the vertical split ratios) → partition the sidebar area
/// into three stacked chunks → delegate each chunk to its widget fn.
pub fn draw_sidebar(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
let has_workflow = !state.workflow_engine.agents.is_empty();
tracing::debug!(
area = %format!("{}x{}", area.width, area.height),
has_workflow,
"draw_sidebar"
);
let constraints = if has_workflow {
vec![
@@ -40,7 +50,11 @@ pub fn draw_sidebar(frame: &mut Frame, area: Rect, state: &crate::app::state::re
/// Compact Tasks widget: `misc.todo_content` split into lines, truncated
/// to whatever fits with a trailing "+N more" hint pointing at `/todo`.
///
/// Flow: measure available height → split todo_content into lines →
/// trim to fit → render inside a bordered block.
fn draw_tasks_widget(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
tracing::debug!(area = %format!("{}x{}", area.width, area.height), "draw_tasks_widget");
let block = Block::default()
.title(Span::styled(
" Tasks ",
@@ -100,6 +114,7 @@ fn draw_tasks_widget(frame: &mut Frame, area: Rect, state: &crate::app::state::r
/// line silently clips (no `.wrap()` on this `Paragraph`) once token
/// counts reach 5-6 digits, which is routine for an agent session.
fn draw_usage_widget(frame: &mut Frame, area: Rect, state: &crate::app::state::rest::AppStateRest) {
tracing::debug!(area = %format!("{}x{}", area.width, area.height), "draw_usage_widget");
let block = Block::default()
.title(Span::styled(
" Usage ",
@@ -176,6 +191,13 @@ pub(crate) fn compute_usage_summary(
session_start: i64,
now_ms: i64,
) -> UsageSummary {
tracing::debug!(
tokens_in = usage.tokens_in,
tokens_out = usage.tokens_out,
review_tokens = usage.review_tokens,
api_calls = usage.api_calls,
"compute_usage_summary"
);
let total_tokens = usage.tokens_in.saturating_add(usage.tokens_out);
let self_learning_tokens = usage.review_tokens;
let main_tokens = total_tokens.saturating_sub(self_learning_tokens);