Skip to content

polish: ProblemDetail in inqcust + codify rulebook (#5, #6)#46

Merged
a2chang merged 1 commit intomainfrom
polish/issues-5-6-error-shape-and-rules
May 1, 2026
Merged

polish: ProblemDetail in inqcust + codify rulebook (#5, #6)#46
a2chang merged 1 commit intomainfrom
polish/issues-5-6-error-shape-and-rules

Conversation

@a2chang
Copy link
Copy Markdown
Contributor

@a2chang a2chang commented May 1, 2026

Final cleanup-pass PR: brings the last legacy error-shape into line with
the rest of the API, deletes the dead CbsaFailureResponse record, and
codifies the seven recurring patterns from the PR #4 INQCUST review into
the rulebook.

Why

  • Issue translator: tighten error-shape consistency and overflow guards #5 audit found InqcustController was the only controller still
    serializing a per-program legacy {failCode, message} record on the
    error path; every other controller (InqacccuController,
    CrecustController, CreaccController, DelcusController,
    DelaccController, UpdcustController, UpdaccController,
    DbcrfunController, XfrfunController) already uses
    ProblemDetail. That made the wire shape of error responses
    inconsistent across the API surface.
  • Issue translator-rules: codify recurring auto-review patterns #6 audit found docs/translation-rules.md was missing several
    patterns that recurred across the auto-review of every program PR
    (defensive null-checks, deterministic randomness, retry off-by-one,
    empty-table → 404, control-baseline preservation, single error wire
    shape, @Valid on request bodies). Codifying these closes the
    feedback loop the issue called out.

What changed

Code

  • InqcustController now returns ProblemDetail for all error paths
    (404 not-found, 503 random-retry-exhausted, 500 abend), matching
    InqacccuController line-for-line. The failCode is exposed as a
    ProblemDetail extension (pd.setProperty("failCode", ...)); the
    human-readable message goes in detail.
  • CbsaFailureResponse deleted — the only caller was the controller
    above. No other production or test code referenced it.

Tests

  • InqcustControllerTest (integration): not-found assertions updated
    from $.message to $.detail (the $.failCode extension is
    unchanged).
  • InqcustControllerWebMvcTest: random-retry-exhausted assertion
    updated from $.message to $.detail. The 500/abend tests already
    asserted on $.detail / $.abendCode and required no change.

Docs

Acceptance — Issue #5

  • Single error wire shape documented (§13 item 1) and used by every
    controller — InqcustController was the last hold-out.
  • CbsaApplication clamps the random-customer upper bound (audited
    and confirmed pre-existing: applicationRandom.nextLong(highest) + 1 cannot overflow for any positive long).
  • Every controller @RequestBody parameter is @Valid-annotated
    (audited).
  • Every public service method null-checks its arguments (audited).
  • Companion rule update tracked in translator-rules: codify recurring auto-review patterns #6 — see below.

Acceptance — Issue #6

Validation

./mvnw -B verify205 tests pass (Testcontainers CockroachDB
24.3, full integration suite + WebMvc slices).

Closes #5
Closes #6

- Refactor InqcustController to return ProblemDetail on all error paths,
  matching every other controller (InqacccuController, CrecustController,
  CreaccController, ...). failCode moves to a ProblemDetail extension;
  the human-readable message moves to \$.detail.
- Update InqcustControllerTest and InqcustControllerWebMvcTest assertions
  from \$.message to \$.detail accordingly.
- Delete CbsaFailureResponse: the legacy error record had only one user
  and is now obsolete.
- Add docs/translation-rules.md \xc2\xa713 codifying the seven recurring
  patterns from PR #4 (single error wire shape, defensive null-checks,
  @Valid on \@RequestBody, deterministic randomness, retry off-by-one,
  control-baseline preservation, empty-table -> 404). Add \xc2\xa714
  translator checklist appendix.

Closes #5
Closes #6
Copy link
Copy Markdown

@augment-app-staging augment-app-staging Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@a2chang a2chang merged commit f40043c into main May 1, 2026
1 check passed
@a2chang a2chang deleted the polish/issues-5-6-error-shape-and-rules branch May 1, 2026 22:20
@a2chang a2chang mentioned this pull request May 1, 2026
22 tasks
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.

translator-rules: codify recurring auto-review patterns translator: tighten error-shape consistency and overflow guards

1 participant