Keep App Doctor engine internals behind scan, compile, and submit operations - #8513
Open
jplhomer wants to merge 2 commits into
Open
Keep App Doctor engine internals behind scan, compile, and submit operations#8513jplhomer wants to merge 2 commits into
jplhomer wants to merge 2 commits into
Conversation
CLI services now call scan, compile, parse, and submit operations instead of scanners, registries, merge helpers, and redaction internals. Engine tests still import those modules directly. Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
jplhomer
added this pull request to stack #8515
September 9, 2026 20:40
4 tasks
sortIssues moved into CLI output, FindingsDocument is not re-exported from the CLI adapter, and the unused Trace v1 type is gone with the public API shrink. Co-authored-by: AI (Pi/Grok 4.6) <noreply@pi.dev>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It’s a broad API-surface refactor across engine + CLI layers (including redaction and compile/merge flow relocation) that should receive final human review despite tests being updated.
Pull request overview
This PR refactors the App Doctor “engine” to expose a smaller public API surface (scan/compile/trace parsing/submission/instructions), keeping scanners, registries, merge helpers, and redaction internals encapsulated so engine changes don’t ripple into CLI command-layer code.
Changes:
- Introduces a new engine-facing “operations” module (
run.ts) and updates the engine’s public exports to re-export only supported CLI operations/types. - Updates CLI services (output rendering, instructions, artifacts, API orchestration) to use the new engine operations instead of importing engine internals.
- Adjusts tests (CLI + engine) to import from the new public surface or targeted internal modules, and updates redaction expectations to treat redaction as an engine contract.
File summaries
| File | Description |
|---|---|
| packages/app/src/cli/services/doctor-output.ts | Stop calling engine redaction helpers directly; render engine-redacted scan/findings and localize issue sorting. |
| packages/app/src/cli/services/doctor-output.test.ts | Update test expectations to assert engine-redacted content is rendered unchanged. |
| packages/app/src/cli/services/app-doctor-instructions.ts | Switch from embedded constant import to getAgentInstructions() operation. |
| packages/app/src/cli/services/app-doctor-instructions.test.ts | Assert getAgentInstructions() matches INSTRUCTIONS.md. |
| packages/app/src/cli/services/app-doctor-engine/types.ts | Remove legacy TraceV1 type from the shared types surface. |
| packages/app/src/cli/services/app-doctor-engine/tests/trace.test.ts | Update tests to import internal modules directly rather than the public engine index. |
| packages/app/src/cli/services/app-doctor-engine/tests/submission.test.ts | Update imports to use submission/trace internals instead of engine index. |
| packages/app/src/cli/services/app-doctor-engine/tests/scan-contract.test.ts | Update imports to use checks/registry/scanners/trace internals directly. |
| packages/app/src/cli/services/app-doctor-engine/tests/registry.test.ts | Update imports to use internal modules (checks/registry/scanners). |
| packages/app/src/cli/services/app-doctor-engine/tests/deterministic-rules.test.ts | Update imports to use internal modules (registry/scanners). |
| packages/app/src/cli/services/app-doctor-engine/run.ts | New engine “operations” module: scan/compile findings, parse findings/trace, and provide agent instructions. |
| packages/app/src/cli/services/app-doctor-engine/output/format.ts | Keep JSON redaction formatting; remove sorting helper export from engine output layer. |
| packages/app/src/cli/services/app-doctor-engine/index.ts | Narrow the public engine API to the new operations + required types/submission builder. |
| packages/app/src/cli/services/app-doctor-artifacts.ts | Use parseTrace() (engine operation) rather than importing trace validator internals. |
| packages/app/src/cli/services/app-doctor-artifacts.test.ts | Use scanApp() to generate a valid trace fixture via the engine surface. |
| packages/app/src/cli/services/app-doctor-api.ts | Move findings parsing/compile orchestration into engine operations; map engine findings errors to CLI AbortError. |
| packages/app/src/cli/services/app-doctor-api.test.ts | Adjust integration assertions to avoid importing internal check registry, while still validating behavior. |
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dmerand
approved these changes
Sep 10, 2026
dmerand
left a comment
Contributor
There was a problem hiding this comment.
Thanks for these changes!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
App Doctor CLI services imported scanners, check registries, merge helpers, trace validators, and redaction functions from the engine. Those internals made engine changes ripple into command-layer files.
WHAT is this pull request doing?
Expose only the operations the CLI needs: locate an app, scan, parse and compile findings, parse a stored trace, build a submission, and load agent instructions. Move compile/merge/findings-parse into the engine. CLI output, artifacts, and submit now use that surface; engine tests still import internal modules directly.
Display redaction stays an engine contract. The report layer renders already-redacted scan results instead of calling engine redact helpers.
No user-facing behavior change.
How to manually test your changes?
From an app directory:
Scan, compile, and dry-run submit should behave as they do on main.
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset add