Skip to content

Add IssuingStockRule resource#26

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

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

Conversation

@lucasmiranda-stark

Copy link
Copy Markdown

Context

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

What changed

  • test/starkinfra/test_issuingstockrule.rb
  • test/example_generator.rb
  • lib/issuing_stock_rule/issuing_stock_rule.rb
  • lib/starkinfra.rb
  • 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

Resource: IssuingStockRule
Language: ruby
Run-type: generate
Phase: 7/9

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 (list-based, rest.post_multi / post) covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:56-58 (self.create(rules:, user: nil)Rest.post) "create, update and cancel" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:36-63 (creates via list, asserts rule.id present and is String)
[M2] get(id) method ships (mirrors Python); test DEFERRED — GET /issuing-stock-rule/{id} not deployed (routeNotFound) not applicable sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:72-74 (self.get(id, user: nil)Rest.get_id) n/a — route not deployed on sandbox; contract explicitly defers this test
[M3] query returns iterable accepting limit, after, before, status (list), stockIds/stock_ids, ids, tags covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:92-109 (all seven params declared, Rest.get_stream) "query" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:8-15 (iterates, asserts each rule.id is String)
[M4] page returns [items, cursor] tuple accepting same params as query plus cursor; limit max 100; must pass after/before to avoid API 500 covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:130-148 (all params including cursor, docstring says max 100, Rest.get_page) "page" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:17-34 (two-iteration loop with after: '2022-01-01', before: Date.today.to_s, accumulates ids without duplicates, stops on nil cursor) — Note: endpoint currently returns API-side 500 without date window; test correctly supplies the window
[M5] update(id, ...) PATCHes accepting any subset of minimumBalance/minimum_balance, tags, emails, phones; does NOT accept stockId or status covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:166-176 (signature: id, minimum_balance: nil, tags: nil, emails: nil, phones: nil, user: nilstock_id and status absent) "create, update and cancel" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:59-60 (update(rule.id, minimum_balance: 20_000), asserts rule.minimum_balance == 20_000)
[M6] cancel(id) DELETEs the rule and returns canceled object; test asserts status == "canceled" covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:190-192 (self.cancel(id, user: nil)Rest.delete_id) "create, update and cancel" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:62-63 (cancel(rule.id), asserts rule.status == 'canceled')
[M7] status is output-only enum (active | canceled), not sent on create or PATCH covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:39 (@status = status in constructor; absent from create and update method signatures) "create, update and cancel" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:62-63 (only reads status back from cancel return, never sets it on creation)
[M8] DateTime fields (created, updated) parsed to native datetime type via SDK helper covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:40-41 (StarkCore::Utils::Checks.check_datetime(created) and check_datetime(updated)) n/a — datetime parsing is a constructor-level concern verified by integration; no dedicated assertion required by [M12]
[M9] id, status, created, updated are output-only — constructor accepts them (populates in-memory) but they are not sent on POST covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:29-42 (all four accepted in constructor; create posts only via rest.post which serialises only non-nil input fields) "create, update and cancel" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:45-55 (new rule constructed without id/status/created/updated)
[M10] No Log sub-resource — no log module, file, or test covered sdk-infra/ruby/lib/starkinfra.rb:27 (require_relative('issuing_stock_rule/issuing_stock_rule') — no log require; find confirms only one file in issuing_stock_rule/) sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb (entire file — no Log describe block present)
[M11] minimum_balance and stock_id are required constructor params; tags, emails, phones optional; fixture includes at least one of emails/phones (API requires it) covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:29-31 (required: minimum_balance:, stock_id:; optional with default nil: tags:, emails:, phones:) "create, update and cancel" @ sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:47-54 (fixture populates both emails and phones); sdk-infra/ruby/test/example_generator.rb:442-454 (issuing_stock_rule_example includes both)
[M12] Tests mirror Python reference: query, page, create→update→cancel present; stock freed before create; get test absent (deferred); no error tests covered sdk-infra/ruby/lib/issuing_stock_rule/issuing_stock_rule.rb:56-212 (all operations implemented) sdk-infra/ruby/test/starkinfra/test_issuingstockrule.rb:8-64 (three it-blocks: "query" L8, "page" L17, "create, update and cancel" L36; L41-43 frees existing active rules before create; no get test; no error tests — all matching contract [M12])

Summary

  • Total mandatory points: 12
  • covered: 10
  • not covered: 0
  • partial: 0
  • not applicable: 2 ([M2] method ships but test deferred per contract; [M8] datetime parsing verified at constructor level, no test assertion required by [M12])
  • VERDICT: PASS (not covered == 0, 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