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.
| Key | Default | Meaning |
|---|---|---|
| [tracker] kind | github | github, jira, or both as a list: ["github", "jira"]. |
| [tracker.jira] site | The Jira Cloud site. https:// only. | |
| [tracker.jira] board | The 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_env | JIRA_EMAIL, JIRA_API_TOKEN | Names 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_type | Task | The 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] via | auto | rest, 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.
queueis required. It is the status new jobs are picked from, and it may be a list.watchis optional: a status, or a list of them, whose cards the dashboard shows in a Watching lane before the queue, with the same link and drawer. They are never built:queue,createand/mfactory runskip them, and/mfactory run <KEY>on one says to move it to the queue first. The board's filter andjqlscope them like the queue. A watched status cannot also bequeue, a step's or an end state's status.tracker showanddoctorcheck that each one is on the board. For example,watch = ["Pending Design", "Pending US Approval"].- A key is a step's name in the pipe, so a step you add, rename, or switch off needs no other change. A key that is not a step fails
mfactory sync, with the steps listed. - Steps may share a status, for a smaller board.
- A step with no status leaves the card where it is.
- The status is looked up each time it is used and is not stored on the job. Change one line and the next command uses it.
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.
- Keep
Backlogapart from the queue column. Moving a card toReady for factoryis the decision to build it. With REST the top card is built first, so rank the column. - 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.
- Let the factory's steps share:
build,gateanddebuginBuild;reviewandapproveinReview. - Put only the end columns (
Done,Rejected, andFailedwhen 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. - 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.
| Step | Move the card to | Outcome |
|---|---|---|
| spec-approval | the status of build | APPROVE |
| spec-approval | the status of spec, after a comment saying what to change | CHANGES |
| any human step | the status of rejected | REJECT |
| escalated | the status of build | FEEDBACK |
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
via | Meaning |
|---|---|
| auto | The 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. |
| rest | REST only. Missing credentials are an error. |
| acli | acli only, also when the credentials are set. |
acli reaches less of Jira than REST does, so with it:
[tracker.jira] projectis required. acli cannot read a board, so the project's key scopes the queue, which is then every card of the project in the queue status (andjql), oldest first.- A moved card is not an answer: acli shows no issue history, so nobody can be named for the move. The card is moved back with a comment, and people reply in comments.
- A
maintainerstep is answered by the operator or an account inmaintainers. acli cannot say who can be assigned an issue. tracker showanddoctorlist the mapping without comparing it to the board or the workflow.- The operator's account is read from an issue assigned to it or reported by it, so the account needs one.
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
- A job's issue is its Jira key, such as
PROJ-123:/mfactory run PROJ-123,mfactory answer PROJ-123 approve. - The branch is
<branch_prefix>PROJ-123-<job id>, the pull request title must contain the key, and its body starts withRefs PROJ-123, so Jira's development panel links them.branch_patternmust accept that branch. [project] issue_link = "closes"is refused when Jira is the only tracker: a pull request cannot close a Jira issue. With both trackers it applies to the GitHub issues.[labels]is not used. The queue column and the step columns say what the labels said.- Asks are posted on the Jira issue only, and comments on the pull request are not read as replies. A pull request merged by hand still continues the job.
mfactory close issuemoves the card to the status ofdone, or ofrejectedwith--not-planned.
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
- Both queues feed the project: open issues with the queue label, and the cards in the queue column. The queue takes one from each in turn, starting with the first tracker in
kind, so neither waits for the other to empty.[run].concurrencycaps them together. - Each job asks and listens on its own tracker. A job from a GitHub issue is asked on the issue or its pull request, with the factory's labels. A job from a Jira card is asked in Jira, and its card follows the job.
/mfactory approve 12and/mfactory approve PROJ-123both work. - Pull requests follow the issue. A GitHub issue's starts with
Refs #12, orCloses #12withissue_link = "closes". A Jira issue's starts withRefs PROJ-123and carries the key in its title. mfactory fileopens the issue on the first tracker inkind.mfactory file --tracker jira "<title>"chooses.[project] pr_titleandpr_title_patternapply to every job's pull request, so with both trackers the pattern must also accept a title without a Jira key.- People are named per tracker, because a GitHub login and a Jira account id can look the same. In
authorsandassignees, a tracker left out is not filtered. Awhotable names every tracker. The wordsauthor,maintainerandoperatorstay plain strings.
[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"] }
- When one tracker cannot be reached, the other's jobs carry on.
mfactory queueprintsproblem: Jira: <reason>, a job waiting on that tracker showscould not read Jira, and the dashboard shows the problem. When neither can be reached, the command fails as before. - A job keeps the tracker it came from, so adding a second tracker leaves jobs in flight running. A job whose tracker is taken out of
kindgets askiprow until the tracker is back. mfactory doctorchecks both.mfactory tracker showandtracker syncwork on the Jira board.
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" } }
| Key | Default | Meaning |
|---|---|---|
| [planner] enabled | true | Scan 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_pairs | 40 | Ticket pairs a scan may look at. |
| [planner] max_extra | 10 | Extra pairs the scan agent may add. The rest of its draft is dropped. |
| [planner] priority | empty maps | Extra 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
| Key | Default | Meaning |
|---|---|---|
| [telemetry] enabled | true | false writes no telemetry files. |
| [telemetry] storage | "jsonl" | The only store in this version. |
| [telemetry] retention_days | 90 | Used by mfactory telemetry prune. Prune is explicit. |
| [telemetry] fail_open | true | A telemetry error is recorded and the job continues. false makes that error fail the command. |