Contributing a Project

This page is for a developer who adds the test cases of a product project and extends the converter and the runner for that project. The maintainer merges pull requests, builds the release and deploys it. Write to Armen.Malkhasian@friendly-tech.com.

A shorter, illustrated walkthrough is in the developer guide.

The Lightweight M2M (LwM2M) device is the worked example on this page. One developer added it in five commits. A sixth commit added its coverage rules.

Access You Need

Ask for each item before your first day of work.

Item Who gives it What it is for

GitHub repository Friendly-Technologies/ft-ai-test-agent

The maintainer

Clone, branches and pull requests.

A runner account with the role editor

An admin, on the Users tab. See accounts.adoc#users.

Import, edit and run cases at http://ai.friendly-tech.com:8083/.

An env profile for your project

An admin, on the Settings tab. See settings.adoc#profiles.

Your runs use the portal and the emulator settings of your product environment.

TestRail access to the suite of your project

The TestRail admin

The cases you import. TestRail is the source of truth for expected values.

The code search token KNOWLEDGE_CODE_TOKEN

The maintainer

The code-search server answers questions about the Java and Angular code.

Network access to ai.friendly-tech.com, ports 8083, 7030 and 7020

IT

The runner UI, knowledge-mcp and bbf-tree-mcp.

Configure Your Checkout

  1. Clone the repository.

    git clone git@github.com:Friendly-Technologies/ft-ai-test-agent.git
  2. Clone the product repositories in the same parent folder: ft-device-network, oneiot_web_backend, oneiot_backend and oneiot_angular.

    The rules and skills refer to them as ../<repository>.

  3. Install Python 3.11 and the dependencies.

    py -3.11 -m pip install -r requirements-test-runner.txt -r requirements-dev.txt
  4. Install Claude Code. Then add the documentation server.

    claude mcp add --transport sse knowledge-mcp http://ai.friendly-tech.com:7030/sse/sse
  5. Add the code search server with your token.

    claude mcp add --transport sse code-search http://ai.friendly-tech.com:7030/code/sse --header "X-Code-Token: <your token>"
  6. Create a file CLAUDE.md in the root of your checkout with your own run settings.

    # My settings
    - Runner account: <your account>, env profile: <your env profile>.
    - My project: <project name in the runner>, TestRail suite <suite>.

    Git ignores CLAUDE.md. The file is personal.

  7. Keep the password of your runner account in the user environment variables FT_RUNNER_USER and FT_RUNNER_PASSWORD.

    The test-runner-api skill logs in with them.

  8. Start Claude Code in the checkout.

    Claude Code loads .claude/rules/repo-rules.md, your CLAUDE.md and the project skills.

The Development Loop

  1. Write or adapt the case in TestRail. Follow Writing TestRail Cases.

  2. Import the case into the runner. See Importing Tests.

  3. Assign the case to your project. See organizing-cases.adoc#projects.

  4. Run the case on your env profile. See running-tests.adoc#env-select.

  5. Read the verdict, the run report and the failure screenshot. See running-tests.adoc#verdicts.

    The readiness label shows what the case still needs. See test-readiness.adoc#env-needs.

  6. If the converter or the runner lacks support for your project, fix it on a branch.

    git switch -c feat/<project>-<topic>
  7. Run the targeted tests of your change. Run the golden corpus if you changed the converter.

    py -3.11 ci/release_set.py --repo . --target origin/main --head HEAD --run
    py -3.11 -m pytest tests/test_conversion_golden.py -p no:cacheprovider

    Run at most about 40 test files at a time, with at most two pytest processes. The nightly run covers the full suite.

  8. Open a pull request. Fill in the checklist of the pull request template.

    The CI job runs the targeted tests and the golden corpus on the pull request.

  9. Wait for the review. The maintainer merges the pull request and deploys the next release.

  10. After the deploy, reimport the cases your change affects. Then run them again.

    The maintainer tells you when the release is live.

    A converter change reaches a stored case only by a reimport.

    Select the settings of the reimport in Which Settings to Use.

