Skip to content

Extension registries + extract accredited-portal to embarc-data#205

Open
sroussey wants to merge 13 commits into
mainfrom
accredited-portal
Open

Extension registries + extract accredited-portal to embarc-data#205
sroussey wants to merge 13 commits into
mainfrom
accredited-portal

Conversation

@sroussey

Copy link
Copy Markdown
Contributor

What & why

@workglow/sec should hold only SEC-sourced data and the logic that produces it. The accredited-investor portal feature — curated portal records + fingerprint signals, plus Form D → portal attribution (a value computed on top of SEC data) — is extracted into the private embarc-data superset (companion PR). This PR is the sec half.

To make that clean and reusable (this is the first of many such extractions), sec gains two general extension registries that its own code uses too:

  • registerResolverExtension (src/resolver/resolverExtensions.ts) — every resolver kind registers through it: sec's own person / company / sponsor-family / underwriter-family (via registerSecResolvers), plus downstream kinds like embarc-data's portal-attributor. It backs the unified version resolver <kind> ceremonies (coverage + drop-previous dispatch to the registered kind), componentRegistry, and resolverIds. ResolverId becomes a runtime-validated string.
  • registerDatabaseExtension + registerDatabaseSetupHook (src/config/databaseExtensions.ts) — downstream repo tokens are created/dropped by db setup/db reset after the built-in SEC tables, and the setup hook fires inside setupAllDatabases() (after EnvToDI) so a superset's tables + resolver kinds also materialize on the init path, not just db setup.

Changes

  • Registry-driven resolver versioning (componentRegistry, ResolverCoverage, ceremonies dispatch by registry, no hardcoded per-kind branches).
  • DatabaseExtensionRegistry + setup-hook wired into setupAllDatabases/resetAllDatabases.
  • Expanded public barrel (src/index.ts) with the DI/versioning/observation/normalization internals a downstream feature needs — routed through the barrel so a consumer shares sec's single globalServiceRegistry and TypeBox instance.
  • Removed inline Form D portal attribution from processFormD (ingestion now only produces observations; attribution is a batch pass in embarc-data).
  • Deleted the accredited-portal feature (storage, seed, resolver, command). Standalone sec db setup no longer creates the three portal tables.
  • Docs: CLAUDE.md points to embarc-data and documents the extension registries.

Testing

  • Full suite: 1896 pass / 0 fail; tsc clean; bun run build clean.
  • Fresh-clone CI simulation (bun ibun run buildbun test) green.
  • xhigh multi-agent code review run and findings applied (init-path setup hook, coverage-guard message, dedup, dispatch test).

Design docs

  • Spec: prd/docs/superpowers/specs/2026-07-17-accredited-portal-extraction-to-embarc-data-design.md
  • Plan: prd/docs/superpowers/plans/2026-07-17-accredited-portal-extraction-to-embarc-data.md

Companion: embarc-data accredited-portal branch (hosts the moved feature).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SN7APmki7GFHYYyhBd8ZFM

sroussey and others added 13 commits July 17, 2026 14:12
Replace the static RESOLVER_IDS array and hardcoded per-kind switches with
the runtime ResolverExtensionRegistry everywhere. ResolverId becomes a
runtime-validated string; coverage and drop-previous dispatch through the
registered kind's closures. Wire registerSecResolvers() into the CLI
bootstrap and into the tests that enumerate resolver kinds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SN7APmki7GFHYYyhBd8ZFM
…on bootstrap

setupAllDatabases() -> bootstrapComponentVersions() now enumerates the
ResolverExtensionRegistry, and this path also runs from `init` (which skips
the preAction hook that calls registerSecResolvers). Register idempotently
here so resolver component-version rows are seeded on every setup path.
- databaseExtensions: add registerDatabaseSetupHook/runDatabaseSetupHooks;
  setupAllDatabases runs them after EnvToDI/Sqlite.init so a downstream package's
  tables + resolver kinds materialize on the `init` path too (which bypasses the
  CLI preAction hook), not only `db setup`.
- ResolverCoverage: split the coverage guard so a non-family resolver kind
  without a coverage closure is no longer mislabeled "family-tier"; wrap the
  over-length import.
- barrel: export registerDatabaseSetupHook, setupAllDatabases, Sqlite,
  computeResolverCoverage (needed by the downstream init-path + dispatch tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SN7APmki7GFHYYyhBd8ZFM
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