Skip to content

Bounty #427: Add ledger entry navigation#535

Open
Juanpablo24-06 wants to merge 2 commits into
ramimbo:mainfrom
Juanpablo24-06:codex/b427-ledger-entry-nav
Open

Bounty #427: Add ledger entry navigation#535
Juanpablo24-06 wants to merge 2 commits into
ramimbo:mainfrom
Juanpablo24-06:codex/b427-ledger-entry-nav

Conversation

@Juanpablo24-06
Copy link
Copy Markdown

@Juanpablo24-06 Juanpablo24-06 commented May 27, 2026

Summary

Refs #427 / Bounty #427.

This adds focused navigation to public ledger entry detail pages so contributors and maintainers can audit adjacent ledger entries without manually editing URLs.

  • /ledger/{sequence} now shows links back to the full ledger, previous entry, next entry when it exists, and the matching /api/v1/ledger/{sequence} JSON.
  • The change reuses the existing actions styling and does not alter REST API output.
  • Added rendered-page assertions for the ledger detail navigation.

Before / after

Before: ledger detail pages showed hashes and account/proof links, but users had to manually edit the URL to inspect adjacent hash-chain entries or find the JSON endpoint.

After: the detail page exposes direct previous/next ledger navigation and an entry JSON shortcut in the page header area.

No screenshot artifact is attached because this is a small functional navigation addition using the existing action-link style, not a visual layout redesign.

Evidence

  • Distinct from current MRWK bounty: site UX and functional improvements #427 ledger list work: this targets /ledger/{sequence} detail navigation, not /ledger row limits or type filters.
  • Live bounty preflight for internal bounty 73 / issue #427: status=open, awards_remaining=2, available_mrwk=250, and active attempts [].
  • Open PR search for ledger detail navigation / previous-next entry did not show a duplicate.
  • Scope: 3 files, +31/-1.

Validation

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable -q -> 1 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_bounty_pages.py tests/test_public_routes.py tests/test_api_mcp.py::test_ledger_api_rejects_out_of_range_limits -q -> 11 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 414 passed
  • uv run --extra dev ruff check app/public_routes.py tests/test_bounty_pages.py -> passed
  • uv run --extra dev ruff format --check app/public_routes.py tests/test_bounty_pages.py -> 2 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev mypy app/public_routes.py -> success
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python scripts/docs_smoke.py -> docs smoke ok
  • git diff --check -> clean

Safety

No wallet material, private keys, cookies, OAuth state, access tokens, signatures, private data, price/off-ramp claims, liquidity claims, exchange claims, bridge promises, or fabricated payout claims are included.

Summary by CodeRabbit

  • New Features

    • Ledger entry pages now include previous/next navigation with proper boundary handling.
    • Pages include a direct link to the JSON representation of any ledger entry.
  • Tests

    • Expanded tests verify navigation UI, presence of an "All ledger entries" link, boundary behavior for first/latest entries, and the JSON link.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 114b957d-596c-476d-a462-174cd934bf71

📥 Commits

Reviewing files that changed from the base of the PR and between e648ea6 and d59c18b.

📒 Files selected for processing (1)
  • tests/test_bounty_pages.py

📝 Walkthrough

Walkthrough

The PR adds previous/next navigation to ledger entry detail pages. A new ledger_entry_page_context computes previous/next boundaries (previous only when >1, next with 404 fallback), the route passes this expanded context to the template, the template renders conditional navigation links, and tests validate the UI elements.

Changes

Ledger entry page navigation

Layer / File(s) Summary
Context helper and route wiring
app/public_routes.py
ledger_entry_page_context fetches the current entry, sets previous_sequence only when sequence > 1, and attempts to fetch the next entry with 404 caught and next_sequence set to None. The /ledger/{sequence} route calls this helper to supply expanded context to the template.
Template navigation and test validation
app/templates/ledger_entry.html, tests/test_bounty_pages.py
Template renders a navigation block with links to all entries, conditional previous/next entry links, and a JSON endpoint link for the current entry. Tests assert the navigation section, all-entries link, previous/next link presence or omission at boundaries, and the entry JSON link.

Possibly related PRs

  • ramimbo/mergework#394: Refactored the public HTML routing layer in app/public_routes.py that this PR depends on for the /ledger/{sequence} page structure.
  • ramimbo/mergework#366: Refactored ledger_entry_to_dict behavior that determines when /api/v1/ledger/{sequence} returns 404 for missing sequences, which the new context helper relies on for next-entry boundary detection.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title concretely names the changed surface: ledger entry navigation UI addition across public ledger detail pages.
