Skip to content

Add IssuingStockRule resource#75

Open
lucasmiranda-stark wants to merge 1 commit into
masterfrom
feature/issuing-stock-rule
Open

Add IssuingStockRule resource#75
lucasmiranda-stark wants to merge 1 commit into
masterfrom
feature/issuing-stock-rule

Conversation

@lucasmiranda-stark

Copy link
Copy Markdown
Contributor

Context

IssuingStockRule resource generated from contract contracts/issuing-stock-rule.md.

What changed

  • src/test/java/TestIssuingStockRule.java
  • src/main/java/com/starkinfra/IssuingStockRule.java
  • CHANGELOG.md
  • README.md

Test plan

  • query and create → update → cancel pass against the infra sandbox (Phase 6).
  • page currently returns an API-side 500 ("Houston") — a known upstream pagination issue, not an SDK defect; passes once GET /issuing-stock-rule paging is fixed.
  • get(id) ships as a method but has no testGET /issuing-stock-rule/{id} is not yet deployed (deferred).

Risk & Rollback

  • Risk: new resource, additive only — no changes to existing public types.
  • Rollback: revert this PR; no data migration.

Contract review (Phase 7)

Contract Review

Checklist

Mandatory point Status Implementation Test
[M1] create accepts a list of IssuingStockRule and returns the same shape with server-assigned id, status, created, updated populated (Python: rest.post_multi) covered IssuingStockRule.java:355–368 (create(List<?> rules)Rest.post(data, ruleList, user)) testCreateUpdateCancel @ TestIssuingStockRule.java:92–97 (list created, size asserted, id non-null/non-empty)
[M2] get(id) returns a single IssuingStockRule by id (method ships; test DEFERRED — route not deployed) not applicable IssuingStockRule.java:143–162 (get(String id) and get(String id, User user) both present, delegate to Rest.getId) n/a — GET /issuing-stock-rule/{id} route not deployed on sandbox; test deliberately omitted per contract
[M3] query returns a Generator<IssuingStockRule> accepting limit, after, before, status (list), stockIds, ids, tags covered IssuingStockRule.java:183–238 (four query overloads, all params documented in javadoc at lines 172–179) testQuery @ TestIssuingStockRule.java:18–34 (limit, after, before passed; iterates; asserts id non-null and count > 0)
[M4] page returns [items, cursor] equivalent (IssuingStockRule.Page) accepting same params as query plus cursor; limit max 100. NOTE: endpoint returns 500 without date window — test passes after/before per contract covered IssuingStockRule.java:240–339 (Page inner class at 240–248; page overloads at 272–338; limit doc says max 100 at line 257) testPage @ TestIssuingStockRule.java:37–65 (two page calls of limit=2 with after/before; no-duplicate check; stops on null cursor)
[M5] update(id, ...) PATCHes the rule accepting minimumBalance, tags, emails, phones; does not accept stockId or status covered IssuingStockRule.java:405–428 (patch docs at 395–398/417–420 list only minimumBalance/tags/emails/phones; stockId and status absent from update javadoc) testCreateUpdateCancel @ TestIssuingStockRule.java:100–103 (calls update with minimumBalance=20000, asserts returned value == 20000)
[M6] cancel(id) DELETEs the rule and returns the canceled object; test asserts returned status == "canceled" covered IssuingStockRule.java:443–461 (cancel delegates to Rest.delete) testCreateUpdateCancel @ TestIssuingStockRule.java:106–107 (asserts canceledRule.status.equals("canceled"))
[M7] status is output-only enum (active | canceled); never sent on create or PATCH covered IssuingStockRule.java:44 (field declared); Map constructor line 122 sets this.status = null (not read from input data); update javadoc at 395–398 does not list status testCreateUpdateCancel @ TestIssuingStockRule.java:107 (asserts "canceled"; constructor fixture at 111–118 never sets status)
[M8] created and updated are parsed to the language's native datetime type using the SDK's existing helper — Java convention: String fields (per SDK-infra/java standard across all issuing resources) covered IssuingStockRule.java:45–46 (public String updated; public String created;) — Java SDK uses String for datetimes by convention, matching sibling issuing resources testCreateUpdateCancel @ TestIssuingStockRule.java:68–109 (round-trip through create/update/cancel; fields typed String consistent with convention)
[M9] id, status, created, updated are output-only: constructor populates in-memory but API ignores on POST covered IssuingStockRule.java:113–129 (Map constructor: sets this.status = null, this.updated = null, this.created = null; id set via super(null); none read from input map) testCreateUpdateCancel @ TestIssuingStockRule.java:111–118 (fixture does not pass id/status/created/updated — they remain null until server response)
[M10] No Log sub-resource — no log module, file, or test scaffolded covered Verified: only two files produced — IssuingStockRule.java and TestIssuingStockRule.java (manifest.txt lines 1–2); no log class, no log import in either file n/a — absence verified by manifest + grep (no log file exists)
[M11] minimumBalance and stockId are the only required constructor params; tags, emails, phones are optional; fixture populates emails/phones (missingReceiver guard) covered IssuingStockRule.java:117–118 (minimumBalance and stockId extracted unconditionally; tags/emails/phones at 119–121 with no null guard = optional); Map constructor docs at 98–104 TestIssuingStockRule.java:111–118 (example fixture sets minimumBalance + stockId + emails + phones)
[M12] Tests mirror Python reference — query (limit/after/before, iterate, assert id string); page (two calls, limit=2, after/before, no-dup, stop on null cursor); no get test; create→update→cancel (free stock, create list, update minimumBalance=20000, cancel assert "canceled") covered IssuingStockRule.java: full surface (create/query/page/get/update/cancel) testQuery @ TestIssuingStockRule.java:18–34; testPage @ TestIssuingStockRule.java:37–65; testCreateUpdateCancel @ TestIssuingStockRule.java:68–109 (free-stock logic at 81–87, list-create at 90–97, update-assert at 100–103, cancel-assert at 106–107)

Summary

  • Total mandatory points: 12
  • covered: 11
  • not covered: 0
  • partial: 0
  • not applicable: 1
  • VERDICT: PASS (not covered == 0 and partial == 0)

If FAIL — routing recommendation

N/A — VERDICT is PASS.

@lucasmiranda-stark lucasmiranda-stark requested a review from a team June 15, 2026 21:53
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.

1 participant