Skip to content

fix(SOSO-434): MockAppSheetClient.getKeyField() schema lookup statt hardcoded map#12

Merged
wagnert merged 2 commits intodevelopfrom
feature/SOSO-434-mock-keyfield-fix
Mar 11, 2026
Merged

fix(SOSO-434): MockAppSheetClient.getKeyField() schema lookup statt hardcoded map#12
wagnert merged 2 commits intodevelopfrom
feature/SOSO-434-mock-keyfield-fix

Conversation

@wagnert
Copy link
Member

@wagnert wagnert commented Mar 11, 2026

Summary

  • Replace hardcoded keyField map in MockAppSheetClient.getKeyField() with schema-based lookup from ConnectionDefinition
  • Fix unsafe fallback: Changed from 'id' (non-existent in AppSheet) to convention-based ${tableName}_id
  • 7 new tests covering schema-key vs table-name distinction, backward compatibility, CRUD with resolved keyFields

Problem

getKeyField() used a hardcoded 3-entry map. Tables not in the map (e.g. solution, industry, ideal_customer_profile) silently fell back to 'id' — a field that doesn't exist in AppSheet. This caused downstream workarounds in service_portfolio_mcp (BUG-ASUP-002).

Solution

Iterate Object.values(connectionDef.tables) and match by tableDef.tableName (the real AppSheet table name), not by schema key name. This aligns MockAppSheetClient with the real AppSheetClient behavior.

Changed Files

File Change
src/client/MockAppSheetClient.ts getKeyField(): schema lookup replaces hardcoded map
tests/client/MockAppSheetClient.test.ts 7 new tests in getKeyField() Schema-Lookup (SOSO-434) suite

Test Results

  • 272/272 tests passed (43 in MockAppSheetClient, incl. 7 new)
  • Build: clean
  • Lint: 0 errors

References

wagnert added 2 commits March 11, 2026 20:06
SOSO-434: Fix getKeyField() lookup to iterate connectionDef.tables by
tableDef.tableName instead of schema key name. Add test for schema-name
vs table-name distinction.

SOSO-435: Replace string-config approach with Strategy-Pattern
(UnknownFieldPolicyInterface) analog to SelectorBuilderInterface.
Remove warn policy (library stays silent), add delete() coverage,
set StripUnknownFieldPolicy as default. Three implementations:
Ignore, Strip (default), Error — injectable via DynamicTableFactory.
…ockAppSheetClient

getKeyField() now resolves key fields from ConnectionDefinition instead of
a hardcoded 3-entry map with unsafe 'id' fallback. The lookup iterates
connectionDef.tables values and matches by tableDef.tableName (the real
AppSheet table name), not by schema key name.

Fallback changed from 'id' to convention-based ${tableName}_id.

Closes #10
@wagnert wagnert merged commit 92b23b1 into develop Mar 11, 2026
4 checks 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