Skip to content

feat(t3-2): SourceSpec Pydantic models and load_manifest() loader - #192

Open
JesuFemi-O wants to merge 4 commits into
feat/m3-t3-1from
feat/m3-t3-2
Open

feat(t3-2): SourceSpec Pydantic models and load_manifest() loader#192
JesuFemi-O wants to merge 4 commits into
feat/m3-t3-1from
feat/m3-t3-2

Conversation

@JesuFemi-O

@JesuFemi-O JesuFemi-O commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds src/tycoon/ingestion/manifest.py with CredentialField, ConfigField, and SourceSpec Pydantic models
  • load_manifest() reads data/verified_sources.json relative to the package, validates all entries against SourceSpec, and returns dict[str, SourceSpec] keyed by source id
  • @functools.lru_cache() on load_manifest() — JSON parsed once per process
  • SourceSpec.credential_defaults() returns {key: "${ENV_VAR}"} for all credential fields
  • 17 tests in tests/test_manifest.py covering roundtrip count, id injection, full github entry (including docs_url and resources), requires_dlt_init=false for generic sources, stripe dlt mapping, credential_defaults, and model construction defaults

Test plan

  • uv run pytest tests/test_manifest.py — all 17 pass

Closes #100


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Pydantic models (CredentialField, ConfigField, SourceSpec) validate
every entry in verified_sources.json at load time. SourceSpec.id is
injected from the dict key, not stored redundantly in the JSON.
credential_defaults() produces the env-var reference dict used by
collect_config() in T3-3.

Closes #100
…mport; tighten credential_defaults return type to dict[str, str]
- @functools.lru_cache() on load_manifest() so the JSON is parsed once per
  process — free optimization, no callers mutate the returned dict
- test_github_full_entry: assert docs_url and resources fields to close the
  only unchecked non-None fields on the full entry
…s_dlt()

- Remove dlt_source, dlt_init_name, requires_dlt_init as top-level fields
- Add provider: str and backend: dict[str, Any] — opaque per-provider bag
- Add DltBackend Pydantic model for typed access to dlt-specific fields
- Add SourceSpec.as_dlt() — raises ValueError for non-dlt providers so
  callers can't accidentally treat an Airbyte spec as a dlt one
- Update tests: dlt field access via .as_dlt(); add provider/backend coverage;
  new tests for as_dlt() return type and non-dlt provider guard
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