Skip to content

refactor(work-items): dispatcher should export the resolved binding path to adapters #852

Description

@kyle-sexton

Context

Surfaced while implementing the Jira adapter (#379).

Problem

The work-item-tracker core dispatcher (work-item-tracker.sh) resolves and reads the binding (.work-item-tracker.json), then runs each adapter verb as a fresh bash <verb>.sh subprocess. Only a fixed set of vars crosses that boundary (exported by lib/binding.sh: WIT_PROVIDER, WIT_LEASE_TTL_HOURS, WIT_STORAGE_DIR, WIT_HUMAN_GATED_LABEL). Provider-specific config beyond those is NOT exposed.

Two consequences of this shape:

  1. lib/binding.sh carries a provider-specific leak. config.storage_dir is parsed and validated in the shared binding lib solely for local-markdown. Adding a second such key per provider (the Jira adapter needs config.jira.{site,project_keys,auth_email,auth_env,...}) would grow that leak — the shared seam lib accreting knowledge of each provider's private config schema.

  2. Adapters must re-resolve the binding to read their own config. The Jira adapter deliberately does NOT grow binding.sh; instead its common.sh sources lib/binding.sh and calls wit_find_binding a second time to jq its config.jira subtree. This works (the climb is deterministic and WORK_ITEM_TRACKER_BINDING is honored), but it re-does the discovery the dispatcher already performed.

Proposed fix

Have the dispatcher export the resolved binding path (e.g. WIT_BINDING_PATH) so an adapter reads its own provider-specific config.<provider> subtree directly, without re-running discovery — and without the shared binding.sh needing to know any provider's private config keys. binding.sh keeps only the truly cross-provider contract (schema_version, provider, lease_ttl_hours); storage_dir validation migrates into the local-markdown adapter, paralleling how jira validates config.jira in its own adapter.

Evidence

  • tools/work-item-tracker/lib/binding.shwit_read_binding special-cases local-markdown's config.storage_dir.
  • tools/work-item-tracker/work-item-tracker.sh — dispatches adapter verbs as bash <verb>.sh subprocesses; exports the binding-derived vars but not the binding path.
  • tools/work-item-tracker/adapters/jira/common.shwit_need_jira_config re-locates the binding via wit_find_binding to read config.jira.

Not blocking the Jira adapter (the re-resolve is clean); filing as the scoped structural follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyFully specified and briefed; eligible for autonomous pickup from the frontier.priority: lowNice-to-have, cosmetic, or speculative; opportunistic.work-class: scopedA briefed fix or small feature; blast radius bounded by the brief, tests exist.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions