fix(#1831): resolve ESLint errors and unused-var warnings from #1829/#1830

Two hard errors in src/state-transition.cts:
- reconcileCurrentPosition: `!== null` guards on `Record<string,unknown>`
  values don't narrow the type to a primitive, causing
  @typescript-eslint/no-base-to-string to fire on String(fm.current_phase)
  and String(fm.current_phase_name). Extract to typed locals + use typeof
  narrowing so the rule sees string | number — which is the actual invariant.

Four unused-var warnings (warnings are still defects per RULESET):
- stripTemplatePlaceholders: `placeholder` was assigned value.trim() but
  never read — the value came from the loop variable itself, so removed.
- deduplicateSessionArchive: `sectionContent` was sliced but the filter
  below uses the raw hs offsets directly — variable was dead code; removed.
- state-rebuild.test.cjs: first transitionCore call in the orphan-row test
  is covered by the dedicated Leaky-Abstractions guard test below it;
  remove the no-op call rather than silently ignoring its result.
- state-rebuild.test.cjs: `before = state` in the sync regression guard
  test was never read — remove the dead assignment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-29 20:08:17 -04:00
parent d8bc1bc636
commit f65866f17d
2 changed files with 7 additions and 10 deletions

View File

@@ -367,8 +367,7 @@ describe('ADR-1817 §2: rebuild reconciles **By Phase:** table via phaseInventor
{ number: '3', name: 'Test Phase', planCount: 5, summaryCount: 4 },
],
};
const result = transitionCore(drifted, { kind: 'rebuild' }, baseDeps);
// Note: passing baseDeps here (no provider) → reconcile is a no-op.
// First call with no phaseInventoryProvider → no-op (covered by its own test below).
// Re-run with the provider-wired deps:
const result2 = transitionCore(drifted, { kind: 'rebuild' }, deps);
// Strip the audit log so we only inspect LIVE table rows (the log's
@@ -421,7 +420,6 @@ describe('ADR-1817 §2: rebuild reconciles **By Phase:** table via phaseInventor
describe('ADR-1817 §5/§6: rebuild does not affect sync or prune (regression guard, criterion #7)', () => {
test('sync still patches its three frontmatter fields when rebuild is also available', () => {
const state = cleanState();
const before = state;
const result = transitionCore(
state,
{ kind: 'sync', totalPlansInPhase: 7, percent: 50 },