Trackers, planner and telemetry

Where jobs come from, what the planner may suggest, and the records kept on this machine.

Also in factory/: Configuration, Pipeline settings, Reviewers, models and skills.

Tracker: a Jira board

By default the tracker is GitHub issues: jobs come from open issues with the queue label, and people reply in issue and pull request comments. With kind = "jira", a Jira kanban board is the tracker. New jobs are the cards in its queue column, each step's card sits in a column of the board, and people reply in Jira comments or by moving the card. Code, branches and pull requests stay on GitHub. A project can also take jobs from both: see GitHub issues and a Jira board together.

[tracker]
kind = "jira"

[tracker.jira]
site = "https://acme.atlassian.net"
board = 1234
jql = "assignee = currentUser()"

[tracker.jira.columns]
queue = "Ready for factory"
intake = "Intake"
ask-author = "Needs info"
spec = "Spec"
build = "Build"
gate = "Build"
review = "Review"
approve = "Review"
ready-to-merge = "Ready to merge"
escalated = "Escalated"
done = "Done"
rejected = "Rejected"
failed = "Failed"

The account email may be set in factory.toml. The API token never is. It comes from a file, the process environment, or .env at the root of the repository.

[tracker.jira]
email = "you@example.com"       # optional. Empty: read email_env
token_file = ".secrets/jira"    # optional. One line, the token only
export JIRA_API_TOKEN="..."
# export JIRA_EMAIL="you@example.com"   # used when email above is empty

When token_file is empty, the token is the variable named by token_env (default JIRA_API_TOKEN) in the process environment. If that variable is unset, the same key is read from .env. .env is read for that one key. It is not loaded into the environment. export JIRA_API_TOKEN="..." and matching quotes are accepted. $ inside the value is not expanded.

token_file is a path relative to the repository, an absolute path, or a path starting with ~. The file holds the token on one line. A missing, empty, or multi-line file is an error. When token_file is set, the environment and .env are not read for the token.

A factory.toml committed for a team leaves email and token_file empty, so each operator uses JIRA_EMAIL and JIRA_API_TOKEN, or a private .env. Do not commit .env or the token file.

KeyDefaultMeaning
[tracker] kindgithubgithub, jira, or both as a list: ["github", "jira"].
[tracker.jira] siteThe Jira Cloud site. https:// only.
[tracker.jira] boardThe kanban board's id: the number in its address. Its saved filter scopes the queue.
[tracker.jira] jql""Narrows the queue further, ANDed with the board's filter. A filter only: no ORDER BY. assignee = currentUser() keeps the queue to cards assigned to the operator.
[tracker.jira] assignees[]Who the dashboard's second Jira tab shows. me is the account that loads the board. Any other entry is the name on the card. Empty, or only me: the tab is Assigned to me and the board starts on All. A longer list starts on that list. A click on All in the browser stays on All. This does not change the queue.
[tracker.jira] email""The account email. Empty: read email_env.
[tracker.jira] email_env, token_envJIRA_EMAIL, JIRA_API_TOKENNames of the environment variables. email_env is read when email is empty. token_env is read when token_file is empty, and then in .env. Sent only to site.
[tracker.jira] token_file""Path to a file that holds the token on one line. When set, this file is the token, and the environment and .env are not read.
[tracker.jira] issue_typeTaskThe type of an issue the factory files itself.
[tracker.jira] maintainers[]Jira account ids that may answer a maintainer step. Empty: anyone who can be assigned the issue.
[tracker.jira] viaautorest, acli, or auto. See Reaching Jira.
[tracker.jira] project""The project's key. Required with acli; with REST the board says it.

Columns

[tracker.jira.columns] maps a step, an end state (done, rejected, failed) or queue to a Jira status. The factory moves the card when the job enters the step.

A card Jira will not move, because the workflow has no such transition, is reported as a note: line and does not stop the job.

A board that works well

Give each place where a person acts a column of its own, and let the factory's steps share a few:

Backlog | Ready for factory | Intake | Needs info* | Spec | Build | Review | Ready to merge* | Escalated* | Done | Rejected

* marks the columns where you act. The factory moves cards through the others.

  1. Keep Backlog apart from the queue column. Moving a card to Ready for factory is the decision to build it. With REST the top card is built first, so rank the column.
  2. Give every step that waits for a person its own column, distinct from the columns its outcomes lead to. Otherwise moving the card cannot say which outcome is meant, and the step is answered by comment only.
  3. Let the factory's steps share: build, gate and debug in Build; review and approve in Review.
  4. Put only the end columns (Done, Rejected, and Failed when verify is on) in Jira's Done category. A card in a Done-category status counts as a closed issue, and no job starts from one.
  5. Let every status move to every other in the workflow.

mfactory tracker suggest prints this board for your pipeline, steps you added and switched on included, with the [tracker.jira.columns] to paste. Run it again after changing the steps. Jira's API cannot set a board's columns, so create them in the board's settings, then check with mfactory tracker show.