Add a Device Type or a Protocol

The LwM2M device follows the pattern of the MQTT device. Read its commits in this order:

git show 32e0b1b02 2f0111c0b 75a27d80b 8ff88f30b 6d2f29b13 91a67ebde
Part File What the LwM2M change does there

Shared names

scripts/lwm2m_device.py

The protocol name, the serial of the device a run owns, the admission mask type.

Emulator client

scripts/iot_emulator_mcp.py

Starts and stops the device on the IoT emulator.

Portal calls

scripts/ft_api_client.py

Finds the device and its admission row over REST.

Runtime

scripts/test_server.py

Starts the device during emulator setup. Removes it in the post-flight.

Settings

scripts/test_settings.py, gateway_service/envmgr.py, Settings

The LwM2M server host and port, their env-manager mapping and their row on the settings page.

Readiness

scripts/readiness/codes.yaml, ui/test-runner/index.html

The lwm2m_device env need, probed on the product environment. The catalogue in the UI matches codes.yaml.

Coverage rules

scripts/coverage_contract/rules.yaml and its fixtures, IOT_PROTOCOLS in scripts/coverage_contract/model.py, LINKER_VERSION in scripts/coverage_contract/rule_table.py

Rules claim the device lines of a case. Without them the readiness label shows a gap. The version bump updates the linker pin in tests/test_readiness_coverage_relink.py.

Converter

scripts/converter/lwm2m_setup.py, one hook in scripts/test_server.py

Decides which cases get the device. The gate is default-deny.

Image

test_runner/Dockerfile

The new script is on the COPY list.

Tests

tests/test_lwm2m_device_runtime.py, tests/test_lwm2m_converter.py, tests/test_lwm2m_coverage_rules.py

The new behaviour. The commits also update the existing tests that count devices, probes and budgets.

Checks a Pull Request Must Pass

The rules file .claude/rules/repo-rules.md holds the full list. These checks stop pull requests most often.

Rule Check

Every file is in English: code, comments, logs, tests and documentation.

Review.

New behaviour ships with its tests in the same pull request.

Review.

