Found on prod by the platform session: all 7 targets created by the managed git sync show "Backend / API", including gt-mobile (Android + Unity) and the two firmware repos (embedded C/AVR).
Cause
The sync creates the target when the repository is created, before the first push.targets::detect_target then classifies without working paths (by artifact kind only), finds no evidence, and falls back to the declared default BackendService.
The classification each scan computes (classify_and_store, with real code since #449) was only stored as classification. It was never written to target_type.
Change
OnboardedTarget::detected_type(&Classification) (core, pure) gives a new type only when all of these hold:
the target comes from a managed git source (source_repo);
no person has chosen its type (new field type_chosen, serde default false);
the classifier found evidence: candidates is not empty, so it isn't just the fallback;
the evidence names a different type.
Scan (classify_and_store): sets target_type and the default compliance_profile of the new type, and logs managed target typed by its code. The new type affects the plan from the next scan on; the firmware SBOM already follows the detection in the same scan, as before.
PATCH /targets/{id}: if a person actually changes the type, type_chosen = true, and scans leave it alone from then on. The editor sends the type with every save, so an unchanged value doesn't count.
Existing managed targets get their type at their next scan (type_chosen is false for all of them), so the 02:00 run on prod fixes the 7 targets.
Found on prod by the platform session: **all 7 targets created by the managed git sync show "Backend / API"**, including `gt-mobile` (Android + Unity) and the two firmware repos (embedded C/AVR).
## Cause
1. **The sync creates the target when the repository is created, before the first push.** `targets::detect_target` then classifies without working paths (by artifact kind only), finds no evidence, and falls back to the declared default `BackendService`.
2. **The classification each scan computes** (`classify_and_store`, with real code since #449) was only stored as `classification`. It was **never written to `target_type`**.
## Change
- **`OnboardedTarget::detected_type(&Classification)`** (core, pure) gives a new type only when all of these hold:
- the target comes from a managed git source (`source_repo`);
- **no person has chosen its type** (new field `type_chosen`, serde default `false`);
- the classifier found **evidence**: `candidates` is not empty, so it isn't just the fallback;
- the evidence names a different type.
- **Scan** (`classify_and_store`): sets `target_type` and the default `compliance_profile` of the new type, and logs `managed target typed by its code`. The new type affects the plan from the next scan on; the firmware SBOM already follows the detection in the same scan, as before.
- **`PATCH /targets/{id}`**: if a person **actually changes** the type, `type_chosen = true`, and scans leave it alone from then on. The editor sends the type with every save, so an unchanged value doesn't count.
- **Existing managed targets** get their type at their next scan (`type_chosen` is `false` for all of them), so the 02:00 run on prod fixes the 7 targets.
## Tests
- `a_managed_targets_type_follows_its_code_until_a_person_picks_one`:
- Android evidence → AndroidApp;
- empty repo (no evidence) → nothing;
- already correct → nothing;
- `type_chosen` → nothing;
- a target a person onboarded → nothing.
- fmt and clippy with the CI flags (core, agent, dashboard server). Agent lib tests: 590; `git_source` integration test: green.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Every target the managed git sync created stayed "Backend / API", the
Android+Unity repository and the firmware repositories included. The sync
creates a target when its repository is created, before anything is
pushed, so detection then saw no code and fell back to the default type;
and the classification each scan computes was stored, but never applied
to the target's type.
A scan now applies it to a managed target (OnboardedTarget::detected_type)
when the classifier found evidence (not only the fallback), the evidence
names another type, and no person has chosen the type. The default
compliance profile of the new type comes with it. Changing the type in
the editor sets `type_chosen`, and the scans leave it alone from then on;
the editor sends the type on every save, so only a change counts.
Existing managed targets are re-typed by their next scan.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang
merged commit 3822d624e1 into main2026-10-05 20:14:22 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found on prod by the platform session: all 7 targets created by the managed git sync show "Backend / API", including
gt-mobile(Android + Unity) and the two firmware repos (embedded C/AVR).Cause
targets::detect_targetthen classifies without working paths (by artifact kind only), finds no evidence, and falls back to the declared defaultBackendService.classify_and_store, with real code since #449) was only stored asclassification. It was never written totarget_type.Change
OnboardedTarget::detected_type(&Classification)(core, pure) gives a new type only when all of these hold:source_repo);type_chosen, serde defaultfalse);candidatesis not empty, so it isn't just the fallback;classify_and_store): setstarget_typeand the defaultcompliance_profileof the new type, and logsmanaged target typed by its code. The new type affects the plan from the next scan on; the firmware SBOM already follows the detection in the same scan, as before.PATCH /targets/{id}: if a person actually changes the type,type_chosen = true, and scans leave it alone from then on. The editor sends the type with every save, so an unchanged value doesn't count.type_chosenisfalsefor all of them), so the 02:00 run on prod fixes the 7 targets.Tests
a_managed_targets_type_follows_its_code_until_a_person_picks_one:type_chosen→ nothing;git_sourceintegration test: green.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p