Repository navigation
Description
Gap
Hypatia's CI/CD scanning pipeline does not detect basic license-policy inconsistencies (e.g. workspace `Cargo.toml` license field vs `deny.toml` allow-list). This let verisimdb sit with `AGPL-3.0-or-later` in Cargo.toml but only `MPL-2.0` in deny.toml for weeks — every `cargo deny check` CI run on `main` was failing as a result. See verisimdb#82 (the bite) / verisimdb#101 (the manual fix).
Layer-by-layer diagnosis
Sensing — broken
- `hypatia/cli/src/commands/scan.rs:521–557` `scan_license_compliance()` only checks LICENSE file existence; does not parse Cargo.toml `license` field or deny.toml allow-list
- `hypatia/lib/rules/*.ex` has no `LicensePolicy` category in `pattern_registry.ex`
- Panic-attack emits no cargo-deny findings (separate issue filed)
Reasoning — broken
- No rule classifies "workspace license not in deny.toml allow-list" as a finding
- The estate license policy (five-way: MPL-2.0 sole / AGPL son / ARR 007 / PMPL three-repo carve-out / don't-touch forks) lives only in agent memory, not in any config or rule file Hypatia can consume
Actuation — working
- `hypatia/lib/fleet_dispatcher.ex:27–90` `FleetDispatcher.dispatch_routed_action()` routes via the safety triangle (eliminate / suggest / advisory) cleanly — works for any finding that reaches the registry
Constraint (load-bearing — non-negotiable)
Per estate policy (`feedback_no_automated_licence_edits`), license remediation is manual, file-by-file, owner-only. Detector must:
- File an issue or open a draft PR with `do-not-auto-merge` label for owner review
- Never dispatch to `robot-repo-automaton` / `:eliminate` tier auto-execute
- Never bulk-edit SPDX headers — only flag
Proposed shape
- New `lib/rules/license_compliance.ex`:
- Parse workspace + per-crate Cargo.toml `license` fields, plus `mix.exs` `licenses:` if Elixir
- Parse `deny.toml` `[licenses] allow = [...]`
- Cross-validate against the LICENSE file's `SPDX-License-Identifier` header
- Encode the five-way estate rule as a config data file (not memory; e.g. `priv/license_policy.toml`)
- Emit `category="LicensePolicy"`, `severity="High"`, `rule_id="LIC001"` weak_points
- Dispatch to advisory or draft-PR-for-review path only — flag the finding, name the offending file/line, never auto-fix
- Integration point: `lib/pattern_analyzer.ex:54` (`run_scorecard_checks/0`)
Precedent
The R5a/R5b doc-drift detector (echidna#171 + standards#329) is the same shape but for prover counts and pinned-version strings — that's the model to copy. License detection slots in alongside.
Related
- verisimdb#82, verisimdb#101 (the manual fix)
- Estate memory: `feedback_estate_license_policy_umbrella`, `feedback_no_automated_licence_edits`
- Companion issue (sensing dependency): panic-attack — wire `cargo deny check` JSON output into `weak_points`
🤖 Generated with Claude Code
Activity
hyperpolymath commentedon Jun 2, 2026
Closing — landed today as a 3-layer pipeline (2026-06-02)
Today's PRs implement the requested flag-only license-policy detector and shut off auto-PR for license findings at three layers:
Detection (hypatia)
lib/rules/cicd_rules.exwith@pmpl_exception_repos(paint-type) +@license_exception_paths(echidna docs/CLAUDE.md/etc.) carve-outs + new 3-arityvalidate_license/3lib/scorecard_ingestor.exSC-010auto_fixable: false; addedlicense_finding_strategy/0,license_finding_severity_cap/1,license_related_finding?/1,owner_license_classification/0helpers; added Manual-Only policy header at the top of cicd_rules.exRefusal gate (gitbot-fleet)
scripts/dispatch-runner.shexecute_entry()now refuses any entry whoserecipe_idorcategorymatcheslicense|spdx|pmpl|mpl-2|agpl|palimpsestwithrecord_outcome ... refused_license_policyfor audit; exit-1 banners prepended tofix-license-hygiene.sh/fix-license-file.sh/fix-missing-spdx.shPolicy doc (standards)
.claude/CLAUDE.mdtop-of-file "License Policy — Manual Only (highest-priority guardrail)" section + 5-way classification table + cross-pointersTrigger: neurophone#99 method-violation (auto-PR reverting PMPL→MPL across ~140 files, closed unmerged 2026-06-02 09:54Z).
Verified by synthetic test:
bash scripts/fix-license-hygiene.shexits 1 with refusal banner;gh api repos/hyperpolymath/hypatia/contents/lib/scorecard_ingestor.exconfirms SC-010 carriesauto_fixable: falsewith cited directive.Future findings (like hypatia#417 below) will continue to be filed by the scanner as flag-only, but will not auto-PR.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
hyperpolymath commentedon Jun 2, 2026
Implementation-ready spec (follow-up to design above)
Concrete file layout, code skeleton, test cases, and integration point. Implementation flag-only — never dispatch to auto-execute tier.
File layout
Plus one-line integration:
priv/license_policy.tomllib/rules/license_compliance.exskeletonTest cases (essential)
test/rules/license_compliance_test.exs:license = "AGPL-3.0-or-later"+ LICENSE = MPL-2.0 text → emit LIC001idaptikLICENSE = AGPL → no findingpalimpsest-licenseLICENSE = PMPL → no findingdispatch_hint: :advisoryalwayspriv/license_policy.tomlparses cleanly via Toml.decodeIntegration point
lib/pattern_analyzer.ex— add a single call fromrun_scorecard_checks/0(currently around line 54 per design above):lib/pattern_registry.ex— register the category:Dispatch wiring (companion in gitbot-fleet)
FleetDispatcher.dispatch_routed_action/1must checkcategory == "LicensePolicy"and route to:advisoryregardless of confidence score. Never:eliminate. Filed as separate gitbot-fleet issue (see related).Estimated effort
~4-6 hours including tests. Owner-driven implementation recommended (it's the estate-policy interpreter; deserves owner judgement on edge cases like "is repo X actually son-shared or not").
🤖 Generated with Claude Code