A new scripts/*.py is on the COPY list of test_runner/Dockerfile.

The container starts. Without the line it stops with ModuleNotFoundError.

A new step type or step field has an editor block in ui/test-runner/index.html and a key in _step_fields.

tests/test_ui_step_fields_parity.py

A converter change that alters stored cases shows in the golden corpus.

tests/test_conversion_golden.py. Accept an intended change with --force-regen and explain it.

Fixed waits in the runner do not grow.

tests/test_wait_ratchet.py against tests/wait_ratchet_caps.json.

Inline styles in the UI stay within their budget.

tests/test_ui_skin.py

A change of rules.yaml comes with its fixture.

tests/test_coverage_contract_rules.py

Expected values come from TestRail. A YAML never gets a hand-edited expected value.

Review.

Work of the Maintainer

  • Deploys of the workers and the gateway.

  • The nightly run of the full test suite on main.

  • The large TestRail waves.

  • Changes to QA-verified cases. Each change needs the maintainer’s yes.

Your Own Worker

A personal worker runs the image of the commit you deploy. Before your first deploy, it runs the image from its creation, by default the tag latest. The shared workers and the gateway stay untouched.

An admin creates the worker once for you. In the Workers tab the admin picks your account in the Owner list of the Add Worker form. The call is POST /api/gateway/workers with the body {"owner": "<username>"}, and name is optional. Without a name the worker is named after the username: lowercase, every character outside a-z, 0-9 and - becomes -, at most 31 characters. For example the username JaneDoe gives the worker janedoe. Some API routes and the header X-Stand call a worker a stand. A name already taken by another worker answers 409, and the admin then gives the worker a name. The admin then creates a personal env with the settings of your project env on the Settings tab: Export selected, a new name for the profile key in the file, then Import. The exported file holds the passwords of the env in clear text, so the admin deletes it after the import. Import overwrites a profile with the same name. The admin pins the personal env to the worker and enables the worker last. The personal env must be named <project>-<worker name>, for example lwm2m-ui-backend-janedoe for the worker janedoe. The gateway pins a personal worker only to an env whose name ends with -<worker name> and that no other worker holds. Any other env, such as Default or a project env the shared workers serve, answers 409 and names the expected form. The worker has its own case volume test-cases-<worker name>. Creating the worker answers 409 while that volume still exists from an earlier worker of the same name, and creates nothing. Delete the volume or give the worker another name. The first start copies the shared cases into it, and a marker file .shared-copy-done records that the copy ran. From then on imports, reimports and edits change only your copy.

Build an Image

Your branch must contain main from commit 0b459538e on. Merge the current main into your branch first. An older branch builds an image without the personal-worker support.
  1. Open the repository on GitHub and click Actions.

  2. Select Build & Push images to Harbor.

  3. Click Run workflow and select your branch.

  4. Tick Build the worker image only (a personal worker needs nothing else).

  5. Click Run workflow.

  6. When the run ends, copy the full 40-character commit sha from the summary.

The run pushes test-runner-agent:<full sha> to Harbor. It never moves latest. A push to main still builds both images.

Deploy and Switch

  1. Open the Workers tab. Your worker shows in the Your worker card.

  2. Paste the sha into Commit sha (full 40 characters) to deploy.

  3. Click Deploy.

  4. Wait for the answer. The Build line shows the new commit.

  5. Click Work on this worker.

The deploy is refused while the worker runs a test. The same call is POST /api/gateway/workers/<worker name>/deploy with the body {"sha": "<full sha>"}. The deploy changes only the image of your worker. It never touches a shared stack.

While your session works on your worker, case list, import, reimport and case edits go to it. Start runs with your personal env only. The gateway refuses any other env and names the personal env. Runs you started keep following the worker that holds them. Click Work on the shared workers to go back. Then reload the page: the case list and an open case do not follow the switch. Do this to reimport and rerun cases after a release.

Reimport a Case

A deploy or a release changes the code of a worker. The stored YAML of a case stays the same. Reimport only the cases your converter change touches, then run them. Start with the cases you fixed and the cases the golden corpus names. List the cases in your pull request. A runner change needs no reimport.

Every reimport overwrites the YAML. You lose your manual edits in the Editor, in every mode. Only a skipped or failed reimport keeps the YAML.
  1. On the Your worker card, click Work on this worker or Work on the shared workers. Without a personal worker, skip this step: your session works on the shared workers.

  2. Reload the page. The case list and an open case do not follow the switch.

  3. Open the case on the Editor tab.

  4. Click More.

  5. Click Reimport. The Reimport Test dialog opens.

  6. Set LLM and Force refresh as the table in Which Settings to Use says.

  7. Click Reimport.

  8. Run the case.

The LLM list has three modes: With LLM (full), No LLM and No LLM, cached only. The dialog opens at No LLM, cached only with Force refresh ticked. In this mode Force refresh has no effect, and the dialog shows the box Changed TestRail text.

The runner stores conversions in a cache. No list in the runner UI shows the cases with a matching cached conversion. The dialog tells you: in No LLM, cached only it skips a case with none. On the Converter tab, the table of a past job shows the columns Cache and Stage 2 for each case. Your worker copied the cache of the shared store at its first start.

When a case has no YAML on the worker, an import with With LLM (full) can turn catch-all steps into AI steps. In the YAML such a step has type: ai_step. A reimport of a case with a YAML never does this. After a reimport, such a step is an ordinary step again, with type: interact. The run still performs the step.

Which Settings to Use

Find your situation in the first column. Set each control to the state in your row.

Where and when LLM Force refresh The box Changed TestRail text What you get

Any worker: the first import of a new case

With LLM (full)

Not ticked

Not shown

The model converts the case. The converter skips Stage 2 for a trivial UI case. The runner stores the result under the key of a first import. No reimport reads this key.

Any worker: you changed the TestRail text of the case

With LLM (full)

Not ticked

Not shown

No cached conversion matches a changed text. The model converts the case, and the runner stores the result.

Your worker: you changed converter code outside Stage 2

No LLM

Ticked

Not shown

The code of your branch converts the case without the model. This covers the rules, the builders, the tree download and the emulator setup. The reimport spends no model limits. Your copy of the case has no model enrichment after it. Your worker drops its cached conversion of the case, so No LLM, cached only skips the case there afterwards.

Your worker: you changed Stage 2

With LLM (full)

Ticked

Not shown

The model converts the case again with the code of your branch. The reimport can spend the shared model limits: a trivial UI case skips Stage 2. Your worker drops its cached conversion of the case, so No LLM, cached only skips the case there afterwards.

Shared workers, after the release: try this first

No LLM, cached only

No effect

Not ticked

If the reimport finds a cached conversion, the case keeps its model enrichment. The runner runs a fixed set of the current builders again. Most other converter changes do not show. The reimport spends no model limits. If the reimport finds none, the dialog skips the case and names it.

Shared workers: the dialog skipped the case, with no cached conversion or with one on another tree

With LLM (full)

Not ticked

Not shown

The runner converts the case with the model. For an unchanged Stage 2 prompt, it takes the stored model answer. The runner stores a new cached conversion, unless Stage 2 failed.

Shared workers: the reimport ran, and your change does not show

With LLM (full)

Ticked

Not shown

The model converts the case again. The reimport can spend the shared model limits: a trivial UI case skips Stage 2. The case has no cached conversion after it.

Use No LLM with Force refresh on the shared workers only after the maintainer agrees. These settings remove the model enrichment of the shared case. No list in the runner UI shows the cases with an enrichment.

The Order on the Shared Workers

  1. Wait until the release is live. Work on the shared workers.

  2. Open the Reimport Test dialog of the case. Leave No LLM, cached only.

  3. Untick the box Changed TestRail text: convert without LLM instead of skipping.

  4. Click Reimport.

  5. Read the dialog after the reimport. A skip names the case.

  6. Open the case on the Editor tab. The panel Change history lists the versions, newest first.

  7. Find the top row. It has the tag reimported: it is your reimport.

  8. Click Diff on the row under it. Diff compares that older version with the case as it is now.

  9. If no row is under it, or the row has no Diff, read the YAML in the Editor. The runner then has no copy of an older version to compare.

What you see What you do

The reimport ran, and Diff shows all of your change

Run the case. You need no further reimport.

The dialog skipped the case: no cached conversion, or one on another tree

Reimport with With LLM (full). Untick Force refresh. Run the case.

The reimport ran, and Diff does not show all of your change

Check that your change touches this case. If it does not, stop here. Reimport with With LLM (full). Tick Force refresh. Run the case.

The dialog skipped the case for another reason

A QA-verified case: see Changes of a QA-Verified Case. An unreadable TestRail attachment: reimport later.

The dialog lists a skipped case under Skipped, not re-imported, with its reason. It then also shows the line skipped: no usable cached conversion, whatever the reason. Decide by the reason, not by this line.

  • no cached conversion: The second row. A release with a new cache version gives this reason for every case. A note after the reason does not change the row.

  • the cached conversion is on another tree: The second row too.

  • the TestRail attachment listing of the case could not be read: The fourth row. Reimport later.

A QA-verified case has no reason there. The dialog shows the line 1 QA-verified case skipped with the case ID: this is the fourth row.

What the rows cost:

  • The second and the third row can spend the shared model limits. The third row asks the model again, except for a trivial UI case.

  • The third row also removes the cached conversion of the shared case.

  • Every reimport writes a YAML without AI steps.

  • After a release with a new cache version, the dialog skips every case with the reason of the second row. Before you reimport about 500 cases or more, see Shared Limits.

Changes of a QA-Verified Case

Change What happens

The Reimport Test dialog

The dialog skips a QA-verified case. An admin gets the same skip.

The TestRail text changed after the QA check

Use Import single test case in the Import from TestRail… dialog of the Converter tab. Select With LLM (full) in the LLM list first. Overwrite existing has no effect on Import single test case. The runner asks: The case is QA-verified, but its TestRail text changed after the check. Click Continue. After the import, the case is no longer QA-verified and returns to QA. The runner answers Only an admin can do this in two cases. It could not prove a change of the text, or the QA record of the case is of another kind, for example a QA sign-off. Ask the maintainer then.

The same path with No LLM, cached only

The Import from TestRail… dialog opens in this mode. With the box Changed TestRail text ticked, the runner converts the case without the model. The case is then no longer QA-verified and returns to QA. With the box not ticked, the runner skips the case, and the case stays QA-verified.

A save in the Editor

It needs a confirmation. Any account with the role editor can give it. A save with another case ID needs an admin.

Delete, restore a version, restore or purge from the trash, Regenerate, a YAML upload, a new tree, Import single test case with an unchanged text

Each needs an admin and a confirmation. Ask the maintainer.

Bulk delete, an import batch, a reimport batch

Each skips a QA-verified case, for an admin too.

Assign project, assign run, a bulk update of a field other than the title, Duplicate

The runner makes no check here. Ask the maintainer before you do it.

Reference: What Each Setting Does, and the Cache

LLM Force refresh The reimport finds a cached conversion Result

No LLM, cached only

No effect

Yes

Takes the cached conversion with its model enrichment. Runs a fixed set of the current builders again. Most other converter changes do not show.

No LLM, cached only

No effect

No. The box Changed TestRail text: convert without LLM instead of skipping is ticked, and the runner can prove a change of the TestRail text.

Converts the case by rules only. The case loses its model enrichment.

No LLM, cached only

No effect

No, in every other case

Skips the case. The YAML stays as it is.

No LLM or With LLM (full)

Not ticked

Yes

Takes the cached conversion, as No LLM, cached only does. The runner does not ask the model.

No LLM

Not ticked

No

Converts the case by rules only. Stores no cached conversion.

With LLM (full)

Not ticked

No

Converts the case with the model. For an unchanged Stage 2 prompt, the runner takes the stored model answer. Stores the cached conversion, unless Stage 2 failed.

No LLM

Ticked

Yes or no

Converts the case by rules only. Removes the cached conversion of the case.

With LLM (full)

Ticked

Yes or no

Asks the model again and converts the case. Removes the cached conversion of the case. Spends model limits.

A reimport finds no cached conversion in these cases:

  • No conversion with With LLM (full) and Force refresh not ticked ran since the case got its YAML. The first import does not count.

  • Something in the TestRail record of the case changed: its text, its section, its attachment, or a field such as priority.

  • The model or the import options changed.

  • The earlier conversion used another device serial. The Reimport Test dialog of one case sends the device serial of the case, for example test-runner-7. An import and a reimport of several cases send the base serial, test-runner by default. So the dialog of one case can miss a conversion from an import.

  • The case needs another tree than its cached conversion. The skip reason says so.

  • A release raised the cache version. Then no case has a match.

  • The last conversion with With LLM (full) had a failed Stage 2, so it stored nothing.

  • A reimport with No LLM or With LLM (full) and Force refresh removed the cached conversion.

The dialog gives one reason for all these cases, except the tree: no cached conversion. With the box Changed TestRail text ticked, a proven text change gives no skip: the runner converts the case without the model.

The box Changed TestRail text: convert without LLM instead of skipping shows only in No LLM, cached only. It is ticked after a page load. The import dialog and the reimport dialog share it, so it keeps your last choice until the next page load. Each dialog has its own Force refresh. The runner proves a text change by a hash in the YAML. It skips a case without the hash, with the reason a TestRail change could not be proven.

The key holds the TestRail record of the case, its section name and its attachment. It also holds the model, the import options, the device serial of the request and a cache version. The first import of a new case adds one more field to the key, so no reimport reads its result. A converter change keeps the key, unless the release raises the cache version.

The runner also stores each Stage 2 answer under its prompt. This store is separate from the cached conversions. For an unchanged prompt and model, the runner takes the stored answer. With LLM (full) with Force refresh asks the model again. The runner stores no answer of a failed Stage 2.

On a cached conversion, the runner runs a fixed set of builders again. The set holds builders of preconditions, device seeds, typed steps and checks, but not every builder of these kinds. A change of another builder or of the Stage 1 step conversion does not reach a cached conversion. Neither does a change of the tree download or of the emulator setup built from the tree. Diff shows whether your change is there.

Every mode skips a case with a YAML when the runner cannot read its TestRail attachment. An import of a section or a run without Overwrite existing leaves the YAML of an existing case as it is. Import single test case replaces the YAML with or without Overwrite existing. Only a skipped, refused or failed import keeps the YAML. A failed Stage 2 is not a failed import: the runner then writes a YAML by rules only. The other reimport paths are in importing-tests.adoc#reimport.

Sync Cases With the Shared Store

The worker mounts the shared case store read-only. Sync copies from it into your copy.

Control Effect

Sync missing cases

Copies every shared case file your worker lacks. Nothing is overwritten.

Reset with case IDs

Overwrites the named cases with the shared copy.

Reset with an empty field

Overwrites every numbered case of the shared store.

Reset loses your changes to the overwritten cases. A case that only your worker has stays. A named reset also deletes the personal-only files of that case: its provenance, marks and history are replaced by the shared ones, or removed when the shared store has none. A reset with no case IDs does the same for every case the shared store has, so it deletes the personal-only files of all of them. Sync missing never overwrites a case your worker already has. It takes the case lock and checks again that your file is still absent before it writes, so a case you save during the sync is kept. The first-start copy writes the marker .shared-copy-done after a run with no I/O error. A shared YAML that does not parse is skipped and logged by name, and the marker is still written, so a restart never brings back a case you deleted; once the shared file is fixed, Sync (missing) copies it. After an I/O error the marker stays absent and the next start copies again. Sync is refused while a run or a batch is in flight on the worker.

What It Cannot Test

  • Changes under gateway_service/ and ui/test-runner/. They belong to the gateway image, which a personal worker does not use.

  • The shared stacks. Only the maintainer deploys them.

What It Never Does

  • A run on your worker never counts as QA-verified.

  • A run never counts toward the readiness label when the case differs from the shared copy or the build has local changes. A run of a released build counts like a run of a shared worker. A released build is a commit the shared workers have run. A run of your branch build counts too. The Readiness tab then marks the case with the Branch build tag until a run of a released build replaces it.

  • Your worker posts no result to TestRail.

  • A personal deploy is never a release.

  • The pull request checks stay the proof. The worker does not replace them.

Shared Limits

  • All workers use one Claude login. Everyone shares its usage limit, your own worker included.

  • An import or a reimport with With LLM (full) can ask the model for each case. A run asks the model too.

  • A large batch also holds the workers of its env for hours.

  • At the limit, a running batch pauses. The batch continues without your action after the limit opens again.

  • Before you start about 500 cases or more, write to the maintainer. State the number of cases, the LLM mode and the start time.

  • The maintainer sees the state of the limit. Together you select a good time for the start.

Offboarding

An admin removes the worker.

  1. Delete the worker with teardown. The same step deletes the personal env pinned to the worker and drops its queued jobs.

  2. Remove the worker’s named Docker volumes: test-cases-<worker name> (your cases), tr-worker-<worker name>_run-reports (run reports) and tr-worker-<worker name>_qa-notes (qa notes). Delete test-cases-<worker name> before the worker name is used again: creating a personal worker refuses a name whose case volume is still there.

A stack delete leaves named volumes, so step 2 is needed. Teardown never deletes a volume itself. The compose names only test-cases-<worker name>. The other two volumes get the stack prefix tr-worker-<worker name>_. The shared case volume is external and stays.