Skip to content

refactor: consolidate constants and minor dedup (Phase 12)#830

Merged
pedramamini merged 1 commit intoRunMaestro:rcfrom
jSydorowicz21:dedup/phase-12-constants-minor
Apr 16, 2026
Merged

refactor: consolidate constants and minor dedup (Phase 12)#830
pedramamini merged 1 commit intoRunMaestro:rcfrom
jSydorowicz21:dedup/phase-12-constants-minor

Conversation

@jSydorowicz21
Copy link
Copy Markdown
Contributor

@jSydorowicz21 jSydorowicz21 commented Apr 13, 2026

Summary

Removes duplicate AUTO_RUN_FOLDER_NAME constants and cleans up related wrapper/barrel exports across the wizard / session pipeline.

Net: -37 lines across 17 files

Changes

  • 3 previous local definitions of AUTO_RUN_FOLDER_NAME now import PLAYBOOKS_DIR from src/shared/maestro-paths.ts
  • Dropped deprecated service wrappers that existed solely to forward to the canonical implementation
  • Dropped orphan barrel re-exports from Wizard/index.ts and Wizard/services/index.ts

Why this is smaller than the playbook target (~126 lines)

  • DEFAULT_CAPABILITIES was already consolidated in Phase 02 - double-counted in the original playbook
  • CSS class-name extraction was intentionally skipped - most Tailwind utility combos either appear in only 2-3 call sites (not worth a shared module) or are context-dependent (extracting them would force adding a theme/variant prop). Leaving this for a future round once a dedicated design-token system is in place.

Test plan

  • npm run lint passes (all 3 tsconfigs)
  • npx prettier --check . passes
  • 262 targeted tests pass (useSessionCrud, useSessionRestoration, useWizardHandlers, existingDocsDetector, WizardIntegration)
  • Wizard resumes existing Auto Run docs correctly (uses PLAYBOOKS_DIR for the scan)
  • Session creation routes to correct .maestro/playbooks/ directory

Risk

Very low. Pure constant consolidation - same value, different import path.

Remove duplicate AUTO_RUN_FOLDER_NAME constants and clean up related
wrappers across the wizard / session pipeline. All 3 previous local
definitions now import PLAYBOOKS_DIR from shared/maestro-paths.ts.

Also drops orphan barrel exports and deprecated service wrappers that
only existed to forward to the canonical implementation.

Net: 17 files changed, 30 insertions(+), 67 deletions(-) = 37 lines
removed.

Playbook target was ~126 lines but DEFAULT_CAPABILITIES was already
addressed in Phase 02, and CSS class extraction was deliberately NOT
done - most Tailwind utility combos were either too few (2-3 call
sites) or too context-dependent to warrant a shared constants file.

Verified:
- npm run lint clean (all 3 tsconfigs)
- npx prettier --check clean
- 262 targeted tests pass (useSessionCrud, useSessionRestoration,
  useWizardHandlers, existingDocsDetector, WizardIntegration)
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Warning

Rate limit exceeded

@jSydorowicz21 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 29 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 7 minutes and 29 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0c564e2c-2487-4245-bcd2-87208c2f9261

📥 Commits

Reviewing files that changed from the base of the PR and between b37cd16 and 5a2f5cb.

📒 Files selected for processing (17)
  • src/__tests__/renderer/components/Wizard/WizardIntegration.test.tsx
  • src/__tests__/renderer/hooks/useSessionCrud.test.ts
  • src/__tests__/renderer/hooks/useSessionRestoration.test.ts
  • src/__tests__/renderer/hooks/useWizardHandlers.test.ts
  • src/__tests__/renderer/utils/existingDocsDetector.test.ts
  • src/renderer/components/DebugWizardModal.tsx
  • src/renderer/components/Wizard/index.ts
  • src/renderer/components/Wizard/screens/ConversationScreen.tsx
  • src/renderer/components/Wizard/screens/DirectorySelectionScreen.tsx
  • src/renderer/components/Wizard/screens/PhaseReviewScreen.tsx
  • src/renderer/components/Wizard/services/index.ts
  • src/renderer/components/Wizard/services/phaseGenerator.ts
  • src/renderer/hooks/session/useSessionCrud.ts
  • src/renderer/hooks/session/useSessionRestoration.ts
  • src/renderer/hooks/wizard/useWizardHandlers.ts
  • src/renderer/services/inlineWizardDocumentGeneration.ts
  • src/renderer/utils/existingDocsDetector.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@pedramamini
Copy link
Copy Markdown
Collaborator

