Skip to content

feat: add background config property#7067

Merged
eduardoboucas merged 1 commit into
mainfrom
feat/background-config
May 19, 2026
Merged

feat: add background config property#7067
eduardoboucas merged 1 commit into
mainfrom
feat/background-config

Conversation

@eduardoboucas
Copy link
Copy Markdown
Member

Adds a new background boolean property to the in-source configuration object. When set to true, it marks the function as background without having to use the -background suffix in the filename.

Example: netlify/functions/hello.ts

import { Config, Context } from "@netlify/functions"

export default async (req: Request, context: Context) => {
	console.log("Hello from a background function")
}

export const config: Config = {
	background: true,
	path: "/hello-background"
}

@eduardoboucas eduardoboucas requested a review from a team as a code owner May 19, 2026 13:05
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8697d934-f44c-4aad-bbaf-3f912af6a9fe

📥 Commits

Reviewing files that changed from the base of the PR and between 41bf8da and 21720d4.

📒 Files selected for processing (4)
  • packages/zip-it-and-ship-it/src/config.ts
  • packages/zip-it-and-ship-it/src/runtimes/node/in_source_config/index.ts
  • packages/zip-it-and-ship-it/src/runtimes/node/index.ts
  • packages/zip-it-and-ship-it/tests/unit/runtimes/node/in_source_config.test.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for a new background configuration property, enabling functions to use background invocation mode. Background-designated functions now take precedence in mode selection over runtime defaults.
  • Tests

    • Added comprehensive unit tests for background configuration behavior in the Node.js runtime environment.

Walkthrough

This PR introduces support for a background boolean configuration property in function configs. The change allows functions to declare background invocation mode via in-source configuration alongside existing options like timeout and schedule. The implementation extends the Zod config schema, adds background to in-source config parsing for v2 API, and updates the Node.js runtime to prioritize background-marked functions over default stream invocation logic. New unit tests validate that background: true correctly maps to invocationMode: 'background' while absent or false values leave invocation mode unset.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description explains the feature and includes a practical example, but lacks issue reference, testing/documentation confirmation checklist items, and detailed motivation. Add the issue reference (Fixes #), confirm testing/documentation updates, and optionally provide more detailed motivation for this feature.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new background config property to the in-source configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/background-config

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

@eduardoboucas eduardoboucas enabled auto-merge (squash) May 19, 2026 14:03
@eduardoboucas eduardoboucas merged commit 74287e3 into main May 19, 2026
56 of 57 checks passed
@eduardoboucas eduardoboucas deleted the feat/background-config branch May 19, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants