Skip to content

Commit 0f8a816

Browse files
committed
completed launch readiness lb 2 - 5.
1 parent 8701de1 commit 0f8a816

8 files changed

Lines changed: 24 additions & 36 deletions

docs/arrows/index.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ arrows:
99
blocks: []
1010
blockedBy: []
1111
detail: lighthouse-protocol-intelligence.md
12-
next: "Complete Gen2 processing path and remove debug fprintf calls from lfsr_lh2.c"
13-
drift: "Gen2 path (survive_process_gen2.c) is nearly empty; LFSR decoder has debug output"
12+
next: "Complete Gen2 processing path in survive_process_gen2.c"
13+
drift: "Gen2 processing path (survive_process_gen2.c) is nearly empty"
1414

1515
device-driver-stack:
1616
status: MAPPED

docs/arrows/lighthouse-protocol-intelligence.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ Decodes raw photon timestamps into calibrated sweep angles and lighthouse calibr
5353
| Protocol autodetection | LPI-PROC-001 to 004 | 3 | 1 | 0 |
5454
| Gen1 disambiguation | LPI-PROC-010 to 016 | 7 | 0 | 0 |
5555
| OOTX decoding | LPI-PROC-020 to 027 | 6 | 1 | 0 |
56-
| Gen2 LFSR | LPI-PROC-030 to 032 | 2 | 1 | 0 |
56+
| Gen2 LFSR | LPI-PROC-030 to 032 | 3 | 0 | 0 |
5757
| Angle computation | LPI-PROC-040 to 042 | 3 | 0 | 0 |
5858
| Sensor activation filtering | LPI-PROC-050 to 053 | 4 | 0 | 0 |
5959
| Back-face normal filter | LPI-PROC-060 to 066 | 7 | 0 | 0 |
6060
| Reprojection model | LPI-DATA-060 to 063 | 4 | 0 | 0 |
6161

62-
**Summary:** 36 of 40 specs implemented; 3 active gaps; 0 deferred.
62+
**Summary:** 37 of 40 specs implemented; 2 active gaps; 0 deferred.
6363

6464
## Key Findings
6565

66-
1. **Gen2 path is incomplete**`src/survive_process_gen2.c` is nearly empty; Gen2 LFSR decoder (`lfsr_lh2.c`) contains extensive debug `fprintf` calls indicating active development state. (LPI-PROC-032)
66+
1. **Gen2 path is incomplete**`src/survive_process_gen2.c` is nearly empty. (Debug `fprintf` calls in `lfsr_lh2.c` removed 2026-04-17.)
6767

6868
2. **One-way generation detection** — Once the system commits to Gen1 or Gen2 for a device, there is no recovery path. A mis-detection in the 500-packet window produces a bad session with no error surfaced. (LPI-PROC-004)
6969

@@ -76,8 +76,7 @@ Decodes raw photon timestamps into calibrated sweep angles and lighthouse calibr
7676
## Work Required
7777

7878
### Must Fix
79-
1. Remove debug `fprintf` calls from `src/lfsr_lh2.c` before any production Gen2 use (LPI-PROC-032)
80-
2. Complete `src/survive_process_gen2.c` — currently the Gen2 processing path is non-functional for full angle extraction (LPI-PROC-032, gap in spec coverage)
79+
1. Complete `src/survive_process_gen2.c` — currently the Gen2 processing path is non-functional for full angle extraction (gap in spec coverage)
8180

8281
### Should Fix
8382
3. Surface OOTX quality metrics (bad_crcs, bad_sync_bits, guess_bits) to callers so degraded calibration is visible (LPI-PROC-026)

docs/arrows/tracking-engine.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Computes continuous 6-DOF pose and velocity for tracked objects by fusing lighth
1515
- [docs/llds/tracking-engine.md](../llds/tracking-engine.md)
1616

1717
### EARS
18-
- [docs/specs/tracking-engine-specs.md](../specs/tracking-engine-specs.md) (36 specs)
18+
- [docs/specs/tracking-engine-specs.md](../specs/tracking-engine-specs.md) (41 specs)
1919

2020
### Tests
2121
- src/test_cases/barycentric_svd.c
@@ -60,12 +60,12 @@ Computes continuous 6-DOF pose and velocity for tracked objects by fusing lighth
6060
| Poser interface | TE-API-001 to 005 | 5 | 0 | 0 |
6161
| Geometric pose solvers | TE-PROC-010 to 015 | 6 | 0 | 0 |
6262
| MPFIT optimizer | TE-PROC-020 to 025 | 6 | 0 | 0 |
63-
| Kalman object tracker | TE-PROC-030 to 039 | 10 | 0 | 0 |
64-
| Kalman lighthouse tracker | TE-PROC-040 to 041 | 2 | 0 | 0 |
63+
| Kalman object tracker | TE-PROC-030 to 042 | 10 | 3 | 0 |
64+
| Kalman lighthouse tracker | TE-PROC-050 to 051 | 2 | 0 | 0 |
6565
| Reprojection model | TE-DATA-050 to 053 | 4 | 0 | 0 |
6666
| Math infrastructure | TE-DATA-060 to 064 | 4 | 1 | 0 |
6767

