[APPS] Refactor backend discovery AST parsing#345
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
e3d487d to
8a9e82f
Compare
yoannmoinet
left a comment
There was a problem hiding this comment.
Just some nit, not blocking for them.
There was a problem hiding this comment.
Nit: Not a fan of barrel files in general, unless there is a very good reason for it. In this occurrence, the reason isn't particularly good IMO.
This usually leads to confusion, misdirection and build complexity.
There was a problem hiding this comment.
I was thinking it could reduce the number of changes in the initial PR. My plan was to remove the reference in the next PR but you're right the total number of references to this file are now very small. I'll remove this file 👍
| localName?: string; | ||
| source?: string; |
There was a problem hiding this comment.
Nit: Using optionals is often revealing some smells 😃
Can't we have this stricter?
There was a problem hiding this comment.
Backend functions are either defined within the *.backend.ts or they are imported then exported. I could probably break this down into a discriminated type union for the two cases.
8a9e82f to
e869c8d
Compare

Motivation
This is the first PR in the regenerated backend connection ID analysis stack. The existing backend discovery module mixes the core
BackendFunctiondata model, ESTree/Rollup AST type narrowing, export discovery, and callable export validation in one file. Splitting those concerns first gives the later connection ID extraction PRs a stable AST parsing home and keeps their reviews focused on behavior changes instead of file movement.Related planning context: plan 014, created after build-plugins#338 established the backend manifest upload plumbing.
Changes
This PR is intended to be behavior-neutral. It moves the core backend function datatype into
backend/types.tsand moves the existing AST export discovery implementation intobackend/ast-parsing/extract-backend-functions.ts.The old
backend/discovery.tsbarrel was removed in response to review feedback. Existing callers now import from the owning modules directly: core backend types frombackend/types.ts, and AST discovery helpers frombackend/ast-parsing/*.enumerateBackendExports(ast, filePath)now returns a stricter discriminated union instead of optional metadata fields:extractExportedFunctions(ast, filePath)continues to return the same string array as before. Existing validation semantics for unsupported backend export shapes are preserved.QA Instructions
Focused tests:
Manual linked-app verification against
/Users/scott.kennedy/dd/test-action-catalog-app/:The linked test app discovered and proxied all three imported backend functions, built all three backend bundles, produced the dry-run archive, and served generated backend proxy code in dev mode.
prepare-link --revertwas run afterward.Blast Radius
This PR affects High Code Apps backend function discovery in
@dd/apps-plugin. It should not change runtime behavior, manifest shape, dev preview payloads, backend proxy generation, or backend bundling. The main risk is an accidental import/export wiring regression from the module split, covered by the focused tests and apps-plugin E2E suite.Documentation