8000 Docs: documentation code is never executed, and two published examples do not run · Issue #52 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

Docs: documentation code is never executed, and two published examples do not run #52

Closed

Description

@Lillecarl

Evidence

tests/nanopynix/test_examples.py:19 runs docs/examples/*_example.py only.
No test executes a fenced code block in a Markdown file.

Two published snippets are wrong:

Scope

Extract every runnable Markdown block into docs/examples/, and include it by
literal reference. That reuses the mechanism which already exists and which
already has a test.

Correct the two broken snippets.

Depends on

#35. The settings example becomes correct only after that item lands.

Acceptance criteria

The suite fails when a published snippet stops working.

Finding F5 of CODE_IMPROVEMENT_PLAN.md.

Activity

  1. Lillecarl commented on Aug 1, 2026

    @Lillecarl
    ContributorAuthor

    Scope boundary, recorded after measuring the documentation surface for #44.

    This issue is about the code in the documentation: its criterion is "The
    suite fails when a pub 8000 lished snippet stops working". A separate finding is
    about coverage of the documentation: 46 names in nanopynix.__all__ have
    no page, and 22 of those are the nanopynix_bindings surface.

    Those are not the same job, and they are not merged:

    This issue stays as it is. It waited on #35, which is now closed, so it is a
    harness plus the two broken snippets. Folding the coverage work in would hold
    that behind a reference-writing task and would give this issue two acceptance
    criteria that cannot be met together.

  2. Lillecarl commented on Aug 2, 2026

    @Lillecarl
    ContributorAuthor

    Done, with a different mechanism and a different count

    Three snippets were broken, not two, and one of them in four ways

    README.md is worse than the issue says. Measured against the live API:

    what it published why it fails
    Session(config={"max-jobs": "4"}) no engine has ever had a config parameter
    async with at module level SyntaxError; the block is not valid Python
    store.get_store_dir(GetStoreDirRequest()) no such method. It is await store.store_dir()
    await root.force(), then attrs["name"] AsyncValue has neither force nor __getitem__

    A third broken snippet, not listed here: docs/nanopynix/index.md:19
    called await hello.force_json(). No such method; it is to_python(). That
    was the quick start on the documentation index.

    And one listed snippet is no longer broken.
    NixSettings(max_jobs=4, trusted=True, pure_eval=True) constructs fine now --
    #35 fixed it, and this issue's dependency on #35 is satisfied rather than
    outstanding.

    The published quick start taught a shape that crashes

    Writing the index snippet as a real program surfaced this. asyncio.run(main())
    at module level raises:

    RuntimeError: An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.
    

    The rpc engine starts its worker with the multiprocessing forkserver, and
    multiprocessing refuses to start a child while the main module is still
    importing. So if __name__ == "__main__": is required here, not a
    convention -- and the index published the form without it. Both the example
    and the page now say why.

    Mechanism: a mirror, not literalinclude

    The issue suggests including each block by literal reference. That cannot
    cover README.md, which is one of the two snippets this issue is about:
    GitHub renders the README and does not process Sphinx directives.

    So every runnable block is a view of a region of an example that runs:

    • an example marks a region with # region: <name> / # endregion: <name>;
    • a page puts <!-- example: <file>#<region> --> directly above the fence --
      invisible in both renderers;
    • tests/meta/test_doc_snippets.py asserts the block equals that region,
      dedented, and tests/nanopynix/test_examples.py runs the example.

    Both halves are needed. Execution alone lets a page drift from the code it
    claims to show. Equality alone proves two copies of something broken agree.

    Dedenting is what keeps the pages readable: a four-line snippet can come from
    the middle of an async def main() instead of being padded into a whole
    program.

    Coverage

    Seven Python blocks exist across the README and docs/. Five now mirror a
    running example: the README quick start, the index quick start, both
    settings.md blocks, and the stores.md model block. Two are in a ledger with
    a reason -- namespace.md needs an unprivileged user namespace and writes to
    the host daemon store, and store.md is two lines that need a built tofu
    binary in a relocated store.

    The ledger asserts both directions, so an entry whose block is gone fails and
    gets deleted.

    New files

    docs/examples/quickstart_example.py, hello_example.py, stores_example.py,
    plus two regions in the existing settings_example.py.

    Red-before-green: changing one word of the README block fails
    test_every_published_snippet_matches_the_code_that_runs.

  3. added
    source: nanopynix
    on Oct 19, 2026
  4. added theissue type on Oct 19, 2026
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

    source: nanopynix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0