Skip to content

okf-parser 0.45.4

Choose a tag to compare

@github-actions github-actions released this 02 Sep 14:49
· 47 commits to main since this release
5ee72ad

okf-parser 0.45.4

  • Propose RFC 0016 with one public search surface that returns compact, provenance-preserving Markdown evidence through explicitly ephemeral body-line locations such as path.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 --write stage 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 --parent lookup 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.

  • CodeProject preserves authored project identity and selected PEP 621 fields.
  • CodeDependency preserves runtime and optional PEP 508 declarations with parsed navigation fields.
  • dependency concepts use manifest-declared explicitly and do not claim installation, imports, reachability, or runtime use.
  • the query recipe adds --package for compact dependency lookup.
  • the normative finalizer documents both new producer-defined types through canonical docs/types/{slug}.md specs.
  • 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-parser core and defining typed recipe skill directories as the preferred boundary for deterministic source-to-OKF adapters.

  • Add skills/codebase-to-okf/SKILL.md plus bundled PEP 723 generation and query recipes under scripts/, 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 CodeCall syntax 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 T201 exception 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 shared okf-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) and okf_diagnostics(root) alongside okf_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 --- okf commit-message envelopes, preserve plain commits with an effective type: Commit, reject adapter-owned metadata collisions with stable diagnostics, expose an okf-commit-msg hook command, and pin Python/TypeScript parity with shared conformance vectors and canonical digests.

  • Recognize type: Projection documents in a bundle (RFC 0018 section 5). A projection names one root concept type and, in include, the declared relations to traverse; each relation is written FromType.field and must resolve to a FOREIGN KEY the bundle's okf.schema.sql already 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=embed refuses is the case a projection answers — the member's as is 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: true is the only member-level modifier recognized; any other key is an error rather than a silent no-op, so a mistyped as cannot pass for composition.

  • Keep projections out of the compiled concept types: a bundle with projection documents no longer exports a Projection schema whose fields are name, root and include.

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 — $ref into the exported defs pool for JSON Schema, the sibling const for 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 const cannot be read before it is declared, and close a cycle with z.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=embed on 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=key continues to support composite keys.

  • Refuse --refs=embed without --relational-schema, which has nothing to embed.

  • Implement the first half of RFC 0018: schema --relational-schema PATH reads the bundle's okf.schema.sql and compiles every field participating in a declared FOREIGN KEY to a reference node instead of to the bare scalar it carries. Composition is read from the RFC 0007 contract that already exists — no second place to declare that two types are related, and no naming or folder convention consulted.

  • Publish the reference in each format's own idiom: JSON Schema gains x-okf-references (target type, the constraint's columns in authored order, the referenced columns, and this field's position in the key), Zod gains a .describe("references Type(column)") that leaves z.infer untouched, and Pydantic carries the same payload in Field(json_schema_extra=...). The field keeps the scalar type it always had: under key mode a reference is a type-level fact about the value, not a promise that the consumer holds the referenced document.

  • Support composite foreign keys, which ForeignKeyConstraint has described since RFC 0007: every participating column carries the whole constraint and its own position, so a consumer can reassemble the key without guessing its order.

  • Keep the whole feature opt-in and default-off. Without --relational-schema the exported JSON Schema, Zod and Pydantic are byte-identical to before, which the regression corpus asserts directly. A relative path resolves against the bundle root, matching check --relational-schema.

  • Report, rather than silently skip, a declared foreign-key column that no document of its type carries, and a column claimed by two foreign keys.

  • Add RFC 0018, proposing referential schema export and declared projections: schema learns to read the bundle's okf.schema.sql so a field participating in a declared foreign key compiles to a reference instead of a closed scalar, and an optional type: Projection document composes a root type with declared relations. Both are opt-in; without the new flag and without projection documents the export is unchanged. The RFC also proposes emitting export type X = z.infer<typeof XSchema> from the Zod renderer, which removes the hand-written barrel every TypeScript consumer maintains today.

  • Amend RFC 0018 with the two controls its first draft left open. --refs=embed stays a per-run binary mode rather than a per-field selector: a projection is where per-member composition is declared. Depth moves to projections, where it is answerable — a flat export emits one schema per concept type and every type is a root there, so bounding hops would need two variants of the same contract; a projection has exactly one root, and a member beyond its bound degrades to the reference's key form instead of being dropped.

  • Settle composite foreign keys, which ForeignKeyConstraint has described since RFC 0007 and which the motivating bundle needs on its first reference: --refs=key supports them, projections embed them under the member's as name, and standalone --refs=embed rejects them with a normative error that names the constraint and points at projections. Naming a composed member from N columns would put a naming convention in the parser, which the RFC's first decision forbids.

  • Propose RFC 0015: make the Rust engine the authoritative Markdown parser while keeping raw mdast private behind an OKF-owned, versioned document protocol.

  • Define frozen/closed Pydantic and TypeScript boundary models, source spans over a normalized parser snapshot, exact-source guarding through source_digest, and an internal SourceMap for lossless BOM/newline-aware edits.

  • Keep generated RFC 0001 Pydantic models focused on producer-authored frontmatter, keep Bundle and relational records compact, and make full AST serialization opt-in.

  • Add convergence gates with #182/#183 performance fast paths, #189 structural retrieval, and #104 Git/provenance ownership.

  • Accept RFC 0009 defining Git commit messages as an explicit OKF source-adapter surface: subject-first --- okf envelopes preserve ordinary Git subjects, plain commits remain representable as type: Commit, Git object/provenance identity stays adapter-owned, and parsed_digest covers the effective semantic OKF projection rather than Git transport metadata.

  • Propose RFC 0010 for a loadable DuckDB extension backed by the shared okf-engine: keep OKF semantics DuckDB-independent, expose concepts/links/reserved/diagnostics as typed table functions, retain Python/TypeScript/CLI fallbacks, and treat projection pushdown, bounded chunking, cancellation and Community Extension distribution as explicit implementation gates.

  • Propose RFC 0011 for idempotent, ledger-backed bundle migrations that reuse the RFC 0005 relational write contract and record each migration as an ordinary type: Migration OKF concept. The design also makes atomic creation of new candidate files a shared write primitive so migrations and imports can converge on one staging/validation/conflict path.