68-
**Summary:** 37 of 38 active specs implemented; 1 active gap (CI guard for codegen); 0 deferred.
68+
**Summary:** 37 of 41 active specs implemented; 4 active gaps (3 angular-rate gates TE-PROC-040/041/042, plus CI guard for codegen TE-DATA-064); 0 deferred.
6969

7070
## Key Findings
7171

docs/launch-readiness-triage.2026-04-17.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
33 open items in the libsurvive docs, bucketed by shoot-readiness impact.
1010

11-
- 6 **launch blockers** — silent corruption or grey failures
11+
- 6 **launch blockers** — silent corruption or grey failures (LB-1/LB-2/LB-4/LB-5 done; LB-3 deferred to on-Pi recording milestone; LB-6 open)
1212
- 5 **should fix before launch** — diagnosability gaps
1313
- 7 **nice to have** — robustness / dev hygiene
1414
- 8 **save for later** — irrelevant to stagehand (third-party bindings)
@@ -29,23 +29,19 @@ Each item either (a) lets bad data through without visibility, or (b) makes on-s
2929
- Verified 2026-04-17. `solve_global_scene()` in `poser_mpfit.c:978-989` returns `false` when `status_failure || sensor_error > max_cal_error`. Calibration commit (`PoserData_lighthouse_poses_func` at L1047) is inside the success-only `else` branch — previous calibration retained by default on failure. `status_failure` also covers MPFit convergence errors (`res <= 0`) and max-iter termination.
3030
- **Fail-loud bonus**: stagehand patch at L981-988 invokes `stagehand_gss_failure_cb` so the agent emits `GSS_FAILURE` LOG_EVENT with `bestnorm`. Spec marked `[x]`; arrow doc updated to 31/31.
3131

32-
- [ ] **LB-3 — Recording file open/write failure = loud error** (`LI-BE-063`)
33-
- Category: **fail-loud (directly matches stagehand principle)**
34-
- Currently libsurvive can silently drop recording events if the file cannot be written.
35-
- For shoots using `.rec.gz` as authoritative capture, silent drop = unrecoverable grey failure.
36-
- Fix: emit error and disable recording instead of silent drop.
32+
- [D] **LB-3 — Recording file open/write failure = loud error** (`LI-BE-063`) — **DEFERRED to on-Pi recording milestone**
33+
- Reviewed 2026-04-17. Stagehand today does all shoot recording client-side (SMLL/FBX); libsurvive's `.rec.gz` is not in the shoot path, so fail-loud behaviour is not load-bearing yet.
34+
- **Revisit when on-Pi recording is added.** At that point `.rec.gz` becomes shoot-authoritative and open/write failures must fail loud + disable (or fail closed, depending on the design at the time). Keep spec `LI-BE-063` open.
3735

38-
- [ ] **LB-4 — Remove debug `fprintf` from Gen2 LFSR decoder** (`LPI-PROC-032`)
36+
- [x] **LB-4 — Remove debug `fprintf` from Gen2 LFSR decoder** (`LPI-PROC-032`)
3937
- Category: **operational safety**
40-
- Uncontrolled stdout in hot path — pollutes logs, can distort timing.
41-
- Flagged in [lighthouse-protocol-intelligence.md](arrows/lighthouse-protocol-intelligence.md) "Must Fix #1". Cheap.
42-
- Fix: wrap in `SV_VERBOSE` or delete.
38+
- Done 2026-04-17. All 4 `fprintf(stderr, ...)` calls deleted from `src/lfsr_lh2.c` (previously at L97-98, L103, L170-171, L177). Spec `LPI-PROC-032` marked `[x]`; arrow doc "Must Fix #1" cleared.
4339

44-
- [ ] **LB-5 — Resolve duplicate spec IDs `TE-PROC-040/041`**
40+
- [x] **LB-5 — Resolve duplicate spec IDs `TE-PROC-040/041`**
4541
- Category: **coherence**
46-
- Defined twice in [tracking-engine-specs.md](specs/tracking-engine-specs.md): once for `lc-angular-rate-max` (lines 43–44), once for Kalman lighthouse tracker (lines 49–50).
47-
- Breaks grep-based traceability during incident response.
48-
- Fix: renumber the Kalman-lighthouse-tracker pair to unused IDs.
42+
- Done 2026-04-17. Kalman-lighthouse-tracker pair renumbered to **TE-PROC-050 / TE-PROC-051** in [tracking-engine-specs.md](specs/tracking-engine-specs.md). `TE-PROC-040 / 041 / 042` now unambiguously refer to the angular-rate gates (still `[ ]`, tracked under SF-4 / LB-6).
43+
- Bonus cleanup: `src/test_cases/residual_cascade_props.c:781` referenced `TE-PROC-040` but described the per-LH adaptive R formula → corrected to `TE-PROC-038`.
44+
- Arrow doc updated: tracking-engine.md spec count 36→41, Kalman object tracker row now 030–042 (10 impl, 3 gaps), Kalman lighthouse tracker row now 050–051.
4945

5046
- [ ] **LB-6 — Measure + enable pose-emission gates** (`kalman-max-pose-angular-rate`, `--light-max-error`)
5147
- Category: **operational safety / fail-closed on output**

docs/specs/lighthouse-protocol-intelligence-specs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Prefix: **LPI**
3434

3535
- [x] **LPI-PROC-030**: The system shall identify the Gen2 lighthouse channel (0–31) by matching observed timing against 32 known LFSR polynomial sequences.
3636
- [x] **LPI-PROC-031**: When decoding Gen2 channel identity, the system shall tolerate ±2-sample timing deviation from the expected LFSR sequence.
37-
- [ ] **LPI-PROC-032**: The system shall remove debug output (fprintf calls) from the Gen2 LFSR decoder before production use.
37+
- [x] **LPI-PROC-032**: The system shall remove debug output (fprintf calls) from the Gen2 LFSR decoder before production use.
3838

3939
## Angle Computation
4040

docs/specs/tracking-engine-specs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Prefix: **TE**
4646

4747
## Kalman Lighthouse Tracker
4848

49-
- [x] **TE-PROC-040**: The system shall maintain a 7-dimensional Kalman filter per lighthouse (position + quaternion) updated by pose observations from the geometric solvers.
50-
- [x] **TE-PROC-041**: The system shall support push/pop of lighthouse Kalman state to enable hypothesis testing without committing to a new lighthouse position.
49+
- [x] **TE-PROC-050**: The system shall maintain a 7-dimensional Kalman filter per lighthouse (position + quaternion) updated by pose observations from the geometric solvers.
50+
- [x] **TE-PROC-051**: The system shall support push/pop of lighthouse Kalman state to enable hypothesis testing without committing to a new lighthouse position.
5151

5252
## Reprojection Model
5353

src/lfsr_lh2.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,10 @@ static uint32_t find_possible_polys(uint32_t sample, uint32_t mask, uint32_t *ti
9494
uint32_t error = popcnt(error_bits);
9595

9696
if (error > 0) {
97-
if (((i / 2) == 6) || ((i / 2) == 15))
98-
fprintf(stderr, "Error for %d was %d %x %x %x\n", i, error, final_state & mask, sample & mask, mask);
9997
rtn ^= (1 << i);
10098
} else {
10199
timings[i] = lfsr_lookup_query(poly_pair_lookups[i], state) - offset;
102100
reconstructed_sample[i] = final_state;
103-
fprintf(stderr, "Timing for %d was %u\n", i, timings[i]);
104101
}
105102
}
106103

@@ -166,15 +163,11 @@ survive_channel survive_decipher_channel(const uint32_t *sample, const uint32_t
166163

167164
if (error == 0)
168165
break;
169-
} else {
170-
fprintf(stderr, "Err %d for %d (%d) %08x vs %08x %08x %08x\n", error, o, j, predicted_sample,
171-
sample[i], mask[i], error_bits);
172166
}
173167
}
174168

175169
if (recon_samples[32 * i + j] == 0) {
176170
possible_polys ^= (1u << j);
177-
fprintf(stderr, "Eliminated %d\n", j);
178171
}
179172
}
180173
}

src/test_cases/residual_cascade_props.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ TEST(ResidualCascade, SingleOutlierCanTriggerCascade) {
778778
// ── 8. Adaptive R (per-LH light_var scaling) Properties ─────────
779779
//
780780
// These test the invariants of the per-LH adaptive R formula introduced in
781-
// survive_kalman_tracker.c (TE-PROC-040):
781+
// survive_kalman_tracker.c (TE-PROC-038):
782782
//
783783
// lh_var = (mean_res > 0 && lh_res > 0)
784784
// ? base_var * max(1.0, lh_res / mean_res)

0 commit comments

Comments
 (0)