* Avoid null endpoint DTO metadata in tests * Enforce console logs hub read permission * Remove unused console logs hub import * Support mapped endpoint metadata in auth tests * Reduce console log capture throughput impact * Address Copilot console logs review * Refactor task scheduling to support tenant-level background work and enhance logging functionality. * Introduce ConsoleStreamHook for stdout/stderr tee and enhance logging validation. Adjust test cases and startup warnings for distributed lock provider usage. * Refactor console logging pipeline with capture optimization and new ConsoleLogsHost; update tests accordingly. * Add Ansi SGR parser for console logs and associated unit tests * Remove ANSI color renderings and parsers; integrate ConsoleLogScopeAccessor for improved logging context with workflow instance ID support. * Address console logs code quality feedback * Address PR review feedback * Preserve console logs extension points * Stabilize console logs host lifecycle * Address final automated review comments * Tighten console log capture shutdown * Address console log review feedback * Address follow-up review feedback * Cover final review feedback * Avoid recursive console provider initialization * Guard console host lease shutdown * Preserve console log scope and provider lifetime * Correlate console log scope fallback * Tighten console scope correlation * Expose host services during provider construction * Redact ANSI-normalized console lines * Remove `ConsoleCaptureTee` and related services and tests * Use pipeline contributors for console log context * Update CShells package versions to 0.0.24-preview.132 * Filter live console logs by workflow instance * Enhance console logging with activity execution metadata and extend test coverage. * Address console logs stream consumption comment * Add diagnostics OpenTelemetry backend * Introduce dedicated workflow JSON type registry and hardening This change addresses GitHub issue #7541 by establishing a separate type registry (`IWorkflowJsonTypeRegistry`) for workflow JSON serialization. This decouples workflow type resolution from expression type aliases, enforcing a strict trust boundary. Key aspects: - New workflow JSON emits preferred aliases for registered types. - Existing persisted workflows can be loaded via registered legacy names. - Unknown, abstract, interface, open generic, or inappropriate collection types are rejected during deserialization, enhancing security. - Public APIs (e.g., incident strategies) now expose consistent workflow JSON type identifiers. This ensures secure, predictable, and backward-compatible handling of types within workflow definitions and payloads. * Remove unused project references and streamline console log endpoint * Move serialization type aliases to Elsa.Common * Update serialization integration fixtures for aliases * Stabilize missing rate limiter policy test
8.3 KiB
8.3 KiB
AGENTS.md
Guidance for AI coding agents working in this repository.
Project Overview
- Elsa Core is a .NET solution centered on
Elsa.sln. - Production code lives under
src/. - Tests live under
test/, grouped byunit,integration,component, andperformance. - Build automation is implemented with NUKE in
build/Build.csand exposed throughbuild.sh,build.ps1, andbuild.cmd.
Working Rules
- Keep changes focused on the requested task. Do not mix unrelated cleanup, formatting, or dependency updates into functional changes.
- Preserve existing public APIs unless the task explicitly requires an API change.
- Update tests when behavior changes and add tests for new behavior where practical.
- Update documentation when changing externally visible behavior, configuration, APIs, or developer workflows.
- Do not delete generated-looking, artifact, or IDE files unless the task explicitly asks for cleanup.
- If the worktree contains unrelated user changes, leave them untouched.
Agent Operating Principles
- Do not assume, hide confusion, or flatten uncertainty; surface questions, constraints, and tradeoffs explicitly.
- Write the minimum code that solves the defined problem; do not add speculative abstractions, features, or cleanup.
- Touch only the files and behavior required for the task; clean up only issues introduced by your own changes.
- Define success criteria before implementation, then iterate until the criteria are verified or clearly state what could not be verified.
Build And Test Commands
- Build the default target:
./build.sh - Run NUKE test target:
./build.sh Test - Build with dotnet directly:
dotnet build Elsa.sln - Run all tests directly:
dotnet test Elsa.sln - Run a specific test project:
dotnet test test/unit/Elsa.Workflows.Core.UnitTests/Elsa.Workflows.Core.UnitTests.csproj - Run ElsaScript DSL integration tests:
./run-dsl-tests.sh
Prefer targeted dotnet test <project> commands while iterating, then run a broader build or test command when the change affects shared infrastructure or cross-module behavior.
Code Style
- C# uses
LangVersionlatest, nullable reference types, and implicit usings fromDirectory.Build.props. - Projects under
src/targetnet8.0,net9.0, andnet10.0throughsrc/Directory.Build.props. - Follow
.editorconfig: 4-space indentation for C#, file-scoped namespaces, braces required,varpreferred, usings outside namespaces, and sorted system directives. - Prefer clear domain names over abbreviations. Keep types small and responsibilities explicit.
- Avoid suppressing warnings unless compatibility or framework constraints make the warning unavoidable; explain the reason near the suppression.
Repository Structure
src/apps/: runnable app hosts and sample packages.src/clients/: client libraries.src/common/: shared infrastructure and testing support.src/extensions/: extension packages.src/modules/: Elsa modules and feature packages.test/unit/: unit tests.test/integration/: integration tests.test/component/: component tests.test/performance/: performance tests.build/: NUKE build project.doc/,design/, andspecs/: documentation, design assets, and feature specifications.
Testing Guidance
- Place tests near the relevant existing test project rather than creating a new project by default.
- Use the existing shared testing helpers under
src/common/Elsa.Testing.Shared*when they fit the scenario. - For regressions, add a failing test that demonstrates the bug before or alongside the fix.
- For multi-targeting issues, consider whether the test must run against all target frameworks or only the affected one.
Dependency And Package Guidance
- Central package versions are managed in
Directory.Packages.props; do not add ad hoc versions to individual project files unless the repository already uses that pattern for the package. - Keep target framework changes centralized in
src/Directory.Build.propsunless a project has a specific reason to differ. - Be cautious with package upgrades because this repository targets multiple frameworks and modules.
Review Checklist
Before handing off changes, verify the following when applicable:
- The project or solution builds.
- Relevant unit or integration tests pass.
- Public API or behavior changes are documented.
- New code follows nullable annotations and existing style.
- No unrelated files were changed.
For additional context about technologies to be used, project structure,
shell commands, and other important information, read specs/010-workflow-json-hardening/plan.md.
Active Technologies
- C# latest, nullable reference types enabled, implicit usings enabled. +
Microsoft.Extensions.Logging,Microsoft.AspNetCore.SignalR, Elsa feature/module infrastructure, FastEndpoints through Elsa API endpoint patterns, existing Elsa identity/authorization features. (003-live-server-logs) - Bounded in-memory ring buffer for MVP; no EF Core schema changes. Provider abstraction allows external/shared log backends later. (003-live-server-logs)
- C# latest, nullable reference types enabled, implicit usings enabled. +
Microsoft.Extensions.Logging,Microsoft.Extensions.Options,Microsoft.AspNetCore.SignalR, Elsa feature/module infrastructure, FastEndpoints through Elsa API endpoint patterns, CShells shell feature infrastructure. (004-diagnostics-structured-logs) - Existing bounded in-memory ring buffer; no EF Core schema changes. Provider abstraction remains available for future shared backends. (004-diagnostics-structured-logs)
- C# latest, nullable reference types enabled, implicit usings enabled. + Existing
Elsa.Diagnostics.StructuredLogs,Microsoft.Extensions.Logging,Microsoft.Extensions.Options,Microsoft.AspNetCore.SignalR, Elsa feature/module infrastructure, FastEndpoints through Elsa API endpoint patterns, FluentMigrator runner packages, SQLite ADO.NET provider, and optionally Dapper for relational operations. (005-structured-log-persistence) - Bounded in-memory store by default; opt-in SQLite durable store through shared relational persistence. SQLite stores
TimestampandReceivedAtas UTC ISO-8601 text and stores exception, scope, and property payloads as JSON text. (005-structured-log-persistence) - C# latest, nullable reference types enabled, implicit usings enabled. +
Microsoft.Extensions.Options,Microsoft.AspNetCore.SignalR, Elsa feature/module infrastructure, FastEndpoints through Elsa API endpoint patterns, Elsa shell feature infrastructure, and existing Elsa identity/authorization patterns. (006-diagnostics-console-logs) - Bounded in-memory recent buffer and bounded subscriber queues by default; no durable database schema. Providers receive redacted content only. (006-diagnostics-console-logs)
- C# latest, nullable reference types enabled, implicit usings enabled. + Elsa feature/module infrastructure, FastEndpoints through Elsa API endpoint patterns, existing Elsa identity/authorization patterns, Elsa workflow input metadata,
Microsoft.Extensions.Configuration,Microsoft.AspNetCore.DataProtection, EF Core persistence infrastructure, mediator notifications, and optional JavaScript expression integration. (007-secrets-module) - In-memory store for tests/development; Elsa-managed encrypted store with EF Core persistence for production; configuration-backed read-only store for deployment-managed values. No cloud vault or OS certificate store provider in v1. (007-secrets-module)
Recent Changes
- 006-diagnostics-console-logs: Plans raw stdout/stderr console capture with redaction-before-provider boundaries, bounded in-memory recent/live buffers, REST backfill/source endpoints, and a SignalR live hub.
- 005-structured-log-persistence: Plans pluggable structured log storage with in-memory default and opt-in SQLite persistence using FluentMigrator.
- 004-diagnostics-structured-logs: Refactors the unpublished server logs module into diagnostics structured logs and preserves bounded structured
ILoggercapture. - 003-live-server-logs: Added C# latest, nullable reference types enabled, implicit usings enabled. +
Microsoft.Extensions.Logging,Microsoft.AspNetCore.SignalR, Elsa feature/module infrastructure, FastEndpoints through Elsa API endpoint patterns, existing Elsa identity/authorization features.