Repository navigation
fix: validate explicit worker filters at startup - #379
Conversation
Reject unknown filter names by task kind before connecting, preserving name-only and case-sensitive task registration semantics. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0af01a5-0dfa-4e71-a660-c4186e65d7e0
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 1
Open (3)
Entity-name validation usesname.toLowerCase()whenignoreCaseis true, butregisteredis… · New If the explicit filter list contains duplicates (or repeated missing names), the error message will… · Newjest.getTimerCount()assertions can be brittle if other test setup in the same file/suite… · New
What changed in this PR
Adds startup-time validation for explicit work-item filters so workers fail fast when filters reference unregistered task names, preventing invalid filter configs from reaching the service.
Changes:
- Validate explicit filter names in
TaskHubGrpcWorker.start()before gRPC/client startup and worker loop initialization. - Add/adjust Jest coverage for grouped validation errors, retry-after-registration, already-running precedence, and Azure-managed builder behavior.
- Update README + CHANGELOG to document the new startup validation behavior and migration guidance.
| File | Description |
|---|---|
| packages/durabletask-js/src/worker/task-hub-grpc-worker.ts | Adds _validateWorkItemFilters() and calls it early in start() to reject unknown explicit filter names. |
| packages/durabletask-js/test/worker-startup.spec.ts | Adds comprehensive unit tests for validation behavior and “no side effects before validation” guarantees. |
| packages/durabletask-js/test/work-item-filters.spec.ts | Updates explicit-filter precedence test to register the explicit names (now required). |
| packages/durabletask-js-azuremanaged/test/unit/worker-builder.spec.ts | Adds regression test ensuring builder registrations are applied before validation and gRPC startup is avoided on failure. |
| README.md | Documents the new validation behavior, casing rules, and retry guidance. |
| CHANGELOG.md | Records the breaking behavior change: explicit unknown filter names now fail at start(). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
AI-assisted review of I also assessed all three open review threads: the entity-casing warning is a false positive because registry keys are already lowercase; duplicate missing names are optional diagnostic polish; and the zero-timer assertion is valid with the current fresh fake-timer setup. None is a blocker. Thread resolution is left to the reviewer; this is not a human approval. kaibocai (@kaibocai) could you review and approve this PR when satisfied? |



Summary
What changed?
worker.start(), after the already-running guard and before creating the gRPC client or worker loop.Why is this change needed?
A worker can register
ProcessOrderbut explicitly filter for a misspelled or unregistered name. Previouslystart()succeeded and sent the invalid filter to the service; the local registration mistake was not reported at startup. Nowstart()rejects locally and tells the caller to register the missing names or remove the filters. Valid configurations behave as before.Issues / work items
Project checklist
CHANGELOG.mdstart(). README and the upcoming breaking-change notes document this.AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
AI verification (required if AI was used):
Testing
Automated tests
start()instead of rejecting; the builder reached the guarded gRPC creation boundary.Exact commands from repository root (Windows PowerShell):
Formatting: scoped Prettier checking with
--end-of-line crlfreports existing deviations in the worker, filter spec, and README. Comparing the exact formatter edits against base5eca577aab8cf42631dc9afcc1606f1450a843d4confirms no new formatting deviations in any changed file; checkout CRLF is preserved. This is not a blanket full-file Prettier pass.Manual validation (only if runtime/behavior changed)
start()and produced the expected filter.Notes for reviewers
5eca577aab8cf42631dc9afcc1606f1450a843d4; candidate tree:7f3b79f5317e16d322d0d1a766520ac4b78fc3e7. Six files, +294/-2; production change is confined to the existing worker.