Skip to content

refactor(skill): drop the validator from the porting skill - #181

Open
userAugustos wants to merge 6 commits into
feat/cli-validatefrom
refactor/skill-drops-validator
Open

userAugustos wants to merge 6 commits into
feat/cli-validatefrom
refactor/skill-drops-validator

Conversation

@userAugustos

Copy link
Copy Markdown

What was done

The porting skill no longer carries its own copy of the platform rules; it runs the CLI's checks instead.

Details

Part of #164 (step 2d). Stacked on #180 (base branch feat/cli-validate); merge #178 and #180 first.

  • Deleted .claude/skills/porting-to-canyonos/validate.py and validation/ (2,134 lines) and the one test that imported them. The skill directory is now SKILL.md, prepare.py and references/.
  • Every constant that code mirrored has its real source in core: image Python and runtime flat modules (stub_generator.IMAGE_PYTHON, AGENT_FLAT_MODULES, WORKFLOW_FLAT_MODULES, RESERVED_CONTEXT_NAMES), base requirements and platform pins (BASE_*_REQUIREMENTS, PLATFORM_PINS), builtin argument types (schema.BUILTIN_TYPE_NAMES). The import→distribution table and the stdlib list only fed the dropped W006 heuristic and go with it.
  • canyonos build takes its verdict from canyonos validate in-process instead of shelling out to a file in the skill directory. Note: verifying a port therefore needs core installed beside the CLI or Docker with the core image — the released binary alone can no longer verify offline (it could not deploy offline either).
  • Skill docs: the validator invocation is now canyonos validate, followed by canyonos test --rebuild as the install-and-import step; V/W-code citations map to their CAR-* names or are removed with the sentence that only existed to cite them; "gap validation" is gone as a term. This is a surgical pass — the stale env-file and streaming sections and the shrink of the skill are step 4 of Refactor: Skill file, diagnosis and testing goal #164.
  • Two guard tests: the skill ships no Python besides prepare.py, and no reference cites a retired V0xx/W0xx code. turbo.json hashes the skill directory into the CLI test task so those guards cannot be skipped by the cache, and drops it from the Python task that no longer reads it.

How to test it

uv sync --frozen --all-packages && bun install --frozen-lockfile
uv run --active --frozen pytest packages/core/tests packages/cli/tests tests -q
uv run --active --frozen ruff check . && uv run --active --frozen ruff format --check .
uv run --active --frozen ty check
bun run test
  • ls .claude/skills/porting-to-canyonos/SKILL.md, prepare.py, references/, nothing else.
  • grep -rn -E "validate\.py|validation/|\b[VW]0[0-9]{2}\b|gap valid" .claude/skills packages scripts → no hits.
  • Drop any .py into the skill directory, or paste V033 back into a reference → packages/cli/tests/test_skill_source.py fails, and turbo run test --dry=json shows the skill files among the CLI test task's hashed inputs.
  • In a project with a .car: canyonos build --agent claude --scope local -y ends with the verdict of canyonos validate; the findings are the same ones canyonos validate prints on its own.

Generated by Claude Code

report_port shelled out to the skill's own validate.py, which made the skill's
file layout part of what `canyonos build` depends on. It now calls run_validate
over .car in this process, so the verdict comes from the same checks
`canyonos validate` runs and the skill directory holds nothing build looks for.
The skill carried its own validator and a `validation/` package beside it, and
every runtime fact those checks needed was a second copy of a constant that
canyonos_core already owns: the image Python version, the flat runtime module
names, the base requirement lists, the builtin yaml type names. A copy that
lives in a skill directory drifts from the runtime silently, because nothing
builds or tests against it.

`canyonos validate` reads those constants from canyonos_core directly, so the
skill no longer needs to carry any of them. `prepare.py` stays: it runs before
there is a `.car` for the CLI to work on.

tests/test_skill_smoke.py was the only test importing the deleted package, and
the skill directory was an input of canyonos-python#test only for its sake, so
both go with it. A new test walks the installed skill source and fails on any
.py but prepare.py, so the mirror cannot creep back.
The reference docs told the agent to run a file the skill no longer ships, and
cited findings by the retired V0xx/W0xx codes. Step 4 now runs `canyonos
validate` and then `canyonos test --rebuild`, and the one cited code that
survived the move -- V033, the package re-export that stubs cannot satisfy --
is named CAR-PACKAGE-REEXPORT.

The other citations named checks that no longer exist, so each is dropped
together with the sentence that only carried it; the runtime facts they hung
off are still true and stay. This is a surgical pass over the invocation and
the codes, not the rewrite of step 4.

A test greps the shipped references for the retired scheme, so a code that no
command reports cannot be cited again.
The tests that keep a validator and the retired finding codes out of the skill
run under canyonos#test, whose inputs were the package defaults alone. A stray
.py or a V0xx citation in the skill directory left that hash untouched, so CI
would replay a cached pass over a skill nobody had checked. The task now hashes
the skill tree alongside the package: 45 inputs became 56, and editing a
reference moves the hash.

The E402 exemption named the porting validator, which is gone. It names what
still needs it: the controller modules, and the tests that load them, put
generated grpc stubs on sys.path before importing them.
`canyonos validate` has no warning severity -- every finding blocks and the
command exits 1 while one remains -- so the handoff had nothing to list under
"validator warnings", and the instruction not to hide them had drifted below
the `canyonos test --rebuild` block where it read as being about that command.

The verdict sentence claimed less than step 4 now does: `canyonos test
--rebuild` deploys locally and serves one prompt, which is exactly what the
report should say, and what the approval question and the checklist already
said.

"Gap validation" and "the gap validator" outlived the heading that defined
them, so each site names `canyonos validate`. The one-sentence "Validation
boundary" section folds into the paragraph it qualified.
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: dd65659c-ab9c-43a5-b95a-2ec206beef31

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@userAugustos
userAugustos marked this pull request as ready for review September 22, 2026 19:42
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