-
Notifications
You must be signed in to change notification settings - Fork 0
Slice 8: Server Module Boundary Hardening #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arndvs
wants to merge
5
commits into
v2
Choose a base branch
from
ai/refactor/server-module-boundary
base: v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e51c525
refactor(routes): eliminate direct fs calls from route handlers
arndvs c6deeea
feat(server): add barrel export for server module boundary
arndvs 91e1acd
fix(storage): validate ext against ASSET_EXTS and normalize path segm…
arndvs 554dbd9
fix(server): narrow barrel exports to hide internals and lazy imports
arndvs 99a38cb
docs(outputs): update hardening comment to reflect readOutputFile
arndvs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /** | ||
| * Server module barrel export — the public API surface. | ||
| * | ||
| * Everything exported here becomes the Fastify service API when the backend | ||
| * migrates from Next.js API routes. Route handlers in `app/api/` are thin | ||
| * pass-throughs that map HTTP → these functions → HTTP responses. | ||
| * | ||
| * Import rules: | ||
| * ✅ app/api/* → lib/cast/server/* (routes call server functions) | ||
| * ✅ lib/cast/server/* → lib/cast/* (server uses shared schemas/types) | ||
| * ❌ app/api/* → node:fs/promises (no direct I/O in route handlers) | ||
| * ❌ app/api/* → @azure/* (no direct Azure calls in routes) | ||
| * ❌ components/ → lib/cast/server/* (client code never imports server) | ||
|
Comment on lines
+10
to
+13
|
||
| */ | ||
|
|
||
| // -- Config (env var accessors) --------------------------------------------- | ||
| // `getGenAIMode` is deliberately excluded — use the re-export from | ||
| // pipeline/genai which wraps it with the canonical GenAIMode type. | ||
| export { | ||
| getOpenAIApiKey, | ||
| type StorageBackend, | ||
| getStorageBackend, | ||
| getAzureConnectionString, | ||
| isAzureEnabled, | ||
| getQdrantUrl, | ||
| getQdrantApiKey, | ||
| isQdrantEnabled, | ||
| getFatigueThreshold, | ||
| type AdsProvider, | ||
| getAdsProvider, | ||
| getApiBaseUrl, | ||
| } from "./config" | ||
|
|
||
| // -- Helpers ---------------------------------------------------------------- | ||
| export * from "./api-helpers" | ||
| export * from "./magic-bytes" | ||
| export * from "./safe-join" | ||
| export * from "./retry" | ||
|
|
||
| // -- Loaders ---------------------------------------------------------------- | ||
| export * from "./brand-loader" | ||
| export * from "./brief-loader" | ||
|
|
||
| // -- Storage ---------------------------------------------------------------- | ||
| export * from "./storage" | ||
| export { | ||
| type Container, | ||
| type StorageAdapter, | ||
| getStorageAdapter, | ||
| } from "./storage-adapter" | ||
| // AzureBlobAdapter is NOT re-exported — it is lazy-loaded by | ||
| // getStorageAdapter() via dynamic import(). Eagerly re-exporting it | ||
| // would pull in @azure/storage-blob for every consumer of this barrel. | ||
| export type { AzureBlobAdapter } from "./azure-blob-adapter" | ||
|
|
||
| // -- Metadata --------------------------------------------------------------- | ||
| export * from "./metadata" | ||
|
|
||
| // -- NDJSON streaming ------------------------------------------------------- | ||
| export * from "./ndjson-emit" | ||
|
|
||
| // -- Pipeline stages -------------------------------------------------------- | ||
| export * from "./pipeline/compose" | ||
| export * from "./pipeline/compliance" | ||
| export * from "./pipeline/genai" | ||
| export * from "./pipeline/manifest-builder" | ||
| export * from "./pipeline/resize" | ||
| export * from "./pipeline/resolve" | ||
| export * from "./pipeline/write" | ||
|
|
||
| // -- MCP tools -------------------------------------------------------------- | ||
| export * from "./mcp-tools" | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.