Conversation
Code Review Consolidation: PR #79 —
|
| Reviewer | Role | Verdict | Blocking Issues |
|---|---|---|---|
| R1 | Peer | Approve with fixes | 0 critical, 4 major, 5 minor |
| R2 | Alignment | Request changes | 0 critical, 1 major, 2 minor |
| R3 | Adversarial | Approve with fixes | 0 critical, 1 major, 4 minor |
Overall: No critical blockers. 3 distinct major issues require fixes before merge.
Should-Fix Issues (Major)
S1. ontos tree --compact tiered rejected by argparse
Flagged by: R2 — single-reviewer finding
Category: Backward compatibility gap
File: ontos/cli.py:604-605
The deprecated tree command registers its own --compact argument with choices=["basic", "rich"]. The PR updated map's choices (line 165) but NOT tree's. Since _cmd_tree delegates to _cmd_map, ontos tree --compact tiered produces an argparse error.
Verified on PR branch — line 605 still reads choices=["basic", "rich"].
Action: Add "tiered" to tree's choices list at line 605.
S2. Test does not verify RICH format for Kernel+Strategy
Flagged by: R1 + R2 — two reviewers agree
Category: Test coverage gap
File: tests/test_map_compact.py:91-93
test_tiered_output_partitions_by_rank creates kern1 with summary="Core kernel" and asserts kern1:kernel:active — but this matches BOTH BASIC and RICH format. If Kernel+Strategy accidentally used CompactMode.BASIC, this test would still pass.
Action: Strengthen assertions:
assert 'kern1:kernel:active:"Core kernel"' in output
assert 'strat1:strategy:active:"Growth plan"' in outputS3. Duplicated _log_sort_key function
Flagged by: R1 + R3 — two reviewers agree
Category: Maintainability hazard
File: ontos/commands/map.py:643-649
The log sort key logic is copy-pasted from _generate_tier1_summary() (lines 222-226). The comment references line numbers that are already stale. If someone updates one copy, they won't know to update the other.
Action: Either:
- (a) Extract a shared module-level
_log_date_sort_key(doc)used by both, OR - (b) At minimum, remove the stale line-number reference and add a cross-reference comment
Note: Option (a) modifies
_generate_tier1_summary()which is technically anti-scope. Team decision needed.
Minor Issues (Consider or Defer)
| # | Issue | Flagged by |
|---|---|---|
| m1 | ### Other always renders even when empty — undermines compactness |
R1 |
| m2 | _generate_compact_output has no guard against CompactMode.TIERED — silently renders BASIC |
R1 + R2 |
| m3 | Missing test for fully empty docs = {} |
R3 |
| m4 | Missing test for all-logs-only scenario | R3 |
| m5 | --obsidian silently ignored in tiered mode (undocumented) |
R3 |
| m6 | No test that --compact bare still defaults to BASIC |
R1 |
| m7 | log_docs typed as bare list not List[DocumentData] |
R1 |
| m8 | Inline import could move to module level | R1 |
| m9 | Help text "prose + ranked compact" is opaque | R1 |
| m10 | Add comment on dispatch ordering fragility | R3 |
Agreement Analysis
Strong agreement (multiple reviewers):
- RICH format test gap (S2): R1 + R2 independently flagged the same test weakness
- Duplicated sort key (S3): R1 + R3 independently flagged the maintenance hazard
- Silent TIERED downgrade (m2): R1 + R2 both noted
Most valuable single-reviewer finding:
treealias choices gap (S1): Only R2 caught this — the most impactful finding. A real user-facing regression.
Resolved disagreement:
- R1 flagged Tier 1 prose + compact log duplication as a concern. R3 analyzed deeply and concluded it's intentional design (prose overview + machine-parseable data are complementary). Resolved: not a problem.
Required Actions (Prioritized)
Must-fix:
- Add
"tiered"totreecommand's--compactchoices (cli.py:605) - Strengthen RICH format test assertions (
tests/test_map_compact.py:91-93) - Address duplicated
_log_sort_key(map.py:643-649) — team decision on approach
Should-fix:
- Add dispatch ordering comment (
map.py:116) - Fix
log_docstype annotation toList[DocumentData](map.py:627)
Consider for follow-up:
- Add test for empty
docs = {} - Add test for all-logs scenario
- Conditionally hide
### Otherwhen empty
- S1: Add 'tiered' to tree command --compact choices (cli.py) - S2: Strengthen RICH format test assertions in test_map_compact.py - S3: Extract shared _log_date_sort_key() at module level (map.py) - S4: Add dispatch ordering comment (map.py) - S5: Fix log_docs type annotation to List[DocumentData] (map.py)
Review Remediation — Antigravity, powered by Gemini 2.5 ProAll 3 must-fix and 2 should-fix issues have been addressed in commit Must-Fix
Should-Fix
Minor Issues (Deferred)m1-m10 are acknowledged as valid. Recommend tracking as follow-up if needed — they don't affect correctness or backward compatibility. Verification
|
Review Follow-up: All Should-Fix Items AddressedConfirmed the fix commit (
No blocking issues remain. Approve to merge. |
|
Verdict Table
Blocking Issues
Should-Fix Issues
Minor Issues
Agreement Analysis
Required Actions
|
…erage - B1: Remove status from latest: line (spec says 'count + latest ID only') - B2: Fix _log_date_sort_key to use tuple (priority, value) — dated entries always sort above undated, preventing lexicographic mixing - B2: Add test_tiered_log_ordering_mixed_dated_undated regression test - S1: Coerce summary to str() in _generate_tier1_summary before escaping - S2: Add 3 parser-level tests (bare --compact, --compact tiered, tree --compact tiered) - S3: Add test_tiered_output_empty_docs (true zero-doc case) - Fix test_tier1_token_capping: add dates to mock logs (needed after sort fix)
Review Round 2 Remediation — Antigravity, powered by Gemini 2.5 ProAll blocking and should-fix issues addressed in commit Blocking Issues
Should-Fix Issues
Cascade Fix
Verification
|
- Restore original nested log_sort_key in _generate_tier1_summary() (pre-PR state) - Revert str() coercion in _generate_tier1_summary() (pre-PR state) - Update _log_date_sort_key docstring: tiered-only usage - Revert test_tier1_token_capping mock data to original (no dates needed) - Fix non-string summary test: use kernel doc (RICH compact path) instead of log doc (which hits pre-existing Tier 1 log table bug)
Review Round 3 Remediation — Antigravity, powered by Gemini 2.5 ProBoth findings addressed in commit Major: Anti-Scope ViolationResolved. Reverted
Also reverted Minor: Mis-targeted TestResolved. Verification
|
…crash fix Spec changes: - Anti-scope now explicitly permits narrowly-scoped Tier 1 helper changes for internal consistency (shared log ordering) and crash prevention (non-string summary coercion) - Fix spec example: latest:<id>:<status> → latest:<id> Code changes in _generate_tier1_summary(): - Replace local log_sort_key with shared _log_date_sort_key() — Tier 1 Recent Activity and tiered Logs footer now use same dated-first ordering - Coerce summary to str() before _escape_markdown_table_cell() — prevents crash on list/dict summaries Tests: - Mixed dated/undated test now verifies BOTH Tier 1 and tiered footer show the same dated log on top, with undated displaced from top-3 - Non-string summary test now uses a log doc, exercises the Tier 1 log table path, and asserts the stringified summary appears in output - test_tier1_token_capping: add dates to mock logs (sort key change)
Final Fix — Antigravity, powered by Gemini 2.5 ProCommit What ChangedSpec (
Tests (strengthened):
Verification
|
…leanup Fixes: - Move project_root fallback (CWD injection) above compact dispatch so TIERED mode sees normalized config. Previously tiered skipped this, breaking Critical Paths (missing) markers for callers without project_root. - Handle summary:null gracefully: renders 'No summary' instead of 'None'. Uses 'or' fallback then isinstance check for non-string coercion. Tests (net +2): - test_tiered_project_root_fallback: calls generate_context_map() with TIERED and no project_root, asserts Critical Paths renders with (missing) - test_tiered_null_summary_renders_fallback: verifies summary:null becomes 'No summary' not literal 'None' in Tier 1 log table Spec cleanup: - Fixed stale log sorting comment (now references shared helper) - Fixed stale cli.py note (now mentions tree alias update) - Anti-scope and latest: format already fixed in prior commit
Review Round 4 Remediation — Antigravity, powered by Gemini 2.5 ProAll findings addressed in commit Major:
|
|
Follow-up fixes are in. I removed the remaining two caveats instead of leaving them as debt:
Verification:
At this point the branch is clean from the issues raised in review. |
Summary
Adds a new
--compact tieredmode toontos mapthat combines Tier 1 prose summary with type-ranked compact lines. Purely additive — no existing behavior changes.Created by: Antigravity, powered by Gemini 2.5 Pro
What Changed
ontos/commands/map.pyCompactModeenum: AddedTIERED = "tiered"valuegenerate_context_map()dispatch: Split the compact early-return soTIEREDbranches to the new function (before the existing BASIC/RICH path)_generate_tiered_compact_output(): Partitions docs by type rank usingTYPE_DEFINITIONS:ontos/cli.py"tiered"to--compactchoicestests/test_map_compact.pytest_tiered_output_partitions_by_rank— verifies all 5 types route to correct sectionstest_tiered_output_empty_partitions— verifies(none)andlogs:0for empty sectionstest_tiered_log_ordering— verifies latest log is the most recent by datetest_tiered_unknown_type_goes_to_other— verifiesDocumentType.REFERENCE(no TYPE_DEFINITIONS entry) goes to Othertest_compact_mode_enum_tiered— enum value assertiontest_generate_context_map_dispatches_tiered— integration test: full dispatch throughgenerate_context_map()How to Test
Verification Results