Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:173TECH Sayn Task Query Resolution

From Leeroopedia
Knowledge Sources
Domains CLI, Graph_Theory
Last Updated 2026-10-17 00:00 GMT

Overview

Technique for filtering a task execution graph through include/exclude operations with upstream and downstream dependency expansion, enabling selective task execution from the command line.

Description

Task query resolution allows users to execute a subset of the task DAG by specifying include (-t) and exclude (-x) selectors. Each selector can be:

  • A task name: -t load_users
  • A group selector: -t group:sql_models
  • A tag selector: -t tag:incremental
  • With upstream expansion: -t load_users+ (includes all ancestors)
  • With downstream expansion: -t model_users- (includes all descendants)

This solves the problem of running only relevant tasks during development without modifying the project structure.

Usage

Use this principle when building a CLI for a task-based system where users need to selectively execute portions of a dependency graph. It is the right choice when tasks have complex interdependencies and users need fine-grained control over what runs.

Theoretical Basis

The query resolution algorithm:

  1. Parse the CLI query string into a list of operations (include/exclude)
  2. Sort operations: includes first, then excludes
  3. For each operation, expand the task name:
    • upstream=True: traverse parents recursively
    • downstream=True: traverse children recursively
  4. Union (include) or subtract (exclude) the expanded set from the result

The group: and tag: prefixes expand to all tasks in that group or with that tag before applying upstream/downstream expansion.

Practical Guide

# Run only load_users and its upstream dependencies
sayn run -t load_users+

# Run all tasks in the "models" group
sayn run -t group:models

# Run all tasks tagged "incremental"
sayn run -t tag:incremental

# Run everything except test tasks
sayn run -x group:tests

# Combine: run models and their upstream, exclude raw_load tasks
sayn run -t group:models+ -x group:raw_load

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment