Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/@eep-dev/compliance-cli/src/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,31 @@ describe('@eep-dev/compliance-cli helpers', () => {
runner.fail('t1', 'err');
expect(runner.conformanceLabel('core')).toBe('❌ Not EEP Compliant (1 failure)');
});

it('should NOT award a medal when no checks ran (empty run)', () => {
const runner = createTestRunner();
expect(runner.conformanceLabel('full')).toBe('❌ Not EEP Compliant (no checks verified)');
});

it('should NOT award a medal when every check skipped', () => {
const runner = createTestRunner();
runner.skip('t1', 'n/a');
runner.skip('t2', 'n/a');
expect(runner.conformanceLabel('full')).toBe('❌ Not EEP Compliant (no checks verified)');
});

it('should report "incomplete" when some checks skipped (no failures)', () => {
const runner = createTestRunner();
runner.pass('t1');
runner.skip('t2', 'n/a');
expect(runner.conformanceLabel('full')).toBe('⚠️ Full EEP: incomplete (1 skipped, 1 passed)');
});

it('should fall back to a generic compliant label for an unknown level', () => {
const runner = createTestRunner();
runner.pass('t1');
expect(runner.conformanceLabel('enterprise')).toBe('βœ… Enterprise EEP Compliant');
});
});

// ── validateArgs ────────────────────────────────────────────────
Expand Down
27 changes: 22 additions & 5 deletions packages/@eep-dev/compliance-cli/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,28 @@ export function createTestRunner() {
}

function conformanceLabel(level: string): string {
const { failed } = summary();
if (failed === 0 && level === 'core') return 'πŸ₯‰ Core EEP Compliant';
if (failed === 0 && level === 'standard') return 'πŸ₯ˆ Standard EEP Compliant';
if (failed === 0 && level === 'full') return 'πŸ† Full EEP Compliant';
return `❌ Not EEP Compliant (${failed} failure${failed !== 1 ? 's' : ''})`;
const { passed, failed, skipped } = summary();
const lvl = level.charAt(0).toUpperCase() + level.slice(1);
if (failed > 0) {
return `❌ Not EEP Compliant (${failed} failure${failed !== 1 ? 's' : ''})`;
}
// A conformance claim must be *earned*, not granted by omission. A run
// with zero passing checks, or with skipped checks, has not actually
// verified the level β€” so it must not receive a compliance medal even
// though `failed === 0`. (Otherwise a near-empty or fully-skipped run
// would print "Full EEP Compliant".)
if (passed === 0) {
return '❌ Not EEP Compliant (no checks verified)';
}
if (skipped > 0) {
return `⚠️ ${lvl} EEP: incomplete (${skipped} skipped, ${passed} passed)`;
}
const labels: Record<string, string> = {
core: 'πŸ₯‰ Core EEP Compliant',
standard: 'πŸ₯ˆ Standard EEP Compliant',
full: 'πŸ† Full EEP Compliant',
};
return labels[level] ?? `βœ… ${lvl} EEP Compliant`;
}

return { pass, fail, skip, results, summary, conformanceLabel };
Expand Down
30 changes: 21 additions & 9 deletions packages/eep-compliance-cli-python/eep_compliance_cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,27 @@ def summary(self) -> Dict[str, int]:

def conformance_label(self, level: str) -> str:
s = self.summary()
if s["failed"] == 0:
labels = {
"core": "πŸ₯‰ Core EEP Compliant",
"standard": "πŸ₯ˆ Standard EEP Compliant",
"full": "πŸ† Full EEP Compliant",
}
return labels.get(level, f"βœ… {level.title()} EEP Compliant")
count = s["failed"]
return f"❌ Not EEP Compliant ({count} failure{'s' if count != 1 else ''})"
if s["failed"] > 0:
count = s["failed"]
return f"❌ Not EEP Compliant ({count} failure{'s' if count != 1 else ''})"
# A conformance claim must be *earned*, not granted by omission. A run
# with zero passing checks, or with skipped checks, has not actually
# verified the level β€” so it must not receive a compliance medal even
# though ``failed == 0``. (Otherwise a near-empty or fully-skipped run
# would print "Full EEP Compliant".)
if s["passed"] == 0:
return "❌ Not EEP Compliant (no checks verified)"
if s["skipped"] > 0:
return (
f"⚠️ {level.title()} EEP: incomplete "
f"({s['skipped']} skipped, {s['passed']} passed)"
)
labels = {
"core": "πŸ₯‰ Core EEP Compliant",
"standard": "πŸ₯ˆ Standard EEP Compliant",
"full": "πŸ† Full EEP Compliant",
}
return labels.get(level, f"βœ… {level.title()} EEP Compliant")


def normalize_target(url: str) -> str:
Expand Down
21 changes: 21 additions & 0 deletions packages/eep-compliance-cli-python/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ def test_conformance_label_failure(self):
assert "Not EEP Compliant" in label
assert "1 failure" in label

def test_conformance_label_empty_run_not_compliant(self):
r = TestRunner()
assert r.conformance_label("full") == "❌ Not EEP Compliant (no checks verified)"

def test_conformance_label_all_skipped_not_compliant(self):
r = TestRunner()
r.skip("A", "n/a")
r.skip("B", "n/a")
assert r.conformance_label("full") == "❌ Not EEP Compliant (no checks verified)"

def test_conformance_label_partial_skips_incomplete(self):
r = TestRunner()
r.pass_("A")
r.skip("B", "n/a")
assert r.conformance_label("full") == "⚠️ Full EEP: incomplete (1 skipped, 1 passed)"

def test_conformance_label_unknown_level_fallback(self):
r = TestRunner()
r.pass_("A")
assert r.conformance_label("enterprise") == "βœ… Enterprise EEP Compliant"


class TestNormalizeTarget:
def test_strips_trailing_slash(self):
Expand Down