Skip to content

Add support for passList, private output#13

Open
Chris-dash-T4 wants to merge 5 commits intoanthonywu:mainfrom
Chris-dash-T4:clarity-updates
Open

Add support for passList, private output#13
Chris-dash-T4 wants to merge 5 commits intoanthonywu:mainfrom
Chris-dash-T4:clarity-updates

Conversation

@Chris-dash-T4
Copy link
Copy Markdown

Changes

High-level summary

  • (fix) Fixed log-level not being set
  • (feat) Added support for parsing passList for non-BART transit passes
  • (feat) Optionally hide sensitive information from summary output

Code changes (AI summary)

1. CLI/workflow change

  • main.py
    • Added a new --show-private flag to the summary command.
    • This flag is forwarded into clippercard.porcelain.tabular_output(...).
    • Removed the module-level logging.basicConfig(level=logging.INFO) call (overriding later debug flag).

2. Dashboard parsing contract

  • parser.py
    • Extended parse_dashboard_cards(...) to parse a new passList structure from dashboard JSON/HTML.
    • Each pass in passList now becomes a CardProduct with:
      • name="Pass"
      • value containing the pass description and expiration date
    • Commented/decorated the old parse_cards(...) helper as deprecated, noting it is legacy and only used in tests.

3. Output formatting / private-data contract

  • porcelain.py
    • tabular_output(...) now accepts show_private=False by default.
    • When show_private=False, it redacts:
      • profile fields like name, email, mailing_address, phone
      • card serial numbers, preserving only the last 4 digits
    • Added _redact_private_info(...) helper for these rules.
    • show_private=True preserves the full values (previous default).

4. Test coverage updates

  • test_dashboard_parser.py
    • Added a regression test for parsing passList into card products.
    • Verifies:
      • a card can contain a pass product
      • the pass description appears
      • the expiration date is rendered as Expires YYYY-MM-DD
  • test_porcelain.py
    • Updated an existing table-rendering test to call tabular_output(..., show_private=True).
    • Added a new test verifying that private fields are redacted when show_private=False.

5. Fixture/data structure change

  • dashboard.html
    • Updated the dashboard fixture so one card includes a non-empty passList.
    • This supports the new parser behavior and test expectations.

Overall effect

  • The branch changes the parser contract for dashboard cards to include pass details from passList.
  • It augments the presentation workflow so confidential profile/card fields can be redacted by default, with an explicit opt-in to show private values.
  • Tests and fixtures were updated to verify both the new pass parsing behavior and the new redaction workflow.

please lmk if there are any changes or suggestions, i hope this will be a helpful addition!

@anthonywu
Copy link
Copy Markdown
Owner

oh hi there! the rare contribution I am just seeing this, promsie will take a look soon

@anthonywu anthonywu self-requested a review April 29, 2026 03:54
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.

2 participants