Governance
Gates and rules
Ark gets its autonomy from its gates, not despite them. Every gate below exists because skipping it has already burned us at least once.
Person gates (non-negotiable)
| Align |
A person confirms problem, outcome, metrics, and constraints and sets
status: aligned
before os run will execute. The cheapest correction point in the whole lifecycle.
The gate has two checks: an intent whose status is anything but aligned or in-flight is refused
(draft, blocked, released, superseded and the rest; re-opening one is a person's call),
and so is an in-flight intent with no task graph and an empty run log,
because nothing was recorded between drafting it and flipping the status. An in-flight intent a person is
working by hand (the run log shows it) runs with a warning that says so.
Prefer os intent align <id> --by <name>: it prints the outcome, the base branch, the data
decision and every constraint back to the aligner, refuses on a consistency advisory unless
--acknowledged, and records who aligned. The person who gave the steer reads the constraints, not a
chat paraphrase of them. On INT-0339 the drafting session aligned its own draft three minutes after writing
it, with "Bunnik-shaped org" in the outcome and "never Bunnik data" in the constraints.
|
| Merge |
Builders never merge. Application-code MRs open as Drafts labelled ark:proposal (os mr does
this for every MR it will not auto-merge), and a named person reviews and merges them. The one exception is a config-only repo on the auto-merge allowlist
(default edge-configs):
there the orchestrator merges once the MR pipeline is green, then checks the target
branch's pipeline, because CI validation is the whole review for tenant configuration.
|
| Accept |
Ark writes the verdict itself. A measured met, partial or not_met sets the intent to proven,
partial or not_met, through
os verify <id> --write
or the daemon's measurement tick once a released or validating intent's measurement window has passed.
Ark refuses proven without an Outcome Report. People read the verdict and can reopen the intent.
The intent-lifecycle rule still calls accept a person gate; that conflict is an open decision on INT-0001.
|
| Architecture |
Work touching auth, secrets, payments, or tenant isolation sets
roles.architecture_signoff.required: true
and needs a person's architecture sign-off, whatever its lane. The kernel does not read this field,
so the person merging the MR checks for the sign-off.
|
Who decides at a gate
From Cycle 19 Ark places an intent in one of the seven
pods, and most gates belong to a
seat in that pod. The budget belongs to the lane's director instead, and the fix version (D3) to Hybrid Upgrades
& Regression. Presales-lane intents sit with the Presales team, not a pod. Nobody holds that team, so most of
their gates name no backup. When os run,
os plan, os mr,
os uat or os defect stops for a
person, it prints a Who decides line naming the people in that seat, their backup and the pod channel, and says
so when the seat is yours. os who <id> lists every gate for one intent.
| Gate | Decides | Backup |
|---|---|---|
| Align, park or re-open | Pod Lead. For a QA test intent, also a Verifier of any pod | Who holds the pod |
| Approve the plan | An Agent Operator in the pod. For a QA test intent, also a Verifier of any pod | Pod Lead |
| Raise the budget | The lane's director: Jón for Tech health and Business tools, Alex for Go-Live Enhancements, Sweep, Migration, Patch and Regression, Ragnar for Product & Concepts and Presales until they agree | Who holds the pod, or the group head when the pod holder is the director. None when the director holds the pod and heads the group too (Ragnar, for a Journeys intent in one of his two lanes). |
| Verify before it ships | The pod's Verifiers, plus its verifier role | Pod Lead |
| Accept the verdict or a UAT gap | Pod Lead | Who holds the pod |
| Merge a proposal MR | Pod Lead | Who holds the pod |
| Confirm the fix version (D3) | Magda, Pod Lead of Hybrid Upgrades & Regression, who coordinates Salesforce release readiness for every pod | The intent's Pod Lead, or nobody when that is Magda |
| Product sign-off (D4) | The pod's Product Direction, or Rowan and Karen when the pod has none (Ark & Tooling, Presales) | Who holds the pod |
Intent INT-0368 is "draft". A person must ALIGN it first (set status: aligned). Who decides (Align, park or re-open): Jennifer Bumford or Damir Brdar, Pod Lead of Tauck. Backup: Jón Vignir Guðnason, who holds Tauck. Ask in #pod-tauck. `os who INT-0368` lists every gate.
-
The pod comes from the intent's
pod:field. Without one, Ark uses the home pod of the intent's lane when that pod serves the customer, or serves every customer (Ark & Tooling runs every sweep and migration, Foundations every tech-health intent); then the one pod that builds for the customer; then the lane's home pod. An intent Ark cannot place is told to setpod:. - When the person who holds a pod is also its deciding Pod Lead (Alex on Ark & Tooling, Jón on Foundations), the backup is the head of the group above them, Ragnar.
-
For most gates this is advice, not a lock.
os intent align --by,os plan --approve --byandos uat --accept-gap --byprint a heads-up when the name given does not hold the gate, and still record the decision. Product sign-off (D4) is the exception:os defect behaviour-changefills the approver list from the pod's Product Direction seat, unlessARK_DEFECT_SIGNOFF_JSONsets one for the Jira project, andos defect signoffrefuses a name that is not on it. - QA test intents (DEVOPS-642, DEVOPS-678). For a QA test intent, a Verifier of any pod may also align it and approve its plan.
An intent counts as a QA test intent only when its lane is
regression,test_typeis set, every task is of kindregressionand may write onlyark-regression-tests/**, no task has a forbidden path, and there is no probe task. Anything else keeps the standing holders. The plan gate checks the tasks thatos plan --approveis about to hash; the align gate checks the front matter, and the task graph once there is one. The Verifiers are read from the registry; a Verifier seat in any pod counts, not only the deciding pod's. Every other gate and the existing holders and backups are unchanged, andgate_enforcement: refusestays on, so a name that does not hold the gate is still refused.os who <id>and the gate stop name the extra holders and say why. The Kaptio DX Draft approval stays the real gate: Ark never approves or promotes a test. QA self-sign (DEVOPS-678). Whenos qa-test neworos qa-test submitmints an intent, it records align and plan approval itself if the person running the session holds a Verifier seat in any pod (the regression lane'sqaSelfSignpolicy), with run-log entries naming them. For anyone else the intent waits as a draft for a Verifier.--intentnever self-signs: a task a Verifier adds inherits a current plan approval, and anyone else's task waits for a Verifier. The intent files, and explicitos intent alignandos plan --approvedecisions on a QA test intent, are pushed straight tomain, so every Verifier sees them. While the intent waits, its run log,os statusand the board say it is waiting on a Verifier instead of showing it as stuck. -
Writes to a customer org still need the customer's signature as well, from the programme's set in
automations/approvers.yaml.
Delivery gates for customer-bound fixes
For the code-rigor lanes shipping code a customer will run: patch, golive_gap, tech_health, product_pitch, funded_pitch, and support_push. (business_tools runs the same rigor gates, with an internal demo in place of Gate 1.) The first two gates were written after a real incident: a defect fix passed its Apex test gate while the customer's actual UI flow still failed, and QA bounced the ticket.
Gate 1: the fix is verified on an org
A green unit or Apex gate is necessary but never sufficient. The fix is deployed to a scratch org seeded with customer-shaped data, and the original reported reproduction is re-run through the same surface the customer used: the UI flow, the API call, the wizard path.
Read-only access to a shared QA org is for probing only. Scratch orgs come from Kaptio DX, never from a Dev Hub: nobody holds the Kaptio Dev Hub, and the environment doctor refuses a run on a machine that has one authorised. If the doctor flags the Kaptio DX credentials or a Dev Hub, fix that, never skip the doctor.
Gate 2: the MR carries a SIT handover
The intent declares its pre-release checks in a
verification.pre_release
block. os verify-pre-release
runs them and writes the SIT report. The MR description then carries the
full QA handover, self-sufficient for reviewer and QA alike:
- what was tested and the verdict, per layer
- on which org and dataset, with the seeding recipe named
- a decision table for anything reconciled during review
- honest outstanding scope: what was not tested, and why
On combo branches carrying several tickets in one MR, each absorbed ticket appends its handover to the same description, so the MR always reflects the tested state of the whole branch.
Gate 3: the org is proven before it is handed over
When the outcome is an org a person will test on, the intent declares
verification.org_readiness: checks that call the surface the person
will use, such as a real Package Search that returns the seeded packages, a SOQL
count of the seed, or the KTAPI endpoint record. os org-readiness <id>
runs them against the live org and records the result on the task graph.
os uat and os mr refuse while the last result is missing,
failed, or older than max_age_hours (default 24).
When the readiness block also declares provision (branch, customer, dataset or
none, and optionally a KTAPI environment), Ark builds that org itself
through Kaptio DX before any builder runs. It records the request on the task graph and resumes
it on later runs, so no builder, and no retrying builder, asks for a second org.
The dataset and metadata are named by artifact id, as
os dx datasets --customer <slug> lists them, and Ark sends them with the
customer's id, so Kaptio DX finds the archive whether it is stored in GitLab or GCS. A row listed
with no id goes in by its catalog name. Ark checks each value against that listing and stops
before Kaptio DX is called when one matches nothing; where Kaptio DX does not list metadata to
Ark yet, a metadata id entered by hand is sent unchecked, with a warning. Name the metadata
whenever the org needs the customer's metadata: the SF Devs Kaptio DX does not add it to a
build that names only a dataset.
os org-provision <id> does the same on its own;
--dry-run shows the request.
The UAT verdict is machine state too. A not_met or partial verdict
blocks os mr until a person records the gap with
os uat <id> --accept-gap --by <name> --note "..."; a new UAT run
supersedes the acceptance. Share packs open with the verdict line, so "run complete"
cannot be read as acceptance-ready.
Written after INT-0339 (September 2026): the UAT report said not met while the acceptance org was handed to the product owner as ready, and a seed whose unit test was green had no prices, no supplier, no tax profile and no KTAPI connection. A seed is done when the real surface returns the seeded records on the live org, never because an Apex test with its own fixtures passed.
Seeding follows the sequence that made the INT-0339 org usable on 20 September: prefer a real customer extraction over a synthetic fixture; validate the dataset against the org before importing; sanitise an extraction older than the installed package and record what was stripped; import; count the seeded objects on the org, because the importer exits cleanly having persisted nothing when the archive layout is wrong; connect KTAPI and wait for the full snapshot before judging any price. The readiness block carries the count and the snapshot as checks. Customer data is evidence: when it does not contain the scenario the brief assumes, that is a finding for the intent owner, not a record to reshape, and a purpose-built test vehicle is labelled as one in every handover.
A dataset is changed only through the Kaptio plugin, the same as outside Ark; this rule
adds no new route. Export and import can each be done through Kaptio DX or through the Kaptio plugin
directly (sf kaptio data export,
sf kaptio data import). Kaptio DX runs the
plugin, so the result is the same. Validation is
sf kaptio data validate. Nobody hand-writes
records, appends batch folders or edits an extraction in place, because the importer
skips files outside each object's own folder sequence without an error (INT-0436,
23 November 2026: 8,415 of 11,453 new records were never imported). Before the dataset
is published: validate it, import it into a fresh org, and compare per-object record counts with the source org.
The export and validate commands, the counts from both orgs and every script used go in
the run log and intents/evidence/<intent id>/;
a dataset with no such record cannot be published. The Lead is told this when it plans
the intent. The plugin and the Kaptio DX validators are not changed by this rule.
os mr also prints a warning, and carries on, when
an intent links the dataset repository (kaptio-tooling/kaptio)
and its evidence folder is missing or shows no export, validate command, import command or per-object counts.
What an agent may do on its own: the autonomy ladder
Separate from the work lane, every action a sweep or run takes sits on one rung of this ladder. The rung is set by blast radius, meaning who is affected if it is wrong, never by how hard the work was or how confident the agent feels. A well-tested platform change is still Capability work; a DML statement against a sandbox is still Org & data work.
| Rung | Scope | The agent may | Gate |
|---|---|---|---|
| Read | Investigation, read-only org queries, logs, code reading, evidence-backed answers, filing Jira, posting summaries | Everything | None |
| Config | Tenant config repos (edge-configs, bunnik-config, aurora-config), canvases, project-hub content, templates, schemas | Build, merge, verify, close the thread | CI validation |
| Capability | Platform and product code: edge-platform apps and packages, ktapi, kaptiotravel, basket-service, kaptioconnect, ecommerce-api, kaptio_pay_api | Build it, open a Draft MR labelled ark:proposal, post it in the thread | A named person merges |
| Org & data | Any write to a customer Salesforce org: metadata deploy, layout, field, or flow change, DML, bulk update, migration, backfill, purge. Sandbox and production alike. | Plan, dry-run, post the plan | A Kaptio approver and a customer approver |
An Org & data plan states what changes, where, why (with this session's evidence), the exact operations in order, the dry-run output, how to reverse it, and the blast radius. Approval is a ballot-box reaction on the Kai-posted plan from someone in that programme's approver set; one reaction from a person on both lists covers both signatures.
A customer's explicit, specific request in the thread counts as their signature for that change. A fresh reaction on the plan is still required for scope drift, bulk changes, anything irreversible, metadata or schema, a production org, and anything that can send email, SMS, or a journey.
When an agent reaches a gate, it says so in the thread: what it would do, why it is gated, and who decides. A hold recorded only in a run log is invisible to the people waiting on it.
Asks from people outside the Agents & Tooling roster. Kai works out who asked from Slack: Kaptio staff, a partner such as Frankly, or a customer. A Read-lane ask, including filing one Jira ticket, runs straight away for all three. A literal, bounded Config change from Kaptio staff or a partner runs straight away too. Everything else becomes a plan that a programme approver signs, posted in the programme's approval channel when it has one. Nobody outside the roster can approve a plan or widen it past what they asked for, and an unsigned plan is flagged to the team after a day instead of going quiet.
Shared default datasets. Publishing or replacing a shared default dataset (the Kaptio DX catalog or the dataset repository's default branch) is a high-blast-radius write, because every new acceptance org seeds from it. It is Capability lane: an agent proposes it, names the approver, and does not publish or replace it on a chat request alone. The dataset is built through Kaptio DX or the Kaptio plugin only, never from hand-built or edited folders. A new archive version gets a new incremental name and never overwrites the original.
Customer communication
Every customer-facing update goes through one pipeline.
os pack <id>
drafts it from the verification record and the evidence and runs the mechanical checks.
os pack <id> --send
runs the full twelve-check publish gate, including the binding final-post skeptic, then posts each pack as
one Slack message in its ticket thread with the evidence attached, plus one roll-up to the reporter when it
sends several. A rejected pack has no override: regenerate the evidence or narrow the claim.
A customer thread gets two Kai messages: a triage receipt and one resolution pack. Anything more is a
correction, which needs a person's decision and its own pass through the gate. Outside 07:00 to 20:00 in
the customer's time zone, os pack --send
refuses and prints the earliest send time; a person sends it then.
A customer can switch Ark off. The customer registry carries a policy block, and when
ai_tooling: prohibited
is set, os run
and os doctor
refuse every intent for that customer, the sweep dispatcher disables the programme, and there is no
override flag. os customer-registry --policy <customer>
prints the stop. Belmond has been under this stop since 28 Sep 2026. One written exception, from Ragnar on
19 Oct, lets Ark build the Groups & Charters regression pack under INT-0336. The registry note records it;
the kernel has no carve-out, so os run
still refuses INT-0336.
Defect intents: four kernel gates
A defect intent, scaffolded by
os defect new
on the patch lane, moves through four gates.
os defect status <id>
prints where it stands.
- D1, reproduced: the defect is reproduced with evidence, or it goes back to the reporter as cannot-reproduce. Repro runs touch the named sandbox only, never production.
- D2, ticketed: a Jira ticket exists in the right product project (KT or ST), with the routing rationale recorded.
- D3, fix version confirmed: a fix version is proposed and confirmed by a named person.
os rundoes not dispatch builders before this gate passes. - D4, product sign-off: granted (or recorded as not required) before the fix progresses to release.
Apex code quality rule (DEVOPS-552)
How Ark keeps the Apex it writes close to the best of the repo it lands in, in any repo. Paths below are in the
kaptio-ark repo. The kernel change is MR 332 there, and it targets
main.
What it does and why
A builder working on a .cls or .trigger file is asked to:
- Look before it writes, and follow the architecture the repo already has.
- Keep the code it touches free of duplication.
- Use the newer Apex methods and operators that replace hand-rolled loops, limited to the project's API version.
- Write new tests with
Assert.*. - Count the SOQL queries and DML the transaction already spends before adding more.
- Change as little existing code as the task allows.
The reason is review cost. Generated Apex tends to be more verbose than the repo around it, and a reviewer should not have to ask for the same simplifications on every MR.
Two copies of the rule carry it. .cursor/rules/apex-idioms.mdc is attached only when a .cls or .trigger file is in play (globs, not always applied), for sessions in
kaptio-ark. APEX_IDIOM_RULES in src/orchestrator/builder.ts, next to the code-comment rules, goes
into the builder prompt, because builders in other repos never load Ark's rules. It is added only for an Apex task (see below). The block adds roughly 550 tokens to an Apex task prompt and nothing
to other tasks. A test (tests/apex-idioms.test.ts) keeps the rule and the prompt block in step and checks that
neither names a repo or an in-house class. The repo's own Apex rules win on conflict. If a rule does not load,
behaviour is no worse than before it existed.
How a task counts as Apex. The kernel decides from the task, never from a repo name and never from
Apex words in the brief. A task is Apex when any of these is true (isApexTask in src/orchestrator/builder.ts):
- The brief names a
.clsor.triggerfile (pattern/\.(cls|trigger)\b/i, so-meta.xmlfiles match too). - Any
allowedPathsentry matches the same pattern. - The task's repo root contains
sfdx-project.jsonand anyallowedPathsentry has a wholeclassesortriggersfolder segment, for examplesfdx-source/main/classes/**. A folder such assubclasses/does not match. The check forsfdx-project.jsonlives once, insrc/util/salesforce-repo.ts.
On the recorded tasks that have allowedPaths (1,088), the file match alone detects 118 and the folder check raises that to 189.
Limit: a broad scope such as sfdx-source/** with a brief that names no file is not detected, and nothing
forces the Lead to scope Apex work to a classes folder. In that case the builder does not get the Apex block.
Local runs also get the lookup commands, with the path of the Ark checkout. Cloud runs get the rule text but no lookup commands, because the VM has no Ark checkout.
Look before you write
The rule names no repo and no in-house class. Every repo that runs Ark has its own helpers and layering, and a list of them would go stale, so the builder reads the repo it is working in:
- Read the neighbouring classes, and search for existing behaviour before writing new code.
- Look for the repo's naming families:
fflib_*, selectors, services, domains, utilities, factories, DTOs, query builders, Unit of Work, async frameworks and test data factories. Follow the one that fits, including its layering and call style. Add no new pattern where one exists. - Copy the neighbours changed most recently (
git log -3 -- <dir>), not the oldest file in the folder. - When a repo convention and a built-in idiom conflict, the convention wins. Otherwise the idiom is used.
What Ark will and will not rewrite
Will, on lines the task writes or must change:
- Remove duplication in what it touches. Repeated code in the same class or file, or a change that would add a second copy of existing logic, is reused or extracted.
- Condense collection and language patterns (minimum API version in brackets, none given where the method
is old): loops that only add, remove or put become
addAll,removeAll,retainAllorputAll; a loop that keys records by Id becomesnew Map<Id, SObject>(records); size and blank checks becomeisEmpty()andString.isBlank; separator loops becomeString.join; an else-if chain on one value becomesswitch on(43); null-guarded ternaries becomex?.f(50) andx ?? d(60); a hand-written sort order usesComparator(59). - SOQL built by string concatenation moves to bind variables, or
Database.queryWithBinds(57) for dynamic queries.
Will not:
- Rewrite code the task does not touch. Where it sees untouched duplicates, it mentions them and does not fix them.
- Use a method or operator newer than the project's API version, or raise a class's
apiVersionto unlock one. - Invent methods that do not exist in Apex:
Map.getOrDefault,putIfAbsent,entrySet,List.reverse,List.stream,Set.toListandString.isNullOrEmpty. - Override the repo's own Apex rules and architecture for the sake of an idiom.
- Convert existing
System.assert*, or inline SOQL and DML in test classes.
API version ceiling. The ceiling is sourceApiVersion in the repo's sfdx-project.json, not each
class's own apiVersion and not the latest Salesforce release. The builder uses only system methods whose since version is at or below it, and stays at API 35 or below when the repo has none. The lookup and the lint read the same value.
Assert and governor-limit policy
Assertions. New assertions use Assert.* (API 56). Existing System.assert* calls, and inline
SOQL and DML in test classes, are left alone, and a class's apiVersion is never raised for Assert. The
policy has no branch on the class version.
Governor limits. Before adding a query or a DML statement, the builder counts what the transaction already spends. It bulkifies, keeps SOQL and DML out of loops, reuses data already queried, uses the repo's selector and Unit of Work layers, and adds no query to a trigger or hot path without checking the callers.
PMD feedback before review (DEVOPS-620)
After a local builder task passes its quality gate, and before scope enforcement, Ark runs the repo's own PMD ruleset on
the changed .cls and .trigger files with
sf code-analyzer run --rule-selector pmd:<ruleset>. It runs only in a repo whose
code-analyzer.yml names a custom PMD ruleset, and it skips tests, fflib and test helpers.
- Prerequisites on the machine that runs the local builder: the Salesforce CLI (
sf), the Code Analyzer plugin (sfinstalls it on first use when it has network access, and that run counts against the scan timeout) and Java 11 or newer on PATH. PMD itself is bundled with the plugin, so there is no separate PMD install. Without them the task records a skip, covered below. - Only findings the task introduced count. Ark scans the same files at the task base and ignores what was already there, even if it moved.
- New findings go back to the builder for up to 2 rewrite attempts (
OS_PMD_MAX_FIX_ATTEMPTS, hard cap 3). The quality gate reruns after each fix, and a fix that breaks it is reverted. - It does not block on findings or missing tooling. If
sf, the code-analyzer plugin, Java or the ruleset is missing or unreadable, a scan times out, or the analyzer's output cannot be read, the task records a skip with the reason and the MR description lists it as a task with no PMD signal from Ark. A missing Java is read from the analyzer's engine error, becausesfstill exits 0 in that case, so it never reads as a clean scan. A repo with nocode-analyzer.ymlis skipped quietly. Findings left after the cap are listed in the MR description and the task goes on to review. The one exception is a failed restore: if a fix breaks the quality gate and Ark cannot put the previous commit back, or the gate is not green afterwards, the task fails. - If a reviewer-requested fix commits new code, the gate runs again on it before the re-review, and scope enforcement runs again too, so the recorded result matches what ships and neither fix leaves out-of-scope files in the diff.
- Findings text is treated as untrusted: stripped, bounded, and quoted to the builder as data.
- Cost: a task with no findings adds one scan of about 6 seconds and no model spend. A task with findings adds a baseline scan, then at most 2 builder fix runs and a quality gate rerun after each. Cloud and pool builders are not covered.
OS_PMD_GATE=falseturns this gate off.
The Apex API reference and how it is refreshed
data/apex/api/ holds the Apex system reference as one file per class: 1,004 shards plus overrides.json (1,005 files),
4,842 members, each with the API version it first appears in. Salesforce publishes no per-member version for core classes,
so it is derived by comparing published documentation releases. The data was last refreshed for real from Salesforce
documentation release 264.0 (API 68.0; the API version of a release is its number divided by 2, minus 64). It is not
specific to any repo, and it is the only dataset the rule uses: which helpers and frameworks a repo has is found by reading
that repo, and nothing about it is stored here. data/apex/api/overrides.json holds corrections a person has made, and
they win over the derived value; for example System.String.stripHtmlTags() is pinned at 60 and marked unverified.
data/apex/README.md has the same steps.
Look a member up with python3 scripts/apex/api_lookup.py <Class> [--api <N>] [--method <name>] [--all] [--api-dir <dir>],
for example System.Set --api 64 --method removeAll. Without --api the lookup uses the sourceApiVersion from the nearest sfdx-project.json at or above the current directory, and stops with an error when it finds none. How to read the output:
- A value written
<=Nmeans the version is a lower bound: the member existed in the oldest release that could be read, so it is at or before N. The causes are the API 35 floor of the documentation, the<=32floors from the older page scrape, and 149 members flagged as probable parameter renames, which carry anoverride_note. Only a member marked newer than the target version is unavailable. - A member the latest documentation no longer lists carries
last_api(209 members and 210 classes). A missing entry does not prove the platform removed it, so the lookup keeps listing it, flagged "not documented after N" (or "class not documented after N"), pastlast_api.--allalso shows members newer than--api. - Language features have no member entry.
switch on(43),?.(50) and??(60) come from the Apex Developer Guide contents, not from the shards.
Refresh. Salesforce publishes three releases a year. After one, a person refreshes the shards by hand. Nothing is scheduled. The first command is the only one that needs network access:
python3 scripts/apex/api_toc_matrix.py --out <matrix.json> --latest-doc <doc> python3 scripts/apex/api_shards.py check --matrix <matrix.json> python3 scripts/apex/api_shards.py build --matrix <matrix.json>
check lists every member whose version would rise. That usually reflects a documentation edit, not a real
introduction, so a person reviews the list before build. build keeps the per-member fields already in a shard
and applies overrides.json. Shards have stable ordering and no timestamps, so a refresh diff shows only real changes.
The advisory lint
Run npm run apex:lint -- --base <ref> (it wraps scripts/apex/idiom_lint.py, which also accepts a diff on --stdin) inside an Apex repo
checkout. It reads the diff against the ref and checks only the added lines of .cls and .trigger files, so
existing code is never reported. It flags loops that only add, remove or put, size and blank checks, null-guard ternaries,
else-if ladders, SOQL built by concatenation, methods that do not exist in Apex, and new System.assert* in test
files. A rule is skipped when its replacement is newer than the repo's sourceApiVersion (API 35 when there is none). It prints warnings and
always exits 0: it is not wired into any gate, and a finding never blocks a task or an MR. It reads text, not types, so each
finding says what to check. --repo, --json and --stdin (a git diff -U0 piped in) are also accepted.
Known limits
- Confirmed against the refreshed data:
Assert56,Database.queryWithBinds57 andComparator59 match the shards.switch on(43),?.(50) and??(60) match the first release in which the Apex Developer Guide has a page for them. The lint skips a rule whose replacement is newer than the project'ssourceApiVersion. - Floors, not introduction versions:
addAll,removeAll,retainAll,putAll,isEmpty,String.isBlankandString.joinshow only<=32. That is the oldest readable release, and the real introduction is earlier. Member versions can also be too low when a new overload shares the parameter names of an older one, so confirm a borderline case in an org. - Policy, not yet compiled in an org: the package
sourceApiVersionis the ceiling for system methods, not a class's own version and not the latest release. kaptiotravel already has classes that useAssert,?.and??below the versions that introduced them, which is consistent with this but is not a compile test. - Open check: compile a class declared at 45.0 that uses
Assert.areEqual,?.and??in a scratch org. If it compiles, the platform agrees with the policy. If not, "never raise the version" stays, but the claim about which methods are usable has to change. Not yet run. - Reach: cloud builders cannot query the lookups. The rule cannot see a repo's helpers for the builder, so how well it follows the repo's patterns depends on the builder reading the neighbours.
QA manual tests from a Jira ticket, Epic, release or outline (DEVOPS-637, DEVOPS-638, DEVOPS-642, DEVOPS-678)
os qa-test new <jira-key-or-release-id> --type manual [--target-customer <dx-customer>] [--folder "<pattern>"] [--intent INT-N] [--no-self-sign] [--max-tickets <n>] [--run | --no-run]
turns one Jira ticket into a manual test, or an Epic or a release into one test per finished ticket plus a pack. os qa-test submit --outline <file> --type manual does the same for an outline a QA wrote, with the same options except --max-tickets. Every test lands in Kaptio DX as a Draft.
A person aligns the intent and a person approves the plan. For these intents the person can be a Verifier of any pod (DEVOPS-642), and when that Verifier mints the intent, Ark records both in their name (QA self-sign, DEVOPS-678). Once the gates are clear and ARK_REGRESSION_PUBLISH=live, the command runs the intent itself. A QA approves each test in Kaptio DX. Ark cannot do that last step.
What it does and who it is for
It is for QA operators and for Cursor agents working for them. The command reads Jira once (summary, description, type, status, priority, fix versions and components;
never comments or attachments) and scaffolds a regression intent with test_type: manual and test_target.
Each task is a regression task with the QC persona, local runtime, allowedPaths ark-regression-tests/** and no quality gate commands.
Its brief holds the ticket snapshot, the exact test.json and case.md format, and the rules for the builder: no instance URLs, org aliases or record ids, and do not run the test.
The intent title names the outcome (the Epic summary or release name for a pack), never a ticket key. --owner and --no-reserve mean what they mean in os intent new.
--type manual is the only type built. --type playwright is accepted but refused with "not built yet", and nothing is written. Any other type is refused.
What the argument can be
- A ticket key such as
KT-1234is read as a ticket first. A non-Epic builds one intent with one task and one test. An Epic key builds an Epic pack. - A release: digits only (a Jira release id) or a
.../projects/<KEY>/versions/<id>URL builds a release pack. A key that fails to read is never retried as a release; the refusal names both forms.
What goes into each brief
- The ticket's rich text is converted to plain text. Link targets are dropped and images become
[attachment omitted]. - Before anything is written, the command removes Salesforce org and instance URLs, e-mail addresses, record ids, password, token and key values, bearer tokens and long token-like strings. It prints counts of what it removed, never the text.
- The summary is cut at 300 characters and the description at 6,000. A cut ends with
(truncated, see ticket). - The brief is a snapshot and is committed under
intents/. Read it for customer names and personal data before approving the plan.
Epic and release packs (DEVOPS-638)
- One intent, one task per ticket. The tasks are T1 to Tn, sorted by key, with no dependencies. Each carries its own ticket, set by the kernel, which
os plan --approvenow covers: editing the ticket on a task after approval means approving again. The intent records the pack astest_packand links the Epic and every child ticket. - Which tickets. An Epic's children, or a release's tickets, in a Done status category, with a description, and not resolved as Won't Do, Duplicate or Rejected. The Epic itself, sub-tasks and tickets another QA test intent already covers are skipped. Tickets with no description are skipped and listed. Every skipped ticket and its reason is printed before anything is written. At most 300 tickets are read.
- How many. A pack covers 25 tickets by default (
ARK_QA_TEST_PACK_DEFAULT_CAPor--max-tickets) and 100 at most (ARK_QA_TEST_PACK_MAX_CAP). With nothing eligible, or more than the cap, the command refuses, lists the skipped tickets or the overflow, and writes nothing. - Jira link per test. Each test links to its own ticket only, never to all the children. The builder cannot set it.
- No label. A pack writes no
arklabel to the Epic, the release or any ticket. A single-ticket run still labels its ticket. - Folders. Every test of a pack, and the pack itself, is filed under
epics/<safe-epic-name>orreleases/<safe-release-name>: lower case, letters, digits and hyphens, cut at a word boundary to 40 characters, falling back to the Epic key or release id. A single-ticket test sets no folder. The folder is initial placement only; a QA can move a test in Kaptio DX. - The DX pack. After the tests are published, Ark saves one pack on the target customer: job
regression, the published test ids, the same folder, and the Epic key or the release name. It needs a dataset name, which Ark does not guess. SetARK_QA_TEST_PACK_DATASET(forqa-portal-test:Develop jun); it must match the dataset name of the scratch org connection, not the customer slug, or pack runs fail withdataset_missingordataset_mismatch. It is commented out in.env.example, so a pack is opt-in. Without it the tests are still published and the pack is skipped with a note. A dry run prints the planned pack and calls Kaptio DX for nothing. After setting the variable, runos regression-tests INT-N --liveto save the pack. No pack is saved for tests that would go to the shared library.
The steps
-
Check setup with
npm run ark -- setup, from amaincheckout on a machine that does not also run product intents. Then runnpm run os -- qa-test new KT-1234 --type manual(or an Epic key, or a release id). It prints an environment check first (names and states only) and nothing is written if Jira cannot be read. - The command pushes
intents/INT-N.mdandintents/INT-N.tasks.jsontomainitself. - If you hold a Verifier seat in any pod, the command has already aligned a new intent and approved its plan in your name, or your
--intenttask inherited the current approval. Otherwise, or with--no-self-sign, it ends withWAITING on alignorWAITING on plan, and a person aligns it (the Pod Lead, or a Verifier of any pod) withos intent align INT-N --by <name>. -
Run
os plan INT-Nand read the brief the builder will get. Fix it by hand if needed, then, unless the plan was self-signed and is unchanged, a person who may approve the plan (an Agent Operator, the Pod Lead or a Verifier of any pod) runsos plan INT-N --approve --by <name>(see who decides at a gate). Changing a brief after approval means approving again. -
With the gates clear,
os qa-testruns the intent with no reviewer, publishes at the end of the run and pushes the run log, task status and harvested bundles tomain, also when the run fails. It does not run, and printsNot run: ...with theARK_REGRESSION_PUBLISH=live os run INT-N --no-reviewercommand and a run-log note, when--no-runis given, an Epic or release pack has more than five tests without--run,ARK_REGRESSION_PUBLISHis notlive, the Cursor or Kaptio DX keys are missing, or the regression lane's budget is spent. After a Verifier approves a waiting intent, run that command yourself. -
The publish is a dry run unless
ARK_REGRESSION_PUBLISH=live.os regression-tests INT-Nshows the plan and whether Kaptio DX has the customer. For the real publish, set the variable or runos regression-tests INT-N --live. A test that an earlier run already published or proved from the same source commit is not sent again; a test that was not proven is. -
A QA opens the
qa-portal-testlibrary in Kaptio DX, finds each test (ark-int-N-<slug>), readscase.mdagainst the ticket, then starts review and accepts or rejects it. Check first the steps whose expected result the ticket did not state: the builder inferred those.
Settings
Names only. Keep values in your local .env and never paste a key into chat, a ticket, an intent, a run log, a commit or an MR.
JIRA_EMAILandJIRA_API_TOKEN: required to read Jira.os runalso needsGITLAB_TOKEN.-
ARK_DX_BASE_URLandARK_DX_API_KEY: needed by the publish step to read and write Kaptio DX. They also drive scratch-org provisioning, so their meaning is unchanged. Scaffolding works without them. For QA publishing use the Kaptio DXkaptio-servicesservice key: its scopes cover thetestsscope. Do not use thedata-doctorkey, which is experimental. -
ARK_REGRESSION_TARGET_CUSTOMER: the default customer for every publish..env.examplesets it toqa-portal-test. -
ARK_REGRESSION_TARGET_FOLDER: optional folder pattern, for exampleSingle Test/{key}, for tests with no--folder, task folder or intenttest_folder. Unset: the library root. -
ARK_REGRESSION_PUBLISH: unset ordry-runplans and reads and writes nothing;livewrites, and letsos qa-testrun the intent;offskips the stage.ARK_REGRESSION_PUBLISH=liveis commented out in.env.example, so a real publish is opt-in. ARK_QA_TEST_PACK_DATASET,ARK_QA_TEST_PACK_DEFAULT_CAPandARK_QA_TEST_PACK_MAX_CAP: for Epic and release packs only, as above. All three are commented out in.env.example.
Which customer receives the tests. Per test: the --target-customer flag of os regression-tests wins, then the task's target_customer, then the intent's test_target, then ARK_REGRESSION_TARGET_CUSTOMER.
os qa-test new --target-customer <dx-customer> stores the customer on a new intent as test_target (without it, ARK_REGRESSION_TARGET_CUSTOMER, then qa-portal-test); with --intent it is stored on the new task only, and a value that differs from the intent's is not refused. When ARK_DX_BASE_URL and ARK_DX_API_KEY are set, Ark asks Kaptio DX whether the customer exists before it writes anything, and refuses a 404; without them, or when Kaptio DX does not answer, the customer is reported unchecked and the publish step checks it.
Which folder. The --folder flag of os regression-tests, then the task's target_folder, then the intent's test_folder (skipped for a test sent to another customer), then ARK_REGRESSION_TARGET_FOLDER, else no folder (the library root).
os qa-test new --folder stores the pattern on a new intent as test_folder, or with --intent on the new task as target_folder. A pattern may use {key} (the test's one Jira ticket), {name}, {id} and {intent}.
A pack keeps its pack folder unless the flag or a task folder is given. A path Kaptio DX would reject after the placeholders are filled is not refused: the test goes to the root and Ark prints a warning naming the path and the reason, at submit time and again at publish.
A guard blocks an intent with test_type: manual from the shared kaptio library however the override arrives (flag, intent or environment, in any letter case), and a manual intent with no customer to publish to is blocked with a message instead of falling through to it.
Intents without test_type keep the old targeting.
A QA's own outline (DEVOPS-678)
os qa-test submit --outline <file> --type manual [--jira <KEY>] takes a manual case a QA wrote in the Kaptio DX format: front matter with schemaVersion: 1, name and proves, then Objective, Preconditions as a bullet list and, optionally, Steps with an Action and an Expected result each.
It refuses an outline Kaptio DX would not take (more than 200 steps or 50 preconditions, or a block over 4,000 characters), or a file over 20,000 characters, and writes nothing. The builder copies the text as written and writes steps only when the outline has none. The qa-test-outline Cursor skill helps a QA write it and submits it when the QA says it is final.
Tests arrive as Drafts, and a QA approves them
Ark publishes with no approval state, and Kaptio DX stores such a test as Draft and puts it in the review queue. Kaptio DX refuses a publish that carries an approval and refuses the approval call from Ark's service key, so nothing in Ark can move a test past Draft. A QA moves it through review and accepts or rejects it in the Kaptio DX interface. Publishing the same test again does not undo a QA decision.
The Jira link on the Kaptio DX test
A test published for a regression-lane intent carries a Jira link, so the Kaptio DX test points to the ticket it was written from. A single-ticket test carries the intent's links.jira_tickets;
a pack test carries its own ticket only. Only well-formed, unique keys are sent, up to the 50 Kaptio DX keeps. With no usable ticket, no link is sent. Every other lane publishes exactly as before.
The builder cannot set the link: test.json stays strict and rejects a jira field.
A wrong key holds the publish. When Jira is configured on Kaptio DX, it checks each key at save time and answers 400 if a key does not exist or its Jira user cannot see it.
Ark records that test as failed with the Kaptio DX message (Publish refused: ...) and does not prove it. Fix the key on the intent and run the stage again.
If Jira is not configured on Kaptio DX, or does not answer, the check is skipped and the link is saved.
Refusals and known limits
- Refused before anything is written:
--type playwright; an argument that is neither a key nor a release id or versions URL; a pack with nothing eligible or over the cap;--max-ticketsthat is not a whole number or is above the ceiling; a bad key, unknown type, or bad or shared-library--target-customer; missingJIRA_EMAILorJIRA_API_TOKEN; a Jira 404 (no such ticket, or the account cannot see it); a Jira 401 or 403; a single ticket with no description; and a ticket that an intent already holds withtest_typeset (the message names that intent). - Empty-diff reviewer. A manual test is a bundle the kernel keeps out of the commit, so the task's diff is empty and the reviewer asks for changes ("builder produced no changes"). The publish then skips the bundle.
Run
os run INT-N --no-reviewer, or have a person finish the task withos task done INT-N T1 --note "<what you checked>".os regression-tests --livealso exits 1 for a manual test, because only a proven test counts as success there.os runis not affected. - No live Epic or release run yet. Epic and release packs have been tested only against stand-ins, with no live Jira or Kaptio DX call. Treat the first live run as a trial.
- A re-publish may reset the folder. A QA can move a test in Kaptio DX, but re-running
os regression-tests INT-N --livemay put a pack test back underepics/...orreleases/.... This is not verified against the real Kaptio DX code; confirm before telling QA that re-runs are safe. - Large packs. A pack intent links the Epic and every child ticket, and the board accepts at most 40 tickets there, so a pack over 40 tickets cannot be edited from the board.
- DEV is not supported for manual tests yet. Publish to a QA customer.
- Playwright is not built yet. The command refuses it.
- Never proven. Ark does not run a manual test, so it stays published and not proven.
- Jira link and the QA Beta build. The link was checked against the Kaptio DX source, not a live instance. A Kaptio DX build older than the 15 Oct 2026 change may not know
tickets.
Board rules
Who can edit an intent on the board
The board changes how an intent is filed, never the work it describes. The title, problem, desired outcome, success metrics, constraints and tasks stay in git. A person with the ark-leadership role can change anything the board offers. Everyone else is judged from the org registry, and the server checks each change on its own:
- A Pod Lead, Product Direction or director seat on an intent's pod edits that intent's priority, sprint priority, owner, customer, Jira links, short name, expedite flag, supporting pods and lane.
- A status change needs whoever decides the gate it crosses, or that gate's backup: the Pod Lead for align, park, block, close and re-open, and the seats in the table above for merge, release, verify and accept. Aligning shows the read-back first; a consistency advisory needs a written reason.
- Moving an intent to another pod needs a seat on the pod it leaves. An intent that has no pod can be claimed by anyone who holds the target pod.
- A lane director sets the envelope for their own lane in the budgets file and nothing else in it; window totals need ark-leadership.
- A bulk edit applies one change to up to 100 intents. Each is checked separately, and the ones refused are listed with the reason.
Everyone signed in can read every intent. If the board rejects a sign-in, it shows what it received (the audience and roles in the token) so the Ark & Tooling pod can check Keycloak, instead of showing an empty board.
Intent state lives on main
Every command that writes intent state checks the checkout first: a clean feature branch is switched back to main, a stale main is fast-forwarded, and uncommitted work on a branch is refused. The sweep loops and cloud builders read only main, so push intent commits the same session; a committed but unpushed run log is as invisible as an unwritten one. Branches are for changes to Ark itself.
No single-ticket intents
A defect ticket joins its per-release patch-family intent, or the standing patch line. Lint-enforced: the board index fails on an active intent scoped to one defect. See Intents, not tickets.
Residuals return to the family
When QA reopens a ticket that an intent already owns, the residual work goes back to that intent, on the same branch and MR. It never mints a new board entry.
Granularity exceptions need board-owner sign-off
Any text in
granularity_exception
silences the single-defect lint, and Ark does not check for a sign-off. The board rule is that
the board owner signs off in the run log before the run starts. Until that entry exists, the
exception is only a request.
Folded intents stay readable
Superseded intents keep their spec as grounding and carry a
machine-readable superseded_by
pointer, lint-enforced, so every fold leads the reader to the surviving outcome.
The artefact, not chat history, is the durable state
Decisions, evidence, and verdicts live in the intent spec's append-only
run log. Older entries move verbatim to
intents/archive/
and large evidence of closed intents leaves the checkout; git keeps all of it. If it is
not in the artefact, it did not happen.
Where the rules live
The enforceable versions of these rules are Cursor rules in the
kaptio-ark
repo (.cursor/rules/),
loaded by every agent working there. This site is the readable mirror;
when the kernel or the rules change, the changelog here changes with them.