Answering by moving the card

A person answers a human step with a Jira comment, as on GitHub. They can also move the card: moving it to the status of one of the step's edge targets is that outcome.

StepMove the card toOutcome
spec-approvalthe status of buildAPPROVE
spec-approvalthe status of spec, after a comment saying what to changeCHANGES
any human stepthe status of rejectedREJECT
escalatedthe status of buildFEEDBACK

These come from the graph, not from a list: an edge through a step that is switched off counts as the step the job lands in. Words for the move are the mover's newest comment. REJECT needs none, and neither does FEEDBACK at [run].escalate_to.

Any other move by a person is moved back, with one comment that says why and names the statuses that are answers: a status two outcomes share, a status that is no edge target, a move by someone the step's who does not allow, or a move while an agent works on the job. To put a job at another step, use mfactory move <job> <step>.

who works as on GitHub, with Jira accounts: author is the reporter, operator is the account the token belongs to, maintainer is anyone who can be assigned the issue (or maintainers), and a list holds account ids.

When the board changes

.factory/bin/mfactory tracker show      # each step, its status and its column, and what is wrong
.factory/bin/mfactory tracker sync      # put every unfinished job's card in its step's status
.factory/bin/mfactory tracker suggest   # the board that works well for the steps you have now

tracker show names a status Jira does not have, a status on no column of the board, statuses no step uses, and a move the pipeline needs that the workflow does not allow. Jira lists transitions for an issue, not for a workflow, so a status is checked through a card that is in it now; the rest are listed as not checked. mfactory doctor runs the same checks.

After renaming a column or editing [tracker.jira.columns], run tracker sync. mfactory queue also moves a card that is where the factory left it and no longer where the mapping says.

Reaching Jira: REST or acli

The factory reaches Jira through its REST API. The email comes from email or email_env. The token comes from token_file, or from token_env in the environment, or from that key in .env. When either is missing, it falls back to the Atlassian CLI, acli, which signs in on its own:

acli jira auth login --web
viaMeaning
autoThe default. REST while the email and the token are both found. Otherwise acli, when it is installed. A token_file that is missing or unusable is an error, not a fallback.
restREST only. Missing credentials are an error.
acliacli only, also when the credentials are set.

acli reaches less of Jira than REST does, so with it:

mfactory doctor says which of the two is in use.

Every comment the factory writes ends with the line — mfactory. The factory posts from the operator's own account, and that line is how it tells its comments from ones the operator typed, whichever way Jira is reached.

What else differs from GitHub issues

GitHub issues and a Jira board together

[tracker]
kind = ["github", "jira"]

[tracker.jira]
site = "https://acme.atlassian.net"
board = 1234

[tracker.jira.columns]
queue = "Ready for factory"
# ... a status for each step, as above
[run]
authors = { github = ["alice"], jira = ["712020:8a7d2c6e-1f6b-4c8e-9d1a-2b3c4d5e6f70"] }
pipes:
  default:
    steps:
      spec-approval:
        who: { github: [alice], jira: ["712020:8a7d2c6e-1f6b-4c8e-9d1a-2b3c4d5e6f70"] }

Planner

The planner reads the queue of every project in the workspace and suggests duplicates, dependencies, overlap, conflicts, and priority inversions. It only suggests. mfactory plan approve and plan release are what change a tracker or a job. How to read the findings is on the workspace page.

[planner]
enabled = true
frequency = "medium"
alert_at = "high"
max_pairs = 40
max_extra = 10
priority = { labels = { urgent = "critical" }, jira = { Showstopper = "critical" } }
KeyDefaultMeaning
[planner] enabledtrueScan open tickets. false turns off the plan commands that read or change findings.
[planner] frequency"medium"high every 5 minutes, medium every 30, low every 240. A scan runs when tickets changed and the interval has passed. manual never scans by itself.
[planner] alert_at"high"Findings at this severity or above count on the dashboard badge and under Needs attention: low, medium, or high.
[planner] max_pairs40Ticket pairs a scan may look at.
[planner] max_extra10Extra pairs the scan agent may add. The rest of its draft is dropped.
[planner] priorityempty mapsExtra names for critical, high, and low, plus an optional GitHub Projects field.

Telemetry

Local execution records. Telemetry does not choose the next step, and a write failure does not fail the job. Nothing leaves the machine. Commands are on the CLI page.

[telemetry]
enabled = true
storage = "jsonl"
retention_days = 90
fail_open = true
KeyDefaultMeaning
[telemetry] enabledtruefalse writes no telemetry files.
[telemetry] storage"jsonl"The only store in this version.
[telemetry] retention_days90Used by mfactory telemetry prune. Prune is explicit.
[telemetry] fail_opentrueA telemetry error is recorded and the job continues. false makes that error fail the command.