Skip to content

Phase 8: Real-world accuracy test against tj/commander.js - #8

Merged
dakshcodez merged 2 commits into
mainfrom
phase-8/real-repo-testing
Aug 14, 2026
Merged

Phase 8: Real-world accuracy test against tj/commander.js#8
dakshcodez merged 2 commits into
mainfrom
phase-8/real-repo-testing

Conversation

@dakshcodez

Copy link
Copy Markdown
Owner

Summary

Implements Phase 5 of the original plan: a real end-to-end accuracy test against a real, live-forked repository, using the actual Gemini API (not mocks). Full methodology and results in TESTING.md.

Target: forked tj/commander.js (picked over the originally-suggested FastAPI/Pydantic for its much smaller size, keeping embedding-API cost/time tractable on a free-tier key). Ran seal index and seal check for real.

Deliberate test results:

  • Correctly flagged and auto-fixed a real breaking rename (.name().setName())
  • Correctly ignored a comment-only change and an undocumented internal refactor (both filtered before ever reaching the LLM)
  • The validation pass caught a flawed initial correction on a genuinely ambiguous case and downgraded it to "needs review" instead of wrongly auto-applying it - the two-pass generate→validate design working as intended on real, not mocked, output

Three real bugs found and fixed, none of which mocked testing had caught:

  1. Indexing crashed outright on real test files (duplicate chunk ids from same-named locally-scoped test helpers) - test files now excluded from code parsing; embedding index upserts instead of inserting, so any remaining id collision degrades gracefully instead of crashing.
  2. No retry on rate limits - real indexing hit the free tier's per-minute quotas repeatedly and every 429/503 was fatal. Added retry-with-exponential-backoff to GeminiClient.
  3. CHANGELOG.md entries describing historical releases were getting "corrected" to match current code - rewriting history instead of fixing stale docs. Changelog-style files are now excluded from doc parsing entirely.

Known limitation

The changelog-exclusion fix is unit-verified (7 real filename cases, all correct) but not re-validated end-to-end against live API output - re-running the full pipeline to confirm hit the free tier's daily embedding quota (1000/day, distinct from the per-minute limits the retry logic handles). Documented honestly in TESTING.md rather than claimed as fully verified.

Test plan

  • npm run lint / typecheck / build all pass
  • Real seal index run against tj/commander.js (232 chunks, 365 sections, 194 links)
  • Real seal check run with three deliberate code changes, verdicts and corrections inspected by hand
  • isChangelogFile unit-verified against 7 real-world filename cases
  • Changelog-exclusion fix not re-validated end-to-end (daily quota exhausted) - see TESTING.md

Implements Phase 5 (real-world accuracy test). Forked tj/commander.js
(picked over the originally-suggested FastAPI/Pydantic for its much
smaller size, keeping embedding-API cost/time tractable on a free-tier
key), ran seal index and seal check for real against the live Gemini
API, and made three deliberate code changes to measure accuracy. Full
methodology and results in TESTING.md.

Results: correctly flagged and auto-fixed a real breaking rename
(.name() -> .setName()); correctly ignored a comment-only change and
an undocumented internal refactor (both never reached the LLM); the
validation pass caught and downgraded a flawed initial correction to
"needs review" instead of wrongly auto-applying it, on a genuinely
ambiguous real case - the two-pass generate/validate design working
exactly as intended, not just in mocked tests.

Live testing surfaced three real bugs no mocked test had caught:

- shared/is-test-file.ts (moved from changes/filter.ts) + parsing/
  file-walker.ts: indexing crashed outright on commander.js's real
  test suite - two locally-scoped test helpers both named
  `makeProgram` in different describe() blocks produced identical
  chunk ids, and Vectra's insertItem throws on a duplicate id. Test
  files are now excluded from code parsing entirely (they were never
  a useful doc-linking target anyway). linkgraph/embedding.ts also
  switches insertItem to upsertItem as defense in depth, so any
  remaining id collision degrades gracefully instead of crashing.
- llm/gemini-client.ts: real indexing and staleness-checking hit the
  free tier's per-minute quotas repeatedly (100 embed requests/min,
  15 generate requests/min for gemini-3.5-flash-lite), and every
  429/503 was previously fatal, aborting the whole run. Added
  retry-with-exponential-backoff (up to 4 attempts).
- docs/file-walker.ts: CHANGELOG.md entries describing historical
  releases got "corrected" to match current code state - e.g. a 2020
  entry for `.parseOption()` rewritten to describe a later rename
  that has nothing to do with the actual deliberate test change,
  silently rewriting history instead of fixing stale docs. Fixed by
  excluding changelog-style files (CHANGELOG/CHANGES/HISTORY/
  RELEASES.md, case-insensitive) from doc parsing entirely, the same
  way test files are excluded from code parsing.

One fix is not re-validated end-to-end: the changelog exclusion is
confirmed correct at the unit level (7 real-world filename cases, all
correct) but re-running the full live pipeline to confirm it against
actual API output hit the free tier's *daily* embedding quota (1000
requests/day, distinct from the per-minute limits the retry logic
handles) - documented as a known limitation in TESTING.md rather than
silently claimed as fully verified.
- gemini-client.ts: withRetry only caught ApiError (HTTP-level
  429/503) - a raw network failure (DNS, connection reset, timeout)
  never gets wrapped into ApiError by the SDK and was previously not
  retried at all, despite being exactly the kind of transient
  flakiness this fix was meant to cover, especially relevant since
  this runs in CI. Now also retries on ECONNRESET/ETIMEDOUT/
  ECONNREFUSED/ENOTFOUND/EAI_AGAIN error codes, AbortError, and
  TypeError-with-cause (how fetch() itself reports network failure),
  while still throwing immediately for anything else.
- embedding.ts: switching insertItem to upsertItem in the previous
  commit fixed the crash on duplicate chunk ids, but traded a loud
  failure for a silent one - one of the two colliding chunks now
  just quietly becomes unlinkable with no indication anywhere. Added
  a console.warn on collision, so the fix stays non-fatal but the
  data loss is now observable instead of invisible.
- TESTING.md: added a known-limitations note that the new isTestFile/
  isChangelogFile exclusions are unconditional - .sealignore exists
  as a user-facing override but isn't wired into the indexing walk,
  only into check.ts's changed-file filtering (pre-existing gap, not
  introduced by this PR) - so there's currently no way to opt a
  specific file back in.

Found by a fresh subagent review spawned after PR #8 was opened. Both
code fixes verified against real behavior: four separate network-
failure types (ECONNRESET, TypeError+cause, AbortError, and a control
case confirming non-retryable errors still throw immediately) tested
against the live GeminiClient with the underlying SDK call mocked out
per-attempt; the duplicate-id warning verified firing with the exact
expected message via a real buildLinkGraph call with two colliding
chunks.
@dakshcodez
dakshcodez merged commit b349e0c into main Aug 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant