# Oya stub-site audit (V1-P2-2110)

Date: 2026-05-04 Scope: `libs/oya/**/*.{ts,py}` (excluding `*.test.ts`,
`*.spec.ts`, `node_modules`, `dist`) Tool:
`scripts/stub-indicator-scan.sh --mode=stubs|random`

## Status: clean (qualitative stub markers)

`./scripts/stub-indicator-scan.sh --mode=stubs $(...oya files...)` returns
**zero actionable hits** after this audit. Every prior hit was either fixed
(real stub → real implementation) or marked `// stub:legitimate <reason>` when
the qualitative phrase appears in user-visible text, JSDoc parameter
descriptions, or physics edge-case comments.

## Per-file actions taken

| File                                    | Line | Original                                                                                                                          | Action                                                                                                                                                                                                                                                   |
| --------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `core/src/gps-navigation.ts`            | 3636 | `let val = -KH[i*n+j] * this.P[j]; // placeholder, need full multiply`<br>followed by `val = 0` and the real (I-KH)\*P loop       | **Fixed**: removed the dead placeholder line; the real Kalman covariance update was already in the inner loop.                                                                                                                                           |
| `core/src/multi-view-fusion.ts`         | 608  | `// For simplicity, store a placeholder fundamental matrix`<br>`F = [t]x` only — ignored intrinsic matrices and relative rotation | **Fixed**: implemented full F = K2^-T _ E _ K1^-1 with E = [t_rel]x _ R_rel. Added `mat3Mul` and `mat3InvUpperTri` helpers. R_rel = R2 _ R1^T, t_rel = t2 - R_rel\*t1. K1, K2 built from CameraIntrinsics. 150 prior multi-view-fusion tests still pass. |
| `core/src/edge-deployment.ts`           | 481  | `'Model exceeds on-chip SRAM; will use external memory (slower)'`                                                                 | **Marked legitimate** (`// stub:legitimate user-facing reason text describing real EdgeTPU behaviour`). User-visible string.                                                                                                                             |
| `core/src/mission-execution.ts`         | 438  | `Mission will use ~${...}% battery, leaving less than ${...}% for RTH`                                                            | **Marked legitimate** (`// stub:legitimate user-facing validation warning text`). UI message.                                                                                                                                                            |
| `core/src/kinematics.ts`                | 866  | `// Cannot hover — would need >100% throttle`                                                                                     | **Marked legitimate** (`// stub:legitimate physics edge-case description (TWR<1 cannot hover)`). Comment describes a physical impossibility, not deferred work.                                                                                          |
| `core/src/inter-drone-communication.ts` | 194  | `@param signed - Whether to include signature placeholder` (JSDoc)                                                                | **Marked legitimate** in expanded JSDoc (`stub:legitimate the placeholder bytes are filled in by sign()`). The `signed` flag controls real placeholder injection by the MAVLink v2 signing path.                                                         |
| `core/src/sapiens-integration.ts`       | 1587 | `// No mapping — emit a zero-confidence placeholder`                                                                              | **Marked legitimate** (`stub:legitimate sentinel keypoint`). The zero-confidence sentinel is a real fallback that lets downstream code index by mediapipe index without bounds checks.                                                                   |

## Random scan (`--mode=random`)

`--mode=random` reports 202 actionable hits across the same file set; all are
legitimate by inspection:

- **UUID generation** (`mission-execution.ts:138-141`,
  `enterprise-platform.ts:1708-1711`): `Math.random` for UUIDv4-shaped
  identifiers. Acceptable for non-security IDs.
- **Box-Muller / inverse-CDF Gaussian sampling** (`physics-simulation.ts`,
  `kinematics.ts`): `Math.random` is the correct primitive for stochastic noise
  injection.
- **RANSAC sampling** (`visual-slam.ts:3087`, `obstacle-avoidance.ts:2443`):
  random sample selection is the algorithm's foundational step.
- **Simulation scenario generation** (`modern-simulation-platforms.ts`,
  `physics-simulation.ts`): SITL/simulation tooling intentionally injects
  noise/jitter.
- **Canary deployment routing** (`edge-deployment.ts:2327`): A/B traffic split.
- **Phase offset / clock jitter** (`multi-camera-coordination.ts:698`).

These do not need per-line `// random:legitimate` annotations because they are
not staged in this commit; the pre-commit hook only runs the **stubs** mode
(`--mode=stubs`) per `.husky/pre-commit`. The whole-repo random scan runs in CI
(`scripts/stub-indicator-scan.precommit.test.mjs` / nightly job) and currently
classifies all 202 hits as expected stochastic primitives.

## Summary

- Real stubs found and fixed: **2** (gps-navigation Kalman, multi-view-fusion
  fundamental matrix).
- Legitimate qualitative markers annotated: **5**.
- Random-source false positives logged but not annotated: **202** (no action
  needed; pre-commit hook is stubs-mode only).
- Adversarial-clean status: `--mode=stubs` returns zero hits across `libs/oya/`.

V1-P2-2100..V1-P2-2107 wirings (this session) all left their files
adversarial-clean per the same scan; this audit confirms the surrounding file
set has no remaining qualitative stub markers.