Description check ✅ Passed The description follows the template with complete Summary, Evidence, and Test Evidence sections; all required checkboxes are marked as passing and safety statement is included.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Mergework Public Artifact Hygiene ✅ Passed PR adds ledger entry navigation UI. No investment, price, cash-out, payout, or security claims found. MRWK references are technical data display only.
Bounty Pr Focus ✅ Passed PR modifies 3 stated files: added ledger_entry_page_context() function, template navigation with conditionals, and tests covering boundary cases for genesis/latest entries.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@aiautotool aiautotool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head e648ea6e121dd80d61e60f1664f8f663317416ae as a non-author.

Scope checked:

  • app/public_routes.py now builds a ledger-entry page context from the existing API serializer, keeps the original entry lookup/error behavior, and only probes the next sequence to suppress a dead next link on the current chain tip.
  • app/templates/ledger_entry.html adds bounded navigation back to /ledger, adjacent entry links, and the matching JSON endpoint without changing ledger/API output.
  • tests/test_bounty_pages.py covers the rendered navigation on an actual bounty payment ledger entry, including previous, next, and JSON links.

Validation run locally on this head:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable -q -> 1 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest tests/test_bounty_pages.py tests/test_public_routes.py tests/test_api_mcp.py::test_ledger_api_rejects_out_of_range_limits -q -> 11 passed
  • .venv/bin/python -m ruff check app/public_routes.py tests/test_bounty_pages.py -> passed
  • .venv/bin/python -m ruff format --check app/public_routes.py tests/test_bounty_pages.py -> 2 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m mypy app/public_routes.py -> success
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python scripts/docs_smoke.py -> docs smoke ok
  • git diff --check origin/main...HEAD -> clean

I did not find a blocker. The change is focused on the public ledger detail navigation surface and avoids private data, wallet material, payout guarantees, or off-ramp claims.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d9cbf1d6-bf54-4dbe-93d7-e31daeb3fe8d

📥 Commits

Reviewing files that changed from the base of the PR and between d8532d4 and e648ea6.

📒 Files selected for processing (3)
  • app/public_routes.py
  • app/templates/ledger_entry.html
  • tests/test_bounty_pages.py

Comment thread tests/test_bounty_pages.py
@tinyopsstudio
Copy link
Copy Markdown

Reviewed current head d59c18b79e7a63a1643b16e1bf36b34de383ed88 as a non-author.

Scope checked:

  • app/public_routes.py keeps the existing ledger entry lookup behavior, computes previous/next entry boundaries, and suppresses the next link when the probed next sequence returns 404.
  • app/templates/ledger_entry.html adds focused navigation back to /ledger, adjacent entries, and the matching JSON endpoint without changing public ledger API output.
  • tests/test_bounty_pages.py now covers rendered previous/next/JSON links plus genesis and latest-entry boundary behavior on the current head.

Validation:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable -q -> 1 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_bounty_pages.py tests/test_public_routes.py tests/test_api_mcp.py::test_ledger_api_rejects_out_of_range_limits -q -> 11 passed
  • uv run --extra dev ruff check app/public_routes.py tests/test_bounty_pages.py -> passed
  • uv run --extra dev ruff format --check app/public_routes.py tests/test_bounty_pages.py -> 2 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev mypy app/public_routes.py -> success
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python scripts/docs_smoke.py -> docs smoke ok
  • git diff --check origin/main...HEAD -> clean
  • GitHub checks on the current head are green.

I did not find a blocker. This current-head review is distinct from the earlier review on e648ea6 because it specifically verifies the later boundary-test update on d59c18b.

Copy link
Copy Markdown

@aiautotool aiautotool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current-head follow-up on d59c18b79e7a63a1643b16e1bf36b34de383ed88: the new boundary coverage addresses the gap CodeRabbit raised.

What changed since my prior review:

  • tests/test_bounty_pages.py now verifies the genesis ledger entry does not render a /ledger/0 previous link.
  • The test also verifies the latest ledger entry does not render a dead next-entry link.
  • Implementation scope remains unchanged: public ledger detail navigation only, with REST output unchanged.

Validation rerun locally on current head:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable -q -> 1 passed
  • .venv/bin/python -m ruff check app/public_routes.py tests/test_bounty_pages.py -> passed
  • .venv/bin/python -m ruff format --check app/public_routes.py tests/test_bounty_pages.py -> 2 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m mypy app/public_routes.py -> success
  • git diff --check origin/main...HEAD -> clean

No blocker found on the current head.

Copy link
Copy Markdown

@weilixiong weilixiong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVED — Adds ledger entry navigation (previous/next/all). Clean helper function with proper 404 handling for next sequence. Test covers first entry (no prev), last entry (no next), and middle entry. +41/-1, well-scoped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants