Skip to content

docs: aumenta cobertura de JSDoc nos módulos core (#89)#593

Open
nikolasdehor wants to merge 1 commit intoSynkraAI:mainfrom
nikolasdehor:docs/jsdoc-coverage-improvement
Open

docs: aumenta cobertura de JSDoc nos módulos core (#89)#593
nikolasdehor wants to merge 1 commit intoSynkraAI:mainfrom
nikolasdehor:docs/jsdoc-coverage-improvement

Conversation

@nikolasdehor
Copy link
Contributor

@nikolasdehor nikolasdehor commented Mar 12, 2026

Summary

  • Adiciona e melhora JSDoc em 25+ funções/métodos públicos em 5 módulos core, com tags @param, @returns, @throws e @example
  • Módulos cobertos: config-loader.js, master-orchestrator.js, recovery-handler.js, gate-evaluator.js, dashboard-emitter.js
  • Nenhuma alteração de lógica -- apenas documentação JSDoc adicionada

Detalhes por módulo

config-loader.js (9 funções)

  • isCacheValid, loadFullConfig, loadConfigSections, loadAgentConfig, loadMinimalConfig, preloadConfig, clearCache, validateAgentConfig, getConfigSection
  • Adicionados @throws para funções que lançam erros, @example para as mais usadas

master-orchestrator.js (7+ métodos)

  • startDashboard, stopDashboard, saveState, finalize, clearState, listSavedStates
  • StubEpicExecutor: constructor e execute agora documentados com @param e @returns

recovery-handler.js (7 métodos)

  • getLogs, getEpicLogs, getAttemptHistory, getAttemptCount, canRetry, resetAttempts, clear
  • Adicionados @example em getLogs, getAttemptHistory, canRetry

gate-evaluator.js (3 métodos)

  • clear, _log, getLogs com tipos de retorno e parâmetros documentados

dashboard-emitter.js (classe + constructor)

  • Descrição expandida da classe com padrão de uso
  • Constructor documentado com comportamento de session ID e NODE_ENV

Test plan

  • npm run lint passa sem erros
  • npm test passa (nenhuma lógica alterada)
  • JSDoc tags validados manualmente nos 5 arquivos

Closes #89

Summary by CodeRabbit

  • Documentation

    • Enhanced configuration loading system documentation with TTL-based caching, performance metrics, and comprehensive validation details.
    • Expanded orchestration lifecycle documentation for dashboard integration, state persistence, and finalization processes.
    • Clarified recovery and diagnostic logging across multiple system components.
  • Improvements

    • Strengthened internal logging and diagnostic capabilities for better system observability.

…, events, resilience)

Melhora a cobertura de JSDoc em 5 módulos core, adicionando @param,
@returns, @throws e @example a 25+ funções/métodos públicos:

- config-loader.js: 9 funções com JSDoc expandido
- master-orchestrator.js: 7 métodos + StubEpicExecutor documentado
- recovery-handler.js: 7 métodos públicos com tags completos
- gate-evaluator.js: 3 métodos com documentação melhorada
- dashboard-emitter.js: classe e constructor documentados

Ref: SynkraAI#89
@vercel
Copy link

vercel bot commented Mar 12, 2026

@nikolasdehor is attempting to deploy a commit to the Pedro Valério Lopez's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added area: agents Agent system related area: workflows Workflow system related squad mcp type: test Test coverage and quality area: core Core framework (.aios-core/core/) area: installer Installer and setup (packages/installer/) area: synapse SYNAPSE context engine area: cli CLI tools (bin/, packages/aios-pro-cli/) area: pro Pro features (pro/) area: health-check Health check system area: docs Documentation (docs/) area: devops CI/CD, GitHub Actions (.github/) labels Mar 12, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Walkthrough

This pull request enhances documentation across core configuration, event handling, and orchestration modules by adding and expanding JSDoc comments and docstrings to improve overall code documentation coverage without modifying functional logic or control flow.

Changes

Cohort / File(s) Summary
Configuration Module Documentation
core/config/config-loader.js
Expanded docblocks for loadFullConfig, loadConfigSections, loadAgentConfig, and other public methods to clarify TTL-based cache behavior, lazy-loading semantics, return types, and error conditions. Added performance metrics documentation and extended validateAgentConfig to document detailed validation results including missing/available sections.
Event Handling Documentation
core/events/dashboard-emitter.js
Added comprehensive docblock for DashboardEmitter class describing non-blocking HTTP POST behavior with 500ms timeout, fallback to JSONL file, automatic disabling in test environments, and session handling using CLAUDE_CODE_SESSION_ID or random UUID.
Orchestration Modules Documentation
core/orchestration/gate-evaluator.js, core/orchestration/recovery-handler.js, core/orchestration/master-orchestrator.js
Enhanced JSDoc for multiple modules: gate-evaluator.clear(), _log(), and getLogs(); recovery-handler method descriptions (getLogs, getEpicLogs, getAttemptHistory, canRetry, resetAttempts, clear); master-orchestrator dashboard lifecycle (startDashboard, stopDashboard), state persistence (saveState, clearState, listSavedStates, finalize), and StubEpicExecutor.execute() with explicit return type documentation.
Manifest File Update
install-manifest.yaml
Updated generated_at timestamp and regenerated sha256 hashes and file sizes for config-loader.js, dashboard-emitter.js, gate-evaluator.js, master-orchestrator.js, and recovery-handler.js to reflect content changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Suggested labels

area: core, area: docs

Suggested reviewers

  • Pedrovaleriolopez
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #89 objectives. It adds JSDoc to low-priority modules (config, events, gate-evaluator, recovery-handler, master-orchestrator) but omits high and medium-priority modules (bob-orchestrator, greenfield-handler, brownfield-handler, session-state, lock-manager, data-lifecycle-manager). Complete JSDoc coverage for high and medium-priority modules listed in issue #89 to reach the 80% coverage target and fully satisfy the issue requirements.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'docs: aumenta cobertura de JSDoc nos módulos core (#89)' clearly and specifically describes the main change—enhancing JSDoc documentation coverage in core modules to address issue #89.
Out of Scope Changes check ✅ Passed All code changes are in-scope JSDoc enhancements targeting core modules. The install-manifest.yaml update reflects file hash changes from documentation additions, which is expected and appropriate.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.aiox-core/core/config/config-loader.js (1)

93-126: ⚠️ Potential issue | 🟡 Minor

loadFullConfig() is documented as cache-aware, but it always hits disk.

The TTL short-circuit only exists in loadConfigSections(). Direct callers of the exported loadFullConfig() API will still re-read core-config.yaml on every call, so the new JSDoc currently overstates the behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.aiox-core/core/config/config-loader.js around lines 93 - 126,
loadFullConfig always reads from disk; update it to honor the same cache TTL
used by loadConfigSections by checking configCache.full and configCache.lastLoad
against the cache TTL before reading: if a valid cached config exists return it
immediately (skipping file read and the performanceMetrics increment), otherwise
proceed to read/parse the file, update performanceMetrics and then set
configCache.full and configCache.lastLoad before returning; reference
loadFullConfig, configCache.full, configCache.lastLoad, and performanceMetrics
in your change.
.aiox-core/core/orchestration/master-orchestrator.js (1)

1540-1579: 🛠️ Refactor suggestion | 🟠 Major

Keep the stub result shape compatible with real executors.

The fallback currently returns only { status, epicNum, message, timestamp }, but the standard executor contract in .aiox-core/core/orchestration/executors/epic-executor.js:64-81 also carries success, artifacts, errors, duration*, startTime, endTime, and logs. When this path is hit, downstream code has to special-case the stub or risk breaking on missing fields.

Proposed contract-compatible stub result
   async execute(_context) {
+    const timestamp = new Date().toISOString();
+
     console.log(chalk.yellow(`   ⚠️  Using stub executor for Epic ${this.epicNum}`));
     console.log(chalk.gray(`      Real executor (${this.config.executor}) not yet implemented`));
     console.log(chalk.gray('      See Story 0.3: Epic Executors'));
 
     // Return minimal success result for pipeline to continue
     return {
       status: 'stub',
       epicNum: this.epicNum,
+      success: true,
+      artifacts: [],
+      errors: [],
+      duration: '0m 0s',
+      durationMs: 0,
+      startTime: timestamp,
+      endTime: timestamp,
+      logs: [],
       message: `Stub executor for ${this.config.name}`,
-      timestamp: new Date().toISOString(),
+      timestamp,
     };
   }
As per coding guidelines, "Ensure backwards compatibility — core modules are consumed by all agents."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.aiox-core/core/orchestration/master-orchestrator.js around lines 1540 -
1579, The stub executor's execute method returns a minimal object missing fields
required by the real executor contract; update StubEpicExecutor.execute to
return the same shape as real executors (see epic-executor.js) by adding success
(boolean), artifacts (array), errors (array), logs (array), startTime and
endTime (ISO timestamps), and duration (numeric, e.g. 0) in addition to status,
epicNum, message and timestamp; populate message using this.config.name and
ensure success is true and artifacts/errors/logs are empty so downstream code
can treat the stub result identically to real executor results.
🧹 Nitpick comments (1)
.aiox-core/core/orchestration/recovery-handler.js (1)

684-697: Avoid returning live attempt records from getAttemptHistory().

{ ...this.attempts } only clones the top-level map. Callers still get the original attempt arrays/objects, so mutating the returned value can change canRetry() and escalation behavior from outside the handler. A deep copy or read-only view would make this accessor safe.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.aiox-core/core/orchestration/recovery-handler.js around lines 684 - 697,
getAttemptHistory currently returns a shallow copy of this.attempts so callers
receive live arrays/objects that can mutate internal state; change
getAttemptHistory to return a deep copy (e.g. use structuredClone(this.attempts)
or JSON.parse(JSON.stringify(this.attempts)) depending on environment) or return
frozen/read-only copies so external changes won't affect canRetry() or
escalation logic; update the getAttemptHistory implementation to build and
return cloned arrays/objects for each epic key (referencing the attempts
property and getAttemptHistory function) to ensure immutability of returned
attempt records.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.aiox-core/core/config/config-loader.js:
- Around line 93-126: loadFullConfig always reads from disk; update it to honor
the same cache TTL used by loadConfigSections by checking configCache.full and
configCache.lastLoad against the cache TTL before reading: if a valid cached
config exists return it immediately (skipping file read and the
performanceMetrics increment), otherwise proceed to read/parse the file, update
performanceMetrics and then set configCache.full and configCache.lastLoad before
returning; reference loadFullConfig, configCache.full, configCache.lastLoad, and
performanceMetrics in your change.

In @.aiox-core/core/orchestration/master-orchestrator.js:
- Around line 1540-1579: The stub executor's execute method returns a minimal
object missing fields required by the real executor contract; update
StubEpicExecutor.execute to return the same shape as real executors (see
epic-executor.js) by adding success (boolean), artifacts (array), errors
(array), logs (array), startTime and endTime (ISO timestamps), and duration
(numeric, e.g. 0) in addition to status, epicNum, message and timestamp;
populate message using this.config.name and ensure success is true and
artifacts/errors/logs are empty so downstream code can treat the stub result
identically to real executor results.

---

Nitpick comments:
In @.aiox-core/core/orchestration/recovery-handler.js:
- Around line 684-697: getAttemptHistory currently returns a shallow copy of
this.attempts so callers receive live arrays/objects that can mutate internal
state; change getAttemptHistory to return a deep copy (e.g. use
structuredClone(this.attempts) or JSON.parse(JSON.stringify(this.attempts))
depending on environment) or return frozen/read-only copies so external changes
won't affect canRetry() or escalation logic; update the getAttemptHistory
implementation to build and return cloned arrays/objects for each epic key
(referencing the attempts property and getAttemptHistory function) to ensure
immutability of returned attempt records.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 720c4ed3-e500-4d35-a5e7-d70cfdfb0c16

📥 Commits

Reviewing files that changed from the base of the PR and between f74e3e7 and 3f42e8b.

📒 Files selected for processing (6)
  • .aiox-core/core/config/config-loader.js
  • .aiox-core/core/events/dashboard-emitter.js
  • .aiox-core/core/orchestration/gate-evaluator.js
  • .aiox-core/core/orchestration/master-orchestrator.js
  • .aiox-core/core/orchestration/recovery-handler.js
  • .aiox-core/install-manifest.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: cli CLI tools (bin/, packages/aios-pro-cli/) area: core Core framework (.aios-core/core/) area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/) area: health-check Health check system area: installer Installer and setup (packages/installer/) area: pro Pro features (pro/) area: synapse SYNAPSE context engine area: workflows Workflow system related mcp squad type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: increase docstring coverage to 80%

1 participant