Documentation/RFC release; no runtime behavior changes.

  • Propose RFC 0015: make the Rust engine the authoritative Markdown parser while keeping raw mdast private behind an OKF-owned, versioned document protocol.

  • Define frozen/closed Pydantic and TypeScript boundary models, source spans over a normalized parser snapshot, exact-source guarding through source_digest, and an internal SourceMap for lossless BOM/newline-aware edits.

  • Keep generated RFC 0001 Pydantic models focused on producer-authored frontmatter, keep Bundle and relational records compact, and make full AST serialization opt-in.

  • Add convergence gates with #182/#183 performance fast paths, #189 structural retrieval, and #104 Git/provenance ownership.

  • Draft RFC 0017, the fact profile, scoped explicitly to native .fact/
    contexts so plain OKF keeps the identity, reserved filenames and vocabulary
    the base format and RFC 0012 already pin. A markerless directory is read as a
    compatibility view, and retiring index.md/log.md or renaming
    bundle/concept stays profile-local until a migration of its own.

  • Reconcile the profile's stable fact identity with RFC 0012 by defining
    .fact/ as a distinct provider rather than a reinterpretation of the
    filesystem provider. Identity still comes from the provider and never from
    content: the id is authored, not inferred from equal digests.

  • Add examples/minimal, the smallest bundle check accepts as conformant,
    validated by the repository's own check run.

  • Export resolved RFC 0018 Projection contracts through JSON Schema, Zod, and Pydantic while preserving every field of the root contract.

  • Compose each declared member under its authored as name by sibling-schema reference rather than structural re-inline; 1:N members become lists, singular relations remain singular, and composite foreign keys are supported because the projection supplies the composed member name.

  • Keep undeclared references on the root in key form while projection-declared members are embedded by name, so the projection remains the sole control over composition.

  • Treat optional: true as a nullable composed member, matching RFC 0018, and publish JSON Schema $defs whenever projection references require them even under the default flat key mode.

  • Add a specification document for every concept type in use, at the
    docs/types/{slug}.md path --require-spec derives, and run the rule
    normatively in CI. The flag shipped in 0.14.0 and the repository that ships it
    had never run it; a new type without a specification now fails the build
    instead of passing unnoticed.

  • Migrate changelog/0.1.0.md through 0.4.0.md from ChangelogEntry to
    Release. Writing both specifications forced the question the split had been
    hiding: same directory, same fields, same meaning, so the earlier four were
    drift left behind by the rename at 0.5.0 rather than a second type.

  • Move the 0.45.4 release notes into changelog/0.45.4/ as a fragment. The
    version arrived while the flat-file format was being retired, and
    changelog_notes.py assembles a release only from its fragment directory, so
    the notes would not have reached the published body.