Conversation
Expose the cognite-function-apps local dev server through the toolkit CLI so users don't need the standalone `fun` CLI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2667 +/- ##
==========================================
+ Coverage 84.89% 85.09% +0.19%
==========================================
Files 436 440 +4
Lines 37014 37581 +567
==========================================
+ Hits 31423 31979 +556
- Misses 5591 5602 +11
🚀 New features to boost your workflow:
|
- Add landing page at `/` with function info, CDF project warning banner, and live log viewer via SSE - Add `/api/logs` (SSE) and `/api/status` (JSON) endpoints - Use toolkit's EnvironmentVariables auth path instead of cognite_function_apps' own env var reader, so all toolkit auth flows work - Show CDF project/cluster warning at CLI startup - Auto-open browser on server start - Add unit tests for validation, auth patching, and all middleware routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Default to "Warnings+" (WARNING/ERROR/CRITICAL only), with a toggle button to switch to "All" (INFO and above). Client-side filtering so all entries are still captured and available when switching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Block `cdf dev function serve` when CDF_BUILD_TYPE=prod with clear error - For all other configs: prompt user to acknowledge full read/write CDF access before starting (skipped in non-interactive/CI environments) - Reject classical functions (def handle(client, data)) with a helpful error — only Function Apps using cognite-function-apps are supported - Detect TracingApp in the handler's middleware chain and show tracing status + OTLP endpoint on the landing page - 22 unit tests (up from 12) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uvicorn's loggers (uvicorn, uvicorn.access, uvicorn.error) may have propagate=False, preventing records from reaching the root logger. Attach the _LogCollector handler directly to these loggers so the landing page SSE log stream captures all entries reliably. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Read validation-type from config.{env}.yaml instead of CDF_BUILD_TYPE env var.
Discover Function App handlers in the project and prompt user to pick one
when no path argument is given.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix type annotations in _LogCollector (dict[str, str] -> dict[str, Any]), change uvicorn parameter type from object to Any, and update type: ignore comments to match actual error codes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ections The /api/logs SSE connection stays open indefinitely, causing uvicorn to hang at "Waiting for connections to close" during reload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
cdf dev function servecommand that starts a local uvicorn dev server for testing Function App handlers/with function info, CDF project warning banner, tracing status, link to Swagger docs, and live log viewer with severity toggle (Warnings+ / All)prodvalidation-type configs entirely; prompts user to acknowledge full read/write CDF access for dev/stagingvalidation-typefromconfig.{env}.yaml(same as build/deploy), not from env varsdef handle(client, data)handlers; only Function Apps supportedcognite_function_appsto use the toolkit'sEnvironmentVariablesauth path, so all toolkit auth flows work/api/logswith severity toggle, status JSON at/api/statusTracingAppin the handler's middleware chain and displays tracing status on the landing pageChanges
pyproject.toml— newserveoptional dependency groupcommands/serve.py—ServeFunctionCommandwith:_discover_function_dirs()/_prompt_function_selection()for interactive handler discovery_load_validation_type()reading fromBuildConfigYAMLconfig files_check_build_type()blocking prod, prompting for dev/staging_validate_handler_is_function_app()rejecting classical functions_detect_tracing()inspecting the handler's ASGI middleware chain_patch_cognite_client_factory()for toolkit auth integrationcommands/_landing_page.py— Pure ASGI middleware: landing page HTML with warning banner, tracing row, log severity toggle, SSE log streaming, status APIapps/_dev_function_app.py—DevFunctionApptyper with optionalpathargument,--host,--port,--reload/--no-reload,--log-levelapps/_dev_app.py— wiresDevFunctionAppundercdf dev functiontests/test_serve.py— 22 unit tests covering validation, auth patching, build type checks, and all middleware routesTest plan
cdf dev function serve(no args) — discovers handlers, prompts selectioncdf dev function serve <path>— starts uvicorn, opens browser to landing page/docs, live log stream with toggle/docslink opens Swagger UI--reload: editing handler.py triggers reload visible in logscognite-function-apps[cli]installed, prints helpful install message🤖 Generated with Claude Code