ci: structure validation #3
Conversation
Code reviewSelf-comment, since GitHub doesn't allow formal self-review. What I ran locally on this branch
OverallSolid, KISS-aligned. Pure stdlib in both Go and Python (no Notes below — most are simplifications. Two small correctness regressions worth fixing. Must fix1. Before this PR (main): REPO_ROOT = Path(__file__).parent.parentAfter: REPO_ROOT = Path.cwd().resolve()
if not (REPO_ROOT / TOOLING_CONFIG_FILE).is_file():
print('Missing plugin-tooling.json in current directory. ...', file=sys.stderr)
sys.exit(1)Repro: CI is fine because the workflow runs from the repo root, but 2. Dead from plugin_tooling_config import ( # line 22 — runs first
TOOLING_CONFIG_FILE, ...
)
...
SCRIPTS_DIR = REPO_ROOT / 'scripts' # line 38 — runs *after* the import
if str(SCRIPTS_DIR) not in sys.path:
sys.path.insert(0, str(SCRIPTS_DIR))The top-level Should consider — KISS / simplification3. func sortedKeys[K ~string, V any](m map[K]V) []string { ... }No caller uses a custom string type. The func sortedKeys[V any](m map[string]V) []string { ... }4. Redundant func resolvePluginRelative(pluginDir, pointer string) (string, bool) {
if filepath.IsAbs(pointer) {
return "", false
}
target := filepath.Join(pluginDir, filepath.FromSlash(pointer))
rel, err := filepath.Rel(pluginDir, target)
if err != nil || rel == "." || rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator)) {
return "", false
}
return target, true
}5. names := sortedKeys(versions)
if len(names) < 2 { return }
ref := versions[names[0]]
for _, n := range names[1:] {
if versions[n] != ref { /* report and return */ }
}6. return name == "usage" ||
strings.HasSuffix(name, "-usage") ||
strings.HasSuffix(name, "_usage")7. def plugin_dir_for_source(self, repo_root: Path, src: Path) -> Path:
relative = src.relative_to(self.plugin_root_path(repo_root))
return self.plugin_root_path(repo_root) / relative.parts[0]The glob fixes the layout to Test coverage gaps
Concrete cases I'd add:
Minor / style nits8. Doc drift in
That's only half the truth. Adding a platform also needs:
Either document the Go side, or drive the platform list from the config (more work; YAGNI for now). 9. CI: pin Go via 10. 11. Nothing here blocks the PR — must-fixes are quick. Nice baseline for future structural checks. |
No description provided.