Skip to content

fix(cli): repair a merge splice that left commands.py unparseable - #100

Closed
Kartikey1306 wants to merge 1 commit into
embeddedos-org:masterfrom
Kartikey1306:fix/board-config-merge-splice
Closed

fix(cli): repair a merge splice that left commands.py unparseable#100
Kartikey1306 wants to merge 1 commit into
embeddedos-org:masterfrom
Kartikey1306:fix/board-config-merge-splice

Conversation

@Kartikey1306

Copy link
Copy Markdown
Contributor

master does not parse

ebuild cannot start, and pytest collects nothing:

$ python -c "import ebuild.cli.commands"
  File "ebuild/cli/commands.py", line 855
    """ebuild — A unified embedded OS build system."""
              ^
SyntaxError: invalid character '—' (U+2014)

All 9 Test jobs on master fail this way, on every OS and Python version.

Line 855 is not the problem

It is an ordinary docstring. The damage is 300 lines earlier — _board_config() lost its body and its closing quotes to a copy of _resolve_backend_request()'s last line, spliced in during a conflict resolution:

def _board_config() -> Optional[Dict[str, Any]]:
    """The project's own board description, if it ships one.

    return resolved_backend, backend_config


def _configure_ninja_backend(

Its docstring never closes, so from there on every triple-quote toggles the wrong way, and the first em-dash the tokenizer reaches outside a string gets reported — at line 855, inside a function that is perfectly fine.

_resolve_backend_request still has its own return at line 364, so that line is a stray duplicate, not a move.

Introduced by 6d2c149, a "Merge branch 'master' into …" commit, and carried to master through a9e3c60 and 562d28d.

The same resolution dropped #89 entirely

_NO_TESTS_MARKERS, _TEST_COUNT_PATTERNS, _ran_no_tests, _parse_test_counts and both call sites are gone — the tests were left behind. test is back to:

    log.success("All tests passed.")

reached unconditionally on a zero exit. ctest exits 0 when it finds nothing to run, so a project with enable_testing() and no add_test() reports a pass having executed nothing — exactly what #89 fixed.

This PR

Restores both from f5209ac, the last commit where this file parsed. Verbatim; no new design.

$ python -c "from ebuild.cli.commands import _board_config, _ran_no_tests, _parse_test_counts; \
             print(_board_config(), _ran_no_tests('ctest','No tests were found!!!'), \
                   _parse_test_counts('ctest','96% tests passed, 1 tests failed out of 28'))"
None True (27, 1)
before after
import ebuild.cli.commands SyntaxError ok
passing 0 (nothing runs) 474

Still failing: 51

Pre-existing, and invisible until the module parses again. Not one cause — the largest groups:

  • 9NameError: name '_ninja_path' is not defined. The function was renamed escape_ninja_path in ninja_backend.py and the tests were not updated (same shape as the version_keyversion_sort_key rename in fix(packages): a patch respin no longer sorts below the release it supersedes #98). Happy to take this in a follow-up.
  • 10dispatcher.configure(...) ran, but build.yaml declares targets — the declared-targets precedence guard is not in effect.
  • 8--build-dir resolution.
  • 7test_dispatch.
  • the rest spread across doctor, package, footprint and config validation.

This is the fourth time implementation hunks have been lost to conflict resolution here (#64, #72, #77, #89, and now this). The merges are not gated: f5209ac and 562d28d both reached master with no CI run on the merge commit. Requiring CI — ebuild on master before merge would have caught every one of them.

🤖 Generated with Claude Code

master does not parse. `ebuild` cannot start and pytest collects nothing:

    $ python -c "import ebuild.cli.commands"
    File "ebuild/cli/commands.py", line 855
        """ebuild — A unified embedded OS build system."""
                  ^
    SyntaxError: invalid character '—' (U+2014)

Line 855 is a normal docstring. The real damage is 300 lines earlier:
_board_config() lost its body and its closing quotes to a copy of
_resolve_backend_request()'s last line, spliced in during a conflict
resolution:

    def _board_config() -> Optional[Dict[str, Any]]:
        """The project's own board description, if it ships one.

        return resolved_backend, backend_config

Its docstring never closes, so every subsequent triple-quote toggles the
wrong way and the first em-dash the tokenizer reaches outside a string is
reported instead -- at line 855, in a function that is fine.
_resolve_backend_request itself still has its own return, so the line is
a duplicate rather than a move.

Restores the body from f5209ac, the last commit where this file parsed.

The same resolution also dropped the whole of embeddedos-org#89 -- _NO_TESTS_MARKERS,
_TEST_COUNT_PATTERNS, _ran_no_tests, _parse_test_counts and both call
sites -- leaving its tests behind and `test` back on:

    log.success("All tests passed.")

reached unconditionally on a zero exit. ctest exits 0 when it finds
nothing to run, so a project with enable_testing() and no add_test()
reported a pass having executed nothing. Restored from the same commit.

Collection goes from "cannot import" to 474 passing. The 51 that fail are
pre-existing and were invisible while the module would not parse; they
are not all one cause and are listed in the PR description.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Kartikey1306

Copy link
Copy Markdown
Contributor Author

Merge-order note: this restores collection, but master stays red if it lands alone — the 51 failures it exposes were always there, just unreachable behind the SyntaxError. #101 and #102 clear them. Green at the tip: #102. Merging 100 → 101 → 102 in order is fine, master is just red in between.

@Kartikey1306

Copy link
Copy Markdown
Contributor Author

Closing in favour of #102, which contains this commit (662aecf) verbatim as the first of its five.

This PR cannot go green on its own, and that is a property of the stack rather than of the change. master arrives with a test suite that does not collect at all, and repairing the splice in commands.py only gets it as far as running:

pytest
master 562d28d 11 errors during collection — suite never runs
this PR 662aecf 51 failed, 474 passed
#101 fcc97e6 27 failed, 498 passed
#102 51a4566 525 passed, 0 failed

Each step is a strict improvement, but branch protection needs a green head, and the remaining failures are only cleared by the last three commits. Giving this PR enough to pass would just reproduce #102.

Nothing here is lost — #102 carries this commit unchanged, and is green on all 9 Test jobs (ubuntu/macos/windows × 3.10/3.11/3.12), Build Python Package, CodeQL, and all 11 EoSim boards.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant