Commit 4ad8ba9
authored
refactor(diagnostic): move diagnostic UX out of core nono crate (#1155)
Relocate DiagnosticFormatter and all user-facing diagnostic rendering from
the core 'nono' crate to 'nono-cli', restoring the library/CLI boundary
documented in AGENTS.md: the library stays a pure sandbox primitive and the
CLI owns policy, footer text, flag suggestions, and stderr heuristics.
Core 'nono::diagnostic' now exposes only structured, policy-free facts:
DenialReason, DenialRecord, IpcDenialRecord, SandboxViolation, and the
seatbelt_operation_to_access mapping. Everything else (DiagnosticFormatter,
PolicyExplanation, ErrorObservation, analyze_error_output, and the footer
rendering with 'nono why'/'nono learn' guidance and CLI flag suggestions)
moves to crates/nono-cli/src/diagnostic/.
The bulk of this change is a near-verbatim move; the only behavioral edits:
- Remove dead code surfaced by the move (previously masked by pub visibility
in the library): PolicyExplanation.details/policy_source fields (written but
never read), and the unused DiagnosticFormatter methods
with_blocked_protected_file, detect_protected_file_in_error, and
format_summary.
- Deduplicate suggested_flag_parts: the formatter now uses the single
query_ext implementation, which guards against suggesting access to the
root filesystem. This fixes an edge case where a nonexistent path directly
under '/' could yield a '--allow /' suggestion.
No change to diagnostic footer output in normal cases; the moved unit tests
are the rendering contract and pass unchanged.
Signed-off-by: Aleksy Siek <aleksy@alwaysfurther.ai>1 parent e8293b3 commit 4ad8ba9
8 files changed
Lines changed: 3910 additions & 3944 deletions
File tree
- crates
- nono-cli/src
- diagnostic
- nono/src
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
| 77 | + | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
1281 | 1281 | | |
1282 | 1282 | | |
1283 | 1283 | | |
1284 | | - | |
| 1284 | + | |
1285 | 1285 | | |
1286 | 1286 | | |
1287 | 1287 | | |
| |||
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | | - | |
| 1374 | + | |
1375 | 1375 | | |
1376 | 1376 | | |
1377 | 1377 | | |
| |||
1421 | 1421 | | |
1422 | 1422 | | |
1423 | 1423 | | |
1424 | | - | |
| 1424 | + | |
| 1425 | + | |
1425 | 1426 | | |
1426 | | - | |
1427 | 1427 | | |
1428 | 1428 | | |
1429 | 1429 | | |
| |||
1475 | 1475 | | |
1476 | 1476 | | |
1477 | 1477 | | |
1478 | | - | |
1479 | | - | |
1480 | 1478 | | |
1481 | 1479 | | |
1482 | 1480 | | |
1483 | 1481 | | |
1484 | 1482 | | |
1485 | 1483 | | |
1486 | 1484 | | |
1487 | | - | |
1488 | | - | |
1489 | 1485 | | |
1490 | 1486 | | |
1491 | 1487 | | |
| |||
1535 | 1531 | | |
1536 | 1532 | | |
1537 | 1533 | | |
1538 | | - | |
| 1534 | + | |
1539 | 1535 | | |
1540 | 1536 | | |
1541 | 1537 | | |
| |||
1566 | 1562 | | |
1567 | 1563 | | |
1568 | 1564 | | |
1569 | | - | |
1570 | | - | |
| 1565 | + | |
| 1566 | + | |
1571 | 1567 | | |
1572 | 1568 | | |
1573 | 1569 | | |
| |||
3723 | 3719 | | |
3724 | 3720 | | |
3725 | 3721 | | |
3726 | | - | |
| 3722 | + | |
3727 | 3723 | | |
3728 | 3724 | | |
3729 | 3725 | | |
| |||
3745 | 3741 | | |
3746 | 3742 | | |
3747 | 3743 | | |
3748 | | - | |
| 3744 | + | |
3749 | 3745 | | |
3750 | 3746 | | |
3751 | 3747 | | |
3752 | | - | |
3753 | | - | |
3754 | 3748 | | |
3755 | 3749 | | |
3756 | | - | |
| 3750 | + | |
3757 | 3751 | | |
3758 | 3752 | | |
3759 | 3753 | | |
| |||
3767 | 3761 | | |
3768 | 3762 | | |
3769 | 3763 | | |
3770 | | - | |
| 3764 | + | |
3771 | 3765 | | |
3772 | 3766 | | |
3773 | 3767 | | |
| |||
3785 | 3779 | | |
3786 | 3780 | | |
3787 | 3781 | | |
3788 | | - | |
| 3782 | + | |
3789 | 3783 | | |
3790 | 3784 | | |
3791 | 3785 | | |
| |||
3833 | 3827 | | |
3834 | 3828 | | |
3835 | 3829 | | |
3836 | | - | |
| 3830 | + | |
3837 | 3831 | | |
3838 | 3832 | | |
3839 | 3833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
1675 | 1675 | | |
1676 | 1676 | | |
1677 | 1677 | | |
1678 | | - | |
1679 | | - | |
1680 | 1678 | | |
1681 | 1679 | | |
1682 | 1680 | | |
| |||
1710 | 1708 | | |
1711 | 1709 | | |
1712 | 1710 | | |
1713 | | - | |
1714 | | - | |
1715 | 1711 | | |
1716 | 1712 | | |
1717 | 1713 | | |
1718 | 1714 | | |
1719 | 1715 | | |
1720 | 1716 | | |
1721 | | - | |
1722 | | - | |
1723 | 1717 | | |
1724 | 1718 | | |
1725 | 1719 | | |
| |||
1754 | 1748 | | |
1755 | 1749 | | |
1756 | 1750 | | |
1757 | | - | |
1758 | | - | |
1759 | 1751 | | |
1760 | 1752 | | |
1761 | 1753 | | |
1762 | 1754 | | |
1763 | 1755 | | |
1764 | 1756 | | |
1765 | | - | |
1766 | | - | |
1767 | 1757 | | |
1768 | 1758 | | |
1769 | 1759 | | |
| |||
1794 | 1784 | | |
1795 | 1785 | | |
1796 | 1786 | | |
1797 | | - | |
1798 | | - | |
1799 | 1787 | | |
1800 | 1788 | | |
1801 | 1789 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
563 | | - | |
| 563 | + | |
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
| |||
0 commit comments