Skip to content

feature - add function registry foundation (#31)#42

Merged
dannymeijer merged 3 commits into
mainfrom
feature/31-implement-rfc-014-function-registry
May 24, 2026
Merged

feature - add function registry foundation (#31)#42
dannymeijer merged 3 commits into
mainfrom
feature/31-implement-rfc-014-function-registry

Conversation

@dannymeijer
Copy link
Copy Markdown
Collaborator

@dannymeijer dannymeijer commented May 23, 2026

Summary

This PR implements the RFC 014 function registry foundation for the current InQL public helper surface. The registry follows the declaration-side registration model: public helpers register themselves with @FUNCTION_REGISTRY.add("name", deterministic_spec(...)), and the typed spec passed to that decorator is the machine-readable source of truth.

The old split-brain shape is gone: no authored function-ref constants, no central hardcoded function_registry_entries() list, and no separate decorator/link surface. Stable function refs are derived from canonical names, and runtime registry entries are produced by the decorator calls on the helpers themselves.

Lifecycle metadata is part of the registry payload: each helper carries a typed FunctionLifecycle(since=v0_1, changed=[], deprecated=None) record, with FunctionVersion, FunctionChange, and FunctionDeprecation available for future catalog evolution. The version values are lowercase const model values, not uppercase static workarounds.

Type of change

  • Bug fix
  • New feature
  • Refactor / maintenance
  • Documentation
  • CI / tooling
  • RFC (adds/updates docs/rfcs/*)

Area(s)

Select the primary areas touched (labels sync from checked lines when the triage workflow runs):

  • Package & tests
  • Specification (RFCs)
  • Documentation
  • Automation & repo config
  • Other

Key details

  • User-facing behavior: Public helpers such as col, lit, sum, count, add, mul, eq, and gt remain available with the same behavior, but are now registered with stable function refs for generated docs, diagnostics, Prism/lowering metadata, and backend capability checks.
  • Registry model: src/function_registry.incn defines the typed registry primitives and FunctionRegistry.add(...). src/functions.incn owns the package registry instance and each helper supplies its metadata in the decorator call attached to that helper.
  • Lifecycle model: Adds typed lifecycle metadata (FunctionVersion, FunctionChange, FunctionDeprecation, FunctionLifecycle) and verifies the current helper set is introduced in v0_1 with no changes/deprecation yet.
  • Source-format cleanup: Centralizes closed SourceKind policy in src/session/source_formats.incn, so Session schema planning and DataFusion source registration consume one policy boundary instead of duplicating source-kind dispatch.
  • Validation: scripts/check_function_registry_metadata.incn validates runtime registry entries against checked API metadata: helper presence, exactly one FUNCTION_REGISTRY.add decorator, canonical-name agreement, argument names, argument types, return type, duplicate refs/names, and unmatched registry decorators.
  • CI/tooling: CI builds Incan from INCAN_REF (release/v0.3) instead of tracking main, then runs formatting, style, registry metadata, build, package tests, and pub-consumer smoke checks.
  • Compiler dependency: Lowercase const lifecycle model values require Incan #658/#659 as fixed by incan PR #660, or an equivalent release/v0.3 compiler containing that fix.

Testing / verification

  • make ci (or equivalent target breakdown)
  • Manual verification described below

Manual verification notes:

  • Ran incan test tests/test_session.incn; 22 session tests passed after the source-format policy cleanup.
  • Ran make ci; formatting, style, registry metadata, library build, 96 tests, and pub-consumer smoke passed before the lifecycle const/lowercase update.
  • Ran /private/tmp/incan-660-verify/target/debug/incan test tests/test_function_registry.incn; 7 registry tests passed with the #660 compiler.
  • Ran make registry-metadata INCAN=/private/tmp/incan-660-verify/target/debug/incan; metadata check passed for 17 helpers.
  • Ran make fmt-check INCAN=/private/tmp/incan-660-verify/target/debug/incan; formatting passed.
  • Ran make build test INCAN=/private/tmp/incan-660-verify/target/debug/incan; library build and 96 package tests passed.
  • Ran make test-style; test style passed.
  • Ran make smoke-consumer INCAN=/private/tmp/incan-660-verify/target/debug/incan; pub-consumer smoke passed.
  • Ran incan architect /Users/danny/Development/encero/tmp/inql-30-rfc013-orchestrator --format text; the previous .source_kind finding is gone, leaving only the scalar-expression dispatch finding deferred to RFC 015.

Docs impact

  • No docs changes needed
  • Docs updated
  • Docs follow Divio intent (tutorial/how-to/reference/explanation) where applicable

If docs updated:

  • Link(s): docs/rfcs/014_function_registry.md, docs/language/reference/functions/index.md, docs/release_notes/v0_1.md, docs/rfcs/README.md

Checklist

  • I kept public docs user-focused and moved internals to contributing docs when appropriate
  • I avoided duplicating canonical install/run instructions in multiple places
  • I added/updated tests where it materially reduces regressions

Closes #31

@incan-triage-bot incan-triage-bot Bot added automation CI, Makefile, .github/, repo config documentation Improvements or additions to documentation package Library source, tests, incan.toml specification docs/rfcs/ normative RFCs labels May 23, 2026
@dannymeijer dannymeijer force-pushed the feature/31-implement-rfc-014-function-registry branch from 19cdaf2 to 44c7be0 Compare May 23, 2026 13:50
@dannymeijer dannymeijer marked this pull request as ready for review May 23, 2026 18:19
@dannymeijer dannymeijer force-pushed the feature/31-implement-rfc-014-function-registry branch from 44c7be0 to 09a62d6 Compare May 24, 2026 08:09
@dannymeijer dannymeijer force-pushed the feature/31-implement-rfc-014-function-registry branch from 09a62d6 to f181c86 Compare May 24, 2026 09:10
@dannymeijer dannymeijer merged commit 651e5c4 into main May 24, 2026
4 of 7 checks passed
@dannymeijer dannymeijer deleted the feature/31-implement-rfc-014-function-registry branch May 24, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation CI, Makefile, .github/, repo config documentation Improvements or additions to documentation package Library source, tests, incan.toml specification docs/rfcs/ normative RFCs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC 014: Function registry and catalog governance

1 participant