Skip to content

feat: warn on unexpected team field shape in verbose mode (#195)#242

Merged
Zious11 merged 1 commit intodevelopfrom
feat/team-field-shape-warning-195
Apr 21, 2026
Merged

feat: warn on unexpected team field shape in verbose mode (#195)#242
Zious11 merged 1 commit intodevelopfrom
feat/team-field-shape-warning-195

Conversation

@Zious11
Copy link
Copy Markdown
Owner

@Zious11 Zious11 commented Apr 21, 2026

Summary

IssueFields::team_id previously returned None silently when the team field was present but not a JSON string — typically an object like {"id": "..."} delivered by a misconfigured team_field_id pointing at a non-Teams custom field. The Team row on jr issue view silently disappeared with no diagnostic.

This change adds a verbose: bool parameter. On the "present but not a string, not null" path, we emit a once-per-process [verbose] hint to stderr naming the field and the actual value kind (object, array, number, bool). Null and missing remain silent — those are well-formed "no team set" states, not configuration errors.

Design

Follows the existing pattern from src/observability.rs::log_parse_failure_once: inline static AtomicBool gate + eprintln!("[verbose] ..."). The gate ordering (verbose check before swap(true)) preserves the same invariant pinned in observability::tests::verbose_false_leaves_flag_untouched — a non-verbose run doesn't burn the flag.

I considered refactoring log_parse_failure_once into a shared helper, but kept inline duplication: the existing helper encodes a fixed message template ("{site} timestamp failed to parse: {iso}") and generalizing it for a second caller would widen its responsibility and add public API surface for a two-caller pattern. YAGNI.

Changes

  • src/types/jira/issue.rsteam_id(&self, field_id, verbose) signature + value_kind() helper
  • src/cli/issue/list.rs:934 — call site passes client.verbose()
  • 3 existing unit tests updated; 2 new unit tests for object + array value shapes

Scope notes

  • Single production call site (handle_view in list.rs). The signature change is narrow.
  • No logging for null/missing — those are valid "no team set" responses.
  • The warning is gated on --verbose per the project's existing verbose-logging convention (no tracing crate).

Test plan

  • cargo fmt --all -- --check clean
  • cargo clippy --all-targets -- -D warnings clean
  • cargo test — 805 passed, 0 failed (baseline 803 + 2 new)
  • 5 team_id_* unit tests all pass
  • Local code review: no critical/important findings

Closes #195

IssueFields::team_id previously returned None silently when the team
field was present but not a JSON string — typically an object like
{"id": "..."} delivered by a misconfigured team_field_id pointing at a
non-Teams custom field (user picker, select list, etc.). The Team row
on "jr issue view" silently disappeared with no signal to the user.

Add a verbose: bool parameter. On the "present but not a string, not
null" path, emit a once-per-process [verbose] hint to stderr naming
the field and the actual value kind. Null and missing remain silent
(those are well-formed "no team set" states, not config errors).

Matches the existing observability pattern from src/observability.rs:
inline static AtomicBool gate + eprintln!("[verbose] ..."). The gate
ordering (verbose check before swap) is the same invariant pinned by
observability::tests::verbose_false_leaves_flag_untouched.

Adds unit coverage for object and array value shapes; updates existing
tests to pass verbose=false.

Closes #195
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a verbose-only diagnostic when a Jira “team” custom field is present but has an unexpected JSON shape (e.g., object/array) so jr issue view doesn’t silently omit the Team row with no hint.

Changes:

  • Extend IssueFields::team_id to accept verbose: bool and emit a once-per-process [verbose] warning on unexpected non-null, non-string values.
  • Add a small value_kind() helper to describe the observed JSON value kind in the warning.
  • Update the issue view call site to pass client.verbose() and expand unit tests for additional non-string shapes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/types/jira/issue.rs Implements verbose-gated, once-per-process warning for unexpected team field shapes; adds helper and updates tests.
src/cli/issue/list.rs Passes client.verbose() into team_id() so the hint is controlled by --verbose.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Zious11 Zious11 merged commit 86bb924 into develop Apr 21, 2026
11 checks passed
@Zious11 Zious11 deleted the feat/team-field-shape-warning-195 branch April 21, 2026 04:05
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.

chore: log debug warning when team field has unexpected shape (non-string)

2 participants