Thanks for the contribution, @jSydorowicz21! Clean work here — the consolidation of AUTO_RUN_FOLDER_NAME into a single PLAYBOOKS_DIR import is exactly the right call, and removing the deprecated re-export wrappers and orphan barrel exports keeps things tidy.

The test updates look correct too, including the expected-value fix in useSessionRestoration.test.ts where the old mock was using a stale .maestro-autorun value.

LGTM — approving.

@jSydorowicz21 jSydorowicz21 self-assigned this Apr 14, 2026
@jSydorowicz21 jSydorowicz21 marked this pull request as ready for review April 14, 2026 04:35
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 14, 2026

Greptile Summary

This PR consolidates three locally-defined AUTO_RUN_FOLDER_NAME constants into the canonical PLAYBOOKS_DIR import from src/shared/maestro-paths.ts, drops orphan barrel re-exports from Wizard/index.ts and Wizard/services/index.ts, and removes deprecated service wrappers. The refactor is semantically neutral — the constant value (.maestro/playbooks) is unchanged, verified by a dedicated test assertion.

Confidence Score: 5/5

  • Safe to merge — pure constant consolidation with no functional changes and verified value equivalence.
  • All 17 changed files are straightforward constant-swap refactors or test updates. The canonical PLAYBOOKS_DIR value ('.maestro/playbooks') is confirmed identical to the former local definitions, backed by an explicit test assertion. Barrel re-export removals are safe because no external callers import from those barrels. No logic, schema, or API surface was altered.
  • No files require special attention.

Important Files Changed

Filename Overview
src/renderer/utils/existingDocsDetector.ts Replaced local AUTO_RUN_FOLDER_NAME constant with PLAYBOOKS_DIR + LEGACY_PLAYBOOKS_DIR from shared module; logic and values unchanged.
src/renderer/hooks/session/useSessionCrud.ts Swapped local constant for PLAYBOOKS_DIR import; autoRunFolderPath construction at line 265 is functionally identical.
src/renderer/hooks/session/useSessionRestoration.ts Replaced local constant with PLAYBOOKS_DIR import for session migration fallback at line 168; behavior unchanged.
src/renderer/hooks/wizard/useWizardHandlers.ts Replaced local constant with PLAYBOOKS_DIR import; autoRunFolderPath construction at line 1139 unchanged.
src/renderer/components/DebugWizardModal.tsx Replaced local constant with PLAYBOOKS_DIR import; JSX expression at line 233 correctly renders the canonical path string for the debug hint.
src/renderer/components/Wizard/index.ts Removed orphan barrel re-exports; no external consumers of the removed identifiers found in the codebase.
src/renderer/components/Wizard/services/index.ts Removed orphan barrel re-exports alongside the Wizard/index.ts clean-up; safe since all callers import directly from source files.
src/renderer/components/Wizard/services/phaseGenerator.ts Replaced local constant with PLAYBOOKS_DIR import; template-variable substitution and path construction logic unchanged.
src/tests/renderer/utils/existingDocsDetector.test.ts Test suite imports PLAYBOOKS_DIR directly and verifies its value is '.maestro/playbooks'; good coverage of all exported functions.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["src/shared/maestro-paths.ts\nPLAYBOOKS_DIR = '.maestro/playbooks'"] --> B["existingDocsDetector.ts"]
    A --> C["useSessionCrud.ts"]
    A --> D["useSessionRestoration.ts"]
    A --> E["useWizardHandlers.ts"]
    A --> F["DebugWizardModal.tsx"]
    A --> G["ConversationScreen.tsx"]
    A --> H["DirectorySelectionScreen.tsx"]
    A --> I["PhaseReviewScreen.tsx"]
    A --> J["phaseGenerator.ts"]

    subgraph Before["Before (3 local duplicates)"]
        X1["const AUTO_RUN_FOLDER_NAME = '.maestro/playbooks'\nin existingDocsDetector.ts"]
        X2["const AUTO_RUN_FOLDER_NAME = '.maestro/playbooks'\nin useSessionCrud.ts"]
        X3["const AUTO_RUN_FOLDER_NAME = '.maestro/playbooks'\nin useSessionRestoration.ts"]
    end

    subgraph After["After (single canonical source)"]
        A
    end
Loading

Reviews (1): Last reviewed commit: "refactor: consolidate constants and mino..." | Re-trigger Greptile

@jSydorowicz21 jSydorowicz21 added refactor Clean-up needs ready to merge This PR is ready to merge labels Apr 15, 2026
@pedramamini pedramamini merged commit fdc9748 into RunMaestro:rc Apr 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved ready to merge This PR is ready to merge refactor Clean-up needs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants