Repository navigation
Releases
okf-parser 0.48.2
okf-parser 0.48.2
applynow copies the Markdown body byte for byte when only the frontmatter changes. Before, a body containing a bare\r(for example a\rmthat lost its backslash in a LaTeX formula) came back with each\rturned into a newline, which silently rewrote content the edit never touched.- The line-ending style written for the frontmatter now follows the opening delimiter line. A
\r\nthat appears only in the body no longer converts an LF frontmatter to CRLF. - A body replaced through an edit is still written in the document's line-ending style, as before.
okf-parser 0.48.1
okf-parser 0.48.1
apply agora escreve listas planas de frontmatter
Campos de lista plana passam a ser colunas graváveis no okf-parser apply, incluindo operações DuckDB como list_append e substituição por literais de lista. O writer preserva listas como YAML estruturado em vez de serializá-las como strings.
Listas declaradas em .schema.sql mantêm o tipo de lista e os constraints NOT NULL e CHECK aplicáveis. Mapas, listas aninhadas e campos que misturam valores escalares e listas continuam fora do namespace gravável.
-
Add an engine-only Rust fast path that tests and lints
okf-enginewithout fetching DuckDB or compiling the SQL/MCP facade. -
Record Cargo wall-time metadata and preserve
cargo --timingsreports for both the fast path and the existing full Rust gate, so future SQL/MCP modularization can be based on measured build costs. -
Add non-default experimental Rust build profiles and a CI benchmark comparing build time, binary size, parsing/inventory, search, and SQL performance without changing the release profile.
-
Make the Rust SQL and MCP dependency groups optional while keeping the public
okf-parserbinary on the completefullfeature set. -
Add an engine-only library facade and a CI contract proving that engine, SQL, MCP, and full feature graphs do not pull unrelated heavy dependencies.
-
Preserve dynamic official builds by replacing the old
--no-default-featuresconvention with--no-default-features --features full. -
Document the development commands for engine-only, SQL-only, MCP-only, and complete dynamic builds.\n
-
Run the cold, bundled-DuckDB source consumer in parallel with all five platform wheel builds, retaining it as a required release-set gate.
-
Cache compatible native Cargo dependencies for CI, macOS Intel/ARM and Windows, with separate compiler, platform, feature and DuckDB identities. Always rebuild and exercise each wheel.
-
Reuse an absolute Cargo target across CI source packaging and installation to avoid compiling the same dependencies twice. Keep release optimization settings and all validations unchanged.
-
Install the Python DuckDB module explicitly before checking a database exported by the public PyPI wheel. The CLI bundles libduckdb and does not require that Python module at runtime.
-
Allow bounded registry latency with a 30-second connection timeout, a 120-second HTTP-read timeout, and three retries.
-
Apply
ruff formatto the files left unformatted by the list-fieldapplychange and drop four unusednoqadirectives inscripts/cargo_timings.py, so thequalitygate passes onmainagain. No behavior change. -
Align
test_frontmatter_the_old_round_trip_check_refused_is_now_edited_losslesslywith the engine and the rest of the suite: a plain scalar written byapplystays plain (setor: FSB), not quoted. The test never ran on the list-field merge because the formatting gate failed first. -
Keep the release version in the root Cargo workspace. Rust crates inherit it and Maturin derives Python package metadata from it.
-
Generate npm versions, local dependency constraints, lockfile snapshots, TypeScript release metadata and README references with one offline, idempotent command.
-
Reject stale generated metadata in CI and release workflows while preserving independent wire-protocol versions and the unpublished DuckDB extension version.
okf-parser 0.48.0
okf-parser 0.48.0
Bundle.sql(), okf-parser sql and the MCP sql tool
Phase 4b of RFC 0024. A bundle now
answers SQL, run by the binary over the tables okf-parser duckdb exports:
concepts, links, reserved and diagnostics and, with a spec template,
one typed table per declared type, all on the search path.
Bundle.sql(query, spec_template=None, limit=None)returns aSqlResult
(columnswith their DuckDB types,rows,truncated,to_dicts()),
computed from the snapshot theBundleholds. Values come back as Python
values by column type:Decimal,date,datetime(UTC-aware for
TIMESTAMP WITH TIME ZONE),bytes, parsedJSON, and nested lists,
structs and maps.okf-parser sql PATH "QUERY"prints the same answer as JSON, and the
read-only MCPsqltool answers it with at most 1000 rows. Graph questions
become queries:WITH RECURSIVEoverlinksanswers reachability.- The query cannot read files, reach the network, load extensions or change
settings, and is exactly one query; anything else raisesSqlError(a
ValueError) and is a command or tool error, reported against the query's
own text.
Bundle.compile_types() and TypedRelations are removed with their ibis
tables: query the typed tables through Bundle.sql(..., spec_template=...).
The GraphQL adapter reads declared values that way too.
apply commits and new documents are written by the native binary
Phase 3c of RFC 0024. Every apply
path computes its diff through DuckDB, the --type/--field/--from/--to
sugar included, so the DuckDB planning stays in Python until phase 4 and
everything after it moves to the binary:
__apply-snapshotgives the planner the concepts and a digest of the
bundle it read;__apply-commitsnapshots again and refuses with
the bundle changed while apply was planning itif anything the plan
depended on changed. Concepts are compared by content, so a document
edited and reverted in between does not count.- Frontmatter is edited losslessly with
yaml-edit: comments, quoting and
layout outside the touched keys are kept. Documents the old ruamel-based
check refused as not round-tripping (flow mappings, anchors, tags) are now
edited instead of skipped. Every edit is parsed back and must equal the
intended mapping, or the document is reported inskipped_paths. - The candidate is fingerprinted, staged, validated and committed on the
native write engine, the same oneedituses. Preview tokens are now
okf-apply-preview-v2-sha256:; a v1 token no longer matches. dumpsandimportrender new documents natively (serde_yaml_ng,
through a batched__render):type,titleanddescriptionfirst,
every other key sorted, and the output parsed back before it is used.
importtherefore orders a row's fields canonically rather than by
column order, and multi-line values use block scalars.
okf_parser.write_support and the ruamel.yaml dependency are gone.
apply runs in the binary, and its contract is simpler
Phase 4c of RFC 0024. okf-parser apply, the MCP apply_preview/apply_write tools and apply_bundle() are
planned and committed by the binary in one request; the Python side is a
pydantic wrapper.
The planner used to accept a narrow grammar (leading ALTER TABLEs and one
UPDATE, on one type) and reconstruct intent from it. Now the final state is
the truth:
- Each concept type is a table. The script is any sequence of statements,
run whole in a sandboxed in-memory DuckDB: no files, network, extensions or
setting changes. Several types can change in one script. - A changed value sets the field, as text.
NULLwhere a value existed, or a
dropped or renamed column, removes the field.SET x = NULLon an explicit
x: nullkeeps it. - Rows, the
__okf_*columns, declared fields (with--spec-template) and
structured (list or mapping) fields are not writable; a script that touches
them is refused with the reason and nothing is written.
Breaking. A retyped column (ALTER COLUMN ... TYPE INTEGER) is no longer
refused: its values are written as text. Declared fields are read-only under
--spec-template; run apply without the template to edit them as text.
apply_preview is now annotated read-only and idempotent. The hidden
__apply-snapshot/__apply-commit commands are replaced by __apply.
import reads its source through the binary too (__read-source), every
value as DuckDB's own VARCHAR cast of it: booleans import as true/false
rather than Python's True/False, and lists as DuckDB spells them.
ibis, pyarrow, pandas and numpy are no longer dependencies.
check, inventory, graph and init run in the native binary
Phase 3b of RFC 0024.
The binary now answers check, inventory, graph and init itself, as
CLI commands and as MCP tools, without starting Python. Their JSON output and
exit status are unchanged. That covers check --classify, --require-spec
and --normative-spec: the OKF010 and OKF011 type-specification rules
and the specification scaffold of init are now in
okf-engine/src/specs.rs, pinned against the Python slug by the shared
conformance/type-spec-slugs.json. Two variants still need DuckDB and are
passed to Python until phase 4: check --relational-schema and
init --infer-schema.
The Python paths these replace are gone: okf_parser.classification, the
type-specification checks in okf_parser.type_specs, the specification
scaffold in okf_parser.spec_scaffold, and the inventory/graph handlers
in the service, CLI and MCP bridge. validate_path and check_bundle now
ask the binary (__check) and add only the DuckDB relational diagnostics.
Behavior changes:
ConceptRecord.frontmatter_jsonfromload_bundleis now the binary's
spelling, the same one TypeScript and the DuckDB extension already
received: compact JSON with keys in UTF-16 order, as the parsed digest is
computed. It was re-serialized in Python withjson.dumps(sort_keys=True)
(spaced, code-point order), so Python alone disagreed with the other
surfaces. The parsed value is unchanged.check --classifyno longer lists Markdown undernode_modules/as
ignored: like.git, it is never a candidate.- A specification template without
{slug}is refused even for a bundle
with no typed concepts, instead of only once a type needed it. - A bundle root that does not exist reports
bundle root is not a directory: <path> (<reason>). initcreates each specification stub exclusively (staged, then
hard-linked into place): a document another writer created after the plan
is left untouched instead of being overwritten.ParsedDocument.frontmatter_jsonuses the same compact, UTF-16-ordered
spelling, so every Python record agrees with the binary.okf-parser --helplists every public command. The binary declares the
whole command line and passes the Python-backed commands' arguments,
--helpincluded, through unparsed.check --relational-schemavalidates relations against the same bundle
snapshot the rest of the report describes.
ingestion discovers files the way a load does
ingest_documents() asked a Python walker which Markdown files a bundle
has, while every command asked the engine. The two disagreed on one thing:
the Python walker descended into node_modules, so ingestion could yield
documents a bundle load never reads. Discovery is now the engine's alone,
over a __discover request, and okf_parser.ingestion.discover() exposes
it.
.okfignore semantics are unchanged; conformance/exclusion.json is now
pinned by a Rust test against the engine's matcher, where the nearest rule
decides and !vendor/knowledge re-includes below an excluded vendor.
A corrupt .okfignore is a ValueError naming the file. Removed Python
internals: okf_parser.discovery and okf_parser.exclusion.
The release workflow's conformance job no longer names the deleted Python
corpus tests (it would have failed at the next tag); it runs the engine's
corpus tests instead, and a test now checks that every test file a
workflow names exists.
duckdb, relational checks and starter schemas run in the binary
Phase 4a of RFC 0024. The binary now
carries DuckDB itself, through the duckdb crate in a new okf-db crate, and
answers these without Python:
okf-parser duckdband the MCPduckdb_exporttool.--helpnow
documents the command. The export runs in one transaction: a refused
export, a typed-table collision included, leaves nothing behind.check --relational-schemaand the MCPchecktool with
relational_schema.OKF020-OKF022are native diagnostic codes.init --infer-schemaand the MCPinit_*tools withinfer_schema,
from the same read of the bundle as the specification scaffold.
okf-parser duckdb now writes knowledge.duckdb by default, not
okf.duckdb. DuckDB names a database after its file, so in okf.duckdb a
query for okf.concepts was ambiguous between the database okf and the
schema okf and failed. Pass the database name to keep the old file.
Messages are clearer. Relational diagnostics name the type, the key and
its value (`Book` isbn = "1" is already used by a.md (constraint `Book_isbn_pkey`)) instead of Python tuple reprs, and a refused export
says to pass --overwrite or choose another --schema.
In the Python API, okf_parser.duckdb.attach_okf is removed: exporting
into a caller's own connection has no counterpart in the binary. Use
okf_parser.service.export_duckdb(path, database), which raises
`...
okf-parser 0.47.0
okf-parser 0.47.0
Bundles load through the native binary and are typed records
Phase 2 of RFC 0024, now revised as
Rust core, Python shell: the native binary is the product, and the Python
package is a thin shell over it, the way ruff and uv ship.
Breaking:
load_bundlealways calls the native binary installed with the package. The
pure-Python ingestion path andload_bundle(engine=...)are removed; a
missing binary raisesNativeBinaryMissingError.Bundle.concepts,.linksand.reservedare tuples ofConceptRecord,
LinkRecordandReservedRecordinstead of ibis tables. There is no
.execute()shim: read the records directly, or query them as SQL through
attach_okf.- Frontmatter with a YAML tag that has no JSON representation (
!!binary,
!!set,!!omap, application tags such as!thing) no longer drops the
concept. The value keeps its written spelling or structure, and a new
OKF102warning names the tags, so the bundle stays conformant. The
Python engine used to reject these documents withOKF001. Writes that still
parse in Python (apply,edit) reject such a document until they move to
the binary.
The binary's answers now carry a protocol version, validated by the shell, and
include the graph summary, so Bundle.graph().summary() no longer computes
anything in Python. Loading a bundle no longer builds ibis tables, which makes
the test suite about 40% faster.
okf-parser 0.45.10
okf-parser 0.45.10
FastMCP 4 runtime
The Python MCP surface now targets FastMCP 4.0.5+ and Pydantic 2.12+.
Python-side MCP model access uses the current snake_case API directly rather
than the temporary camelCase compatibility bridge, and CI disables that bridge
while running the Python suite. Wire-format MCP field names are unchanged.
Spec-declared required fields
okf-parser check now reads a type specification's ## Required fields
Markdown table when --require-spec is enabled. Missing or blank frontmatter
fields are reported as OKF011; --normative-spec promotes them to
conformance errors.
This lets producer specs drive agent fill-until-green workflows without a
domain-specific form CLI.
okf-parser 0.45.9
okf-parser 0.45.9
- add opt-in type-pack discovery through package entry points declared in
pyproject.toml; - make pack installation preview-first, idempotent, collision-safe, and free of pack-specific runtime semantics after materialization;
- add the first
journalismpack withNewsItemand first-class MarkdownBodytypes for IPTC ninjs 3.2; - build journalism starter schemas from authored Markdown examples through the existing
okf-parser init --infer-schemaflow instead of embedding schema templates in Python; - teach starter schema inference to retain consistently structured mapping/list fields as DuckDB
JSONcolumns while continuing to omit mixed scalar/structured fields conservatively; - ship the official ninjs 3.2 and GeoJSON schemas plus machine-readable NewsItem and Body mappings with the installed journalism pack;
- map all 41 ninjs root properties and all 5 properties of a ninjs body object, failing conformance tests if either standard shape drifts without a profile update;
- model
NewsItem.bodiesas ordinary OKF relations to one or moreBodyconcepts, using each Body file's Markdown content as ninjsvalueand its frontmatter for role/content type/count metadata; - retain the
NewsItemMarkdown body as an implicit single-body shorthand only when no explicitbodiesrelations are authored; - resolve multi-body fixtures through the generic OKF
resolve_relationsAPI and validate the projected result against the official ninjs Draft 2020-12 schema; - keep
ninjs.typeas the explicitninjs_typerename and preserve IPTCinfoSourcessemantics rather than treating documentary evidence as information-source parties.
okf-parser 0.45.8
okf-parser 0.45.8
-
schemaexports a type whoseConceptSpecificationalready has a sibling.schema.sqleven when the bundle has not produced its first concrete document of that type yet. -
Discovery reads the authored
concept_typefrom the specification, preserving type identity instead of reverse-engineering it from filesystem slugs. -
JSON Schema, Zod and Pydantic therefore support contract-first workflows such as agent run scaffolds and future event types.
-
Fix the manual release entrypoint: validate an explicit semantic version against
main, create or safely reuse the matching immutablevX.Y.Ztag at the currentmainSHA, and explicitly dispatch the existing release workflow on that tag. This keeps manual publication behind the same build, manifest, PyPI, public smoke-test, and GitHub Release gates as tag-driven releases. -
Reduce cold-load allocation in the Rust semantic engine by consuming loaded concept documents by value and borrowing canonical LF-only source through
Cow<str>instead of always cloning/normalizing full source strings. Preserve byte-for-byte semantic parity and same-host benchmark evidence showing a modest 3–8% end-to-end improvement that grows with bytes per document. -
Add a semantics-preserving fast path for the canonical simple frontmatter order (
type,title,description, then lexical remaining keys), while falling back to the existing YAML parser for complex or out-of-order YAML. Align Python and TypeScript canonical writers and preserve same-host benchmark evidence showing roughly 18–21% lower end-to-end load latency on the measured simple-frontmatter corpus. -
Add
OKFRepresentation,OKFDocument, the structuralSupportsOKF/__okf__protocol,to_okf()conversion, anddumps()canonical rendering. -
Infer the required OKF
typefrom a producer class by default while allowing valid metadata or caller overrides; require an explicit type for bare mappings rather than emittingtype: dict. -
Support JSON-like mappings directly and mapping-shaped Pydantic models through
model_dump(mode="json"); root/scalar Pydantic models opt in explicitly with__okf__()instead of being wrapped in an invented metadata field. -
Resolve an explicit
__okf__hook once and invoke it once; reject non-callable explicit hooks rather than silently falling back to another projection. -
Normalize JSON scalars into OKF's spelling-preserving scalar domain while keeping YAML syntax, canonical physical ordering, and authored-document edit preservation inside
okf-parser. -
Allow
release/vX.Y.Zbranch pushes to enter the existing guarded release dispatcher when the branch SHA is exactly the currentmain; version validation, immutable tag creation/reuse, and delegation topublish.ymlremain unchanged. This gives automation that can create Git refs a fail-closed path to initiate the official release without adding a second publisher. -
Prefer DuckDB FTS/BM25 for lexical search only when the
ftsextension is already installed and locally loadable. -
Disable DuckDB known-extension autoinstall and autoload before extension discovery, never issue
INSTALL, and fall back tobuiltin_lexical_v1on any local FTS failure. -
Build the FTS table and index only in an in-memory DuckDB connection for the current search invocation; no persistent sidecar or canonical Markdown state is changed.
-
Add RFC 0014 and a measured SQLite physical-materialization target derived from canonical relations for exact identity lookup and immediate adjacency. DuckDB remains the relational/transformation baseline; SQLite is private, disposable derived state with parity tests and explicit build/break-even measurements rather than a new public backend semantic.
okf-parser 0.45.6
okf-parser 0.45.6
- Stop publishing the README's OKF frontmatter as page content.
README.mdis atype: Projectconcept and must open with---, which PyPI rendered as a thematic break plus a setext heading, so every project page opened withtype: Project title: okf-parser description: ...above the real title.scripts/pypi_readme.pynow derivesREADME.pypi.md, applying the same correctionchangelog_notes.pyalready applies to GitHub Release bodies. - Rewrite repository-relative links in the derived description to absolute URLs.
docs/architecture.mdresolved on GitHub and pointed nowhere on PyPI. - Declare
MITand ship a rootLICENSE. The three npm packages already declared MIT and shipped the file, while the Python distribution carried no licence at all. - Declare
authors,keywords,classifiersandproject.urls. The project page previously offered no link back to the repository, its issues or its releases. - Verify the derived description in CI, so it cannot drift from
README.md, and add the repository's first.okfignoreto keep it out of the repository's own OKF validation. The repository is validated twice, by the Python CLI and by the TypeScript one, and.okfignoreis read by both; per-command--excludeflags would have to be repeated at every call site and silently miss any that was forgotten.
okf-parser 0.45.5
okf-parser 0.45.5
- Rename all three npm packages to
@franklinbaldo/okf-parser,@franklinbaldo/okf-parser-duckdband@franklinbaldo/okf-parser-native-linux-x64. npm refuses the unscoped nameokf-parserbecause its similarity filter considers it too close to the existingoxc-parser; the refusal happens on upload, so name availability alone never proved the name was publishable. - Keep the PyPI distribution unscoped as
okf-parser. The Python and npm names are now deliberately different, because only npm imposes the similarity constraint. - Update the source contract to expect the scoped names and the tarball file names
npm packderives from them, where the scope is flattened into the leadingfranklinbaldo-segment. - Resolve the optional native package through its scoped name, so a Linux x64 consumer still finds the packaged engine.
okf-parser 0.45.4
okf-parser 0.45.4
-
Propose RFC 0016 with one public
searchsurface that returns compact, provenance-preserving Markdown evidence through explicitly ephemeral body-line locations such aspath.md#B35-B39. -
Freeze deterministic offline lexical/literal Phase 1A semantics, exact filter/profile/mode rules, whole-line compact rendering, ranking/tie-breaking, static RFC 0008 MCP effects, and cross-runtime conformance expectations without requiring embeddings, a persistent sidecar, or network access.
-
Keep local DuckDB FTS/BM25 as a non-blocking Phase 1B optimization and keep vector, hybrid, ANN, embeddings, and persistent materializations behind later profiles/phases.
-
Align retrieval with RFC 0015: structural document IR may select complete Markdown fragments, but raw AST/IR JSON is not default agent context; task success/quality gates benchmarks and actual agent-context tokens remain the primary efficiency metric.
-
Make
import --writestage each destination and rename it into place instead of writing directly to the live Markdown path. A crash during one document write can therefore leave a temporary file but cannot leave a truncated concept at the destination; regression coverage injects a mid-write failure and verifies every committed document remains byte-identical to a clean import. -
Add immediate bidirectional lexical-containment metadata to projected classes, functions, and methods, including definition-line and generated-path identity so same-name redefinitions remain distinct.
-
Add exact
--parentlookup so agents can retrieve the immediate children of a class or callable without reopening source. -
Keep containment explicitly syntax-level: it does not claim runtime ownership, inheritance, reachability, descriptor binding, or call dispatch.
Conservative local import resolution for codebase OKF
Adds a PEP 723 resolve_codebase_okf.py enrichment recipe that maps import targets only when they match a unique projected CodeModule in the generated source tree.
The resolver preserves CodeImport as immutable syntax evidence and emits separate CodeImportResolution concepts with explicit source-tree-resolved or source-tree-partial status, a versioned resolution method, normative type specification, deterministic regeneration and dependency-oriented query support.
One-shot codebase-to-OKF projection
Adds codebase_to_okf.py, a thin PEP 723 orchestrator over the existing Python generator and type finalizer. The default agent workflow now returns only after producer-defined type specs reach their canonical fixed point and normative validation succeeds.
The lower-level generation and finalization recipes remain available for inspection and repair, while --force regeneration through the one-shot path remains byte-for-byte deterministic.
The codebase-to-okf skill now includes standard Python project metadata in the one-shot projection when a PEP 621 [project] table is present in pyproject.toml.
CodeProjectpreserves authored project identity and selected PEP 621 fields.CodeDependencypreserves runtime and optional PEP 508 declarations with parsed navigation fields.- dependency concepts use
manifest-declaredexplicitly and do not claim installation, imports, reachability, or runtime use. - the query recipe adds
--packagefor compact dependency lookup. - the normative finalizer documents both new producer-defined types through canonical
docs/types/{slug}.mdspecs. - projects without a PEP 621
[project]table keep the source-only projection path unchanged.
Self-describing codebase-to-OKF bundles
Adds a finalize_codebase_okf.py PEP 723 recipe that runs the canonical init_bundle service to a fixed point, authors semantics for the generated Code* types plus Spec, and validates the result with normative docs/types/{slug}.md coverage.
The finalizer is deterministic and idempotent: it never invents specification paths, does not rewrite already-complete specs, and a second run leaves the generated bundle byte-for-byte unchanged.
-
Add RFC 0019, keeping source-specific extraction out of
okf-parsercore and defining typed recipe skill directories as the preferred boundary for deterministic source-to-OKF adapters. -
Add
skills/codebase-to-okf/SKILL.mdplus bundled PEP 723 generation and query recipes underscripts/, keeping agent instructions compact while recipe-only dependencies stay outside the package runtime. -
Extract Python modules, classes, functions, methods, imports, signatures, parameters, returns, docstrings, decorators, bases, class fields and explicit
CodeCallsyntax observations into deterministic derived OKF. -
Preserve epistemic boundaries by marking calls and imports
syntactic-unresolved; name-matched call targets are navigation candidates rather than dispatch claims. -
Add compact code-aware lookup by symbol, caller, callee, source and producer-defined type on top of the public generic
load_bundle()API, without adding code semantics to parser core; compact JSON is the default so agents can decide whether a source read is still necessary before paying for it. -
Keep the standalone recipes under the repository's normal Ruff quality rules, with only the explicit
T201exception appropriate to command-line output rather than a blanket recipe lint exemption. -
Test the skill as typed OKF knowledge and both bundled recipes as executable code, including rich metadata, same-name redefinitions, code-aware lookup, conformant output and byte-for-byte deterministic regeneration.
-
Add the first RFC 0010 implementation slice: an experimental Rust loadable DuckDB extension exposing
okf_concepts(root)directly from the sharedokf-engine, emitting DuckDB data chunks without subprocess/whole-bundle JSON transport and keeping the evolving extension toolchain isolated from the stable workspace release graph. -
Extend the RFC 0010 DuckDB extension slice with
okf_links(root),okf_reserved(root)andokf_diagnostics(root)alongsideokf_concepts(root), preserving unresolved links, reserved documents and document-level diagnostics as typed SQL rows while keeping root/configuration failures as table-function errors. -
Implement the first RFC 0009 Git adapter slice: parse and validate subject-first
--- okfcommit-message envelopes, preserve plain commits with an effectivetype: Commit, reject adapter-owned metadata collisions with stable diagnostics, expose anokf-commit-msghook command, and pin Python/TypeScript parity with shared conformance vectors and canonical digests. -
Recognize
type: Projectiondocuments in a bundle (RFC 0018 section 5). A projection names one root concept type and, ininclude, the declared relations to traverse; eachrelationis writtenFromType.fieldand must resolve to aFOREIGN KEYthe bundle'sokf.schema.sqlalready declares. A projection composes what the relational contract states and cannot invent a relationship. -
Resolve each relation's direction from RFC 0007's rule that N:1 is the primitive: a key pointing at the root becomes a list on the root, a key on the root becomes a single value. A self-reference is written from the root's own side and therefore reads as single.
-
Resolve a composite foreign key from any one of its participating columns, so the case that standalone
--refs=embedrefuses is the case a projection answers — the member'sasis the name that was missing. -
Refuse, with errors that name the projection: an unknown root, a name colliding with a concept type, a duplicate projection or member name, a relation that is not
FromType.field, a relation the relational contract does not declare, a relation that connects two types neither of which is the root, and a projection document in a bundle with no relational schema to resolve it against.optional: trueis the only member-level modifier recognized; any other key is an error rather than a silent no-op, so a mistypedascannot pass for composition. -
Keep projections out of the compiled concept types: a bundle with projection documents no longer exports a
Projectionschema whose fields arename,rootandinclude.
Parsing and resolution only. Compiling a resolved projection into a TypeContract and exporting it through --format is the next step of the same RFC.
-
Add
schema --refs=embed, the second half of RFC 0018's export: a declared reference stops being a scalar and becomes the referenced schema itself. It is emitted by name, never re-inlined —$refinto the exporteddefspool for JSON Schema, the siblingconstfor Zod, and the sibling model for Pydantic — so one change to a type reaches every schema that references it in the same regeneration. -
Order Zod declarations by dependency, since a
constcannot be read before it is declared, and close a cycle withz.lazy(() => Schema)on the one edge that ordering cannot satisfy. A self-referencing type is the minimal case and is covered by the corpus. -
Emit Pydantic forward references with postponed annotations and a trailing
model_rebuild(), and only when an embedded reference actually needs them: a bundle without cycles generates exactly the module it generated before. The generated module is executed in the tests, not merely string-matched, so a cyclic model is proven to import and validate. -
Refuse
--refs=embedon a composite foreign key with an error that names the constraint and points at projections: embedding replaces the key's columns with one member, and naming that member from N columns would put a naming convention in the parser.--refs=keycontinues to support composite keys. -
Refuse
--refs=embedwithout--relational-schema, which has nothing to embed. -
Implement the first half of RFC 0018:
schema --relational-schema PATHreads the bundle'sokf.schema.sqland compiles every field participating in a declaredFOREIGN KEYto a reference node instead of to the bare scalar it carries. Compositio...