Skip to content

[Self-Hosting Phase 5] Port Package Manager and Manifest Parser to Flow #692

Closed

Description

@godofecht

Scope

Port package management and project configuration from src/flow/package.py and src/flow/project_config.py into a native Flow binary.

Deliverables

  • Native TOML parser in Flow for flow.toml.
  • Semver dependency resolution and lockfile generation.
  • Archive extraction and git repository fetcher integration.
  • Replace flow pkg Python implementation.

Activity

  1. added
    self-hosting
    tooling
    P2-medium
    on Aug 21, 2026
  2. godofecht commented on Sep 16, 2026

    @godofecht
    ContributorAuthor

    Progress in current checkout: added compiler/src/toml.flow with bounds-checked section/key lookup, zero-copy value spans, quoted/scalar/boolean/array classification, and malformed-section/unterminated-string detection. Added tests/lang/test_toml_native.flow; native fixture passes, Python-host selftest passes, bootstrap fixed point and bootstrap_from_c verification pass, and self_host_full passes. Full typed manifest model, semver resolution, lockfile, archive/git fetch, and CLI replacement remain open.

  3. godofecht commented on Sep 16, 2026

    @godofecht
    ContributorAuthor

    Native package integration progress: added flowc_toml_package_valid requiring quoted [package].name and .version, and flow init now validates the manifest before writing it. Native TOML fixture covers valid/invalid manifests; isolated native flow init demo succeeds and emits flow.toml/src/main.flow/.gitignore. Python-host selftest, bootstrap fixed point, bootstrap_from_c verification, and self_host_full pass. Dependency semver/lockfile/fetch/extraction and full pkg CLI replacement remain open.

  4. godofecht commented on Sep 16, 2026

    @godofecht
    ContributorAuthor

    Native package progress: added compiler/src/semver.flow with bounds-safe leading X.Y.Z parsing (v-prefix, prerelease/build stripping, missing/non-numeric components matching the Python registry behavior), comparison, and wildcard/latest, caret, >=, ==, and exact requirement matching. Added tests/lang/test_semver_native.flow; it compiles and exits 0 under the regenerated Stage-A compiler. Python-host selftest, bootstrap fixed point, bootstrap_from_c --verify, and self_host_full (three generations) all pass. Dependency graph resolution, lockfiles, fetch/extraction, and full package CLI parity remain open.

  5. godofecht commented on Sep 16, 2026

    @godofecht
    ContributorAuthor

    Additional native package progress: added compiler/src/lockfile.flow, a bounds-checked reader for the stable flow.lock JSON package-entry shape. It returns spans for string fields such as version/source and rejects malformed JSON strings, unclosed objects, and non-string values. Added tests/lang/test_lockfile_native.flow; Python-host and regenerated Stage-A native executions both exit 0. bootstrap_from_c --verify and self_host_full (three generations) pass. Native writing, dependency graph resolution, registry fetch/extraction, and full package command parity remain open.

  6. godofecht commented on Sep 16, 2026

    @godofecht
    ContributorAuthor

    Native package progress continued: compiler/src/lockfile.flow now also provides a bounded deterministic serializer for a single resolved package entry. The native test round-trips rendered version/source fields through the reader. Stage-A native execution exits 0; bootstrap_from_c --verify and self_host_full (three generations) pass after regeneration. The remaining package work is still multi-package lockfile updates, dependency graph resolution, registry/path/git installation, and CLI parity.

  7. godofecht commented on Sep 16, 2026

    @godofecht
    ContributorAuthor

    Native package CLI now has a real flow pkg lock bootstrap command. It validates the existing flow.toml, writes a deterministic empty flow.lock when absent, and refuses overwrite. Added tests/integration/test_native_package_lock.py; the test passes using the Stage-A binary. Fixed-point regeneration, bootstrap_from_c --verify, and self_host_full (three generations) all pass. This is groundwork only: dependency extraction/resolution, multi-package lock updates, registry/path/git installation, and full CLI parity remain.

  8. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Native package layer advanced with cursor-based TOML dependency enumeration: flowc_toml_next_entry iterates arbitrary [dependencies] key/value entries via byte cursors and returns typed value spans, without allocation. Extended tests/lang/test_toml_native.flow; Python host and Stage-A native execution pass. bootstrap_from_c --verify and self_host_full (three generations) pass. This is the parser prerequisite for dependency graph/lock integration; resolution, fetching, extraction, and full CLI parity remain.

  9. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Correctness follow-up: native flow pkg lock now enumerates [dependencies] via flowc_toml_next_entry and fails closed when any unresolved dependency is present, instead of emitting a misleading empty lockfile. Added integration coverage for this refusal; both tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Native dependency resolution/installation remains the next implementation step.

  10. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Native dependency resolution progress: added compiler/src/registry.flow, a bounds-checked JSON index resolver that selects the highest semver-compatible non-yanked-style version entry and returns version/path spans. Added tests/lang/test_registry_native.flow; Python host and regenerated Stage-A native execution pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Wiring this resolver into native pkg lock/install, plus registry fetching and package extraction, remains.

  11. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Native pkg lock is now wired to registry resolution for the common single string dependency case. The driver supplies the bundled registry index; native code reads it, resolves the highest semver-compatible entry, and writes a pinned version/source lock entry. End-to-end mathkit = "^0.1" resolves to 0.1.0; integration tests pass. bootstrap_from_c --verify and self_host_full (three generations) pass. Multi-dependency graphs, path/git specs, package installation/extraction, and remote registry fetching remain.

  12. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Native registry lock entries now preserve resolved source metadata: flowc_lock_render_single emits a resolved.path object, and the mathkit = "^0.1" integration test verifies the pinned version plus registry/packages/mathkit path. Native round-trip, bootstrap_from_c --verify, and self_host_full (three generations) pass.

  13. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Native package installation is now wired for one registry dependency: flow pkg install resolves the semver requirement via the bundled index, copies the resolved package into flow_packages/, and writes a pinned flow.lock with resolved.path. End-to-end integration confirms mathkit/src/lib.flow is installed. Three integration tests pass; bootstrap_from_c --verify and self_host_full (three generations) pass. Multi-package graphs, path/git dependencies, remote indexes, and transitive installs remain.

  14. godofecht commented on Sep 17, 2026

    @godofecht
    ContributorAuthor

    Registry correctness follow-up: native resolver now parses and honors each version entry's yanked boolean, skipping yanked releases before semver comparison. Native regression confirms a yanked highest version is ignored; Stage-A execution, bootstrap_from_c --verify, and self_host_full (three generations) pass.

  15. godofecht commented on Sep 30, 2026

    @godofecht
    ContributorAuthor

    Delivered on main (ee5048d) by #989: compiler/src/pkg.flow, pkg_json.flow (JSON and TOML reader), pkg_main.flow (CLI with the old interface and exit codes), semver.flow. It covers registry index reading (local and FLOW_REGISTRY_URL), semver selection, path, git (tag, rev, branch, subdir) and stdlib installs, a byte-identical flow.lock, and flow add|install|sync|search|info. src/flow/package.py is deleted; project_config.py goes with #1072.

    Check: in a copy of examples/ecosystem/log_demo with flow.lock removed,

    $ flow sync
    All dependencies installed (flow.lock updated)
    $ (flowc bundle build of src/main.flow) && ./a.out
    [DEBUG] visible at DEBUG
    [INFO] still visible
    [ERROR] only errors
    

    Open follow-up: #991 (packages with [native] C sources are not linked by flow run on flowc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-mediumself-hostingtooling

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions