Skip to content

Fix TODOs, optimize functions, and enhance test coverage#2210

Open
robgruen wants to merge 55 commits intomainfrom
dev/robgruen/TODOs
Open

Fix TODOs, optimize functions, and enhance test coverage#2210
robgruen wants to merge 55 commits intomainfrom
dev/robgruen/TODOs

Conversation

@robgruen
Copy link
Copy Markdown
Collaborator

[Copilot is generating an outline...]

robgruen and others added 26 commits April 10, 2026 16:01
- knowPro/collections: matchesWithMinHitCount condition > 0 → > 1 (optimization,
  all matches already have hitCount ≥ 1 by design)
- dispatcher/unknownSwitcher: parallelize assistant-selection partitions via
  Promise.all; extract selectFromPartitions() for testability
- knowledgeProcessor actions/entities: addMultiple concurrency 1 → settings.concurrency
- cache/explainWorkQueue: extend parameter-value-in-request check to cover numbers
- azure-ai-foundry/wikipedia: add optional locale param (default "en") to
  getPageObject and getPageMarkdown

Each fix is covered by new or updated unit tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The playlist branch was an empty stub — playlists were silently omitted
from completions. Now returns all playlist names in API order (no timestamp
field is available on PlaylistObjectSimplified).

Adds jest infrastructure and userData.spec.ts with 5 tests covering
playlist flag off/on, undefined playlists, combined track+playlist output,
and track timestamp sorting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…es, add tests

- Export TokenStats type (promptTokens, completionTokens, totalTokens) and add
  optional tokenStats field to IndexData
- Throttle sendIndexStatus() to folder boundaries (count === max) to avoid
  flooding the host process with progress updates
- Add jest infrastructure and unit tests for image-memory package

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The function was loading entries sequentially with a for-loop while the
sibling loadEntries() already used asyncArray.mapAsync with the folder's
concurrency setting. Apply the same pattern to loadEntriesSubset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each call was reading all file names from disk just to fetch the first
and last timestamps. Cache the result and invalidate it on put, remove,
removeInRange, and clear.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ectType

- Remove three TODO typing comments
- Use ParamObjectType cast instead of 'as any' in ensureProperties
- Add direct unit tests for getActionProperty and ensureProperties

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…a and FunctionCallingJsonSchema

Introduces a named Record<string, unknown> type that documents the intent
(an opaque JSON Schema object for the OpenAI API) while being more
type-safe than raw any.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion tests

The lowercase match finds the right action but string parameter values
come back lowercased, so we validate the action name rather than the
full action equality.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ActionSchema

Checks that the JSON has valid version, entry, and types fields before passing
to fromJSONParsedActionSchema, producing a clear error for corrupted cache files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Eliminates the duplicate batch-processing loop by delegating to the
shared runTestBatch utility, which handles getBatchFileLines, callbacks,
stopOnError, and file writing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Chunker

Computes lineStarts once per source file instead of once per declaration,
avoiding repeated O(n) scans. Adds unit tests for chunkifyTypeScriptFiles.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Module-level map avoids repeated API calls for the same genre across
different invocations. Also removes stale spelunker/eval TODO entry
(already implemented via eval-config.json file reading).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces generateEmbedding with generateEmbeddingWithRetry in addOrUpdate,
which provides automatic exponential backoff (3 retries, 2500ms base delay).
Also refactors createProgramNameIndex to accept an optional model override
for testability, and adds jest test infrastructure to the desktop package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…earch

Merges the two separate intersect(topicIds, possibleIds) and
intersect(topicIds, topicIdsWithSource) operations in search() into a
single intersectMultiple call, which is semantically equivalent but
cleaner. Also adds unit tests for intersectMultiple in setOperations.spec.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the three-argument add(value, score, isExactMatch) with two
focused methods: addExact(value, score) and addRelated(value, score).
Updates all internal callers in collections.ts, query.ts, and
dataFrame.ts. MessageAccumulator.add() override is also renamed to
addExact() with its distinct score-max-wins semantics preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extracts IConversationData, ITermToSemanticRefIndexData, and
ITermToSemanticRefIndexItem into a new dataFormats.ts file. Re-exports
them from interfaces.ts for backward compatibility with existing callers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Before writing, rename existing _data.json and _embeddings.bin to .bak
files. On success, delete the backups; on failure, restore them. This
prevents data loss if the process crashes mid-write.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tiple/addUpdateSources

The old names were generic database CRUD terms; the new names describe
the merge semantics (add-or-update postings) that distinguish this
interface from a plain key-value store.

Updated the interface definition, all three concrete implementations
(file-system, SQLite, Elasticsearch), and all call sites across
knowledgeProcessor, spelunker, and docuProc.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The old name was misleading — this class indexes terms to semantic
references, not conversations. Updated the class definition in
conversationIndex.ts and all 10 consumer files across the knowPro,
memory, and examples packages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both CosmosDB and MongoDB sinks retried immediately on transient errors
(e.g. ENOTFOUND when offline). Now each retry waits an exponentially
increasing delay (1 s, 2 s, …) before the next attempt, reducing
unnecessary network hammering when connectivity is lost.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 'say' actions (speaker → listener) were already populated, but the
inverseActions array was always empty. Now each 'say' action gets a
corresponding 'hear' action (listener → speaker), matching the pattern
used by ConversationMessageMeta.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When users filter by year range (e.g. "year:1990-2000"), the tokenizer
splits the input into "1990 - 2000". The Year constraint now detects
this pattern and performs an inclusive range check against the track's
release year rather than a substring match.

Also removes stale TODO.md entries for queryInterface.ts and
pdfQNAInteractiveApp.ts that were already implemented.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two improvements to the getTopK function:
- When k < 1 (return-all case), skip the O(n log n) sort entirely and
  return map values directly in O(n).
- Change `k === map.size` guard to `k >= map.size` so over-sized k
  values also short-circuit correctly without running the score-level loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When closeAgentContext is called, delete the options channel from the
channel provider and clear the optionsRpc reference. Options are
agent-scoped (created once per initializeAgentContext call), so they
can safely be released when the context is torn down.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d parseTimeString

Replace stub validateCalendarDate/validateCalendarTime functions (which accepted any
non-empty string) with real validation: relative terms (today/tomorrow/next week),
parseable dates via parseFuzzyDateString, named times (noon/midnight), 24h HH:MM,
and 12h am/pm formats. Adds jest test infrastructure and 11 unit tests to the
calendar package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI temporarily deployed to development-fork April 21, 2026 20:22 Inactive
Copilot AI temporarily deployed to development-fork April 21, 2026 20:22 Inactive
github-merge-queue Bot pushed a commit that referenced this pull request Apr 23, 2026
- Derive image taker name from EXIF `Artist`/`OwnerName`
- Accept single-letter / spelled-out EXIF GPS references in `getGeo`
- Safe backup in `ConversationMemory.autoSaveFile`
- Inverse "hear" actions in `PodcastMessageMeta.getKnowledge()`
- `indexingService`: `TokenStats` type, throttled status updates, tests

Split from #2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- Optional `language` parameter on Wikipedia helpers
- URL encoding / protocol validation in Wikipedia fetches; tests

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
…crosoft#2230)

- Rename `ConversationIndex` -> `TermToSemanticRefIndex`
- Rename `TextIndex.put*` -> `addUpdate*`
- Split `MatchAccumulator.add()` into `addExact()`/`addRelated()`
- Move serialization interfaces to `dataFormats.ts`
- Combine sequential intersect calls into `intersectMultiple` in topics
search
- Cache `getTimeRange()` in `TemporalLog`
- Refactor `runSearchBatch` to use `runTestBatch`
- `addMultiple` concurrency from hardcoded 1 -> `settings.concurrency`

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- Add action-name validation for lower-case request matching in
construction round-trip

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- `HitTable.getTopK`: skip sort for k<1, handle k>size
- Parallelize `embeddingFS.loadEntriesSubset` via `asyncArray.mapAsync`
- Exponential backoff on telemetry logger retry loops
- `JsonSchemaType` alias replacing `any` in
structured-output/function-calling schemas

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
…es (microsoft#2239)

- Accumulate diagnostic data instead of replacing in the renderer
- Open links in system browser when a modifier key is held
- Review-feedback fixes (XSS hardening, event-listener retention)

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- Use geocoding API for weather location validation; adds tests

Split from microsoft#2210.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- Use `generateEmbeddingWithRetry` for 429 backoff in `programNameIndex`
- Jest infra + tests

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- Drive dynamic-agent permission from manifest (not hardcoded name)
- Cache lookup-clarify translator per session
- Detect and skip circular type references in action template builder
- Validate parsed action schema JSON structure in
`loadParsedActionSchema`
- Clean up options RPC channel when agent context is closed
- Parallelize `unknownSwitcher` assistant-selection partitions

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
…2231)

- Diacritic-insensitive matching in construction cache (handled inside
`MatchSet` regex to avoid grammar regression)
- Validate number parameters against request in `explainWorkQueue`
- Replace `as any` with `ParamObjectType` in `validateExplanation`

Split from microsoft#2210.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
- Implement date/time validation using `parseFuzzyDateString` +
`parseTimeString`
- Jest infra + lockfile update

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
…t#2235)

- Cache Spotify genre search results in `findTracksWithGenre`
- Year-range support in Spotify track year filter
- `player/userData`: return playlist names in `getUserDataCompletions`
- Jest infra + tests

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
curtisman pushed a commit to curtisman/TypeAgent that referenced this pull request Apr 24, 2026
Consolidated TODO.md cross-offs + `docuProc/pdfImporter` lint for the
changes landing across the split PRs.

Split from microsoft#2210.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: robgruen <25374553+robgruen@users.noreply.github.com>
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.

3 participants