mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
fix(ownership): correct changes, alias search, graph, and name lookups
From a full-repo Codex audit, each reproduced on the synced ownership DB:
- `changes` paired an investor's accounts across releases instead of
comparing totals: KREN's KRESNA PRIMA INVEST went 9.44% -> 13.45% (a
second 4.01% account) but was reported as decreased 944 -> 401 bps.
Sum a holder's accounts per ticker, and read one release per date (the
latest imported, as other queries do), so a corrected file supersedes
the original instead of mixing with it.
- `changes` / get_ownership_changes accepted any dates: `from: ""`
reported all 7,154 holders as new, unknown dates returned no changes.
Dates must be YYYY-MM-DD imported releases with `from` before `to`.
- get_investor_holdings / `entity` with an empty name matched every
investor and returned an arbitrary one ("AMY"); `%` and `_` acted as
LIKE wildcards. Reject empty names; match wildcards literally.
- Alias search never worked: the FTS table declared an `aliases` column
its content table lacks (`no such column: T.aliases`), so searches
fell back to canonical names and a raw KSEI name such as
"PT ASTRA INTERNATIONAL TBK" found nothing. Search names and aliases
directly, ranked exact name, exact alias, prefix, then shorter names.
- `graph` enumerated every path (exponential in depth) and its cycle
check matched substrings, dropping entity:1 when entity:10 was on the
path. Traverse breadth-first with an exact visited set.
- Name normalization removed leading PT tokens from the front of a Vec,
quadratic in hostile names; narrow a slice instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh
This commit is contained in:
parent
f5da3b745e
commit
1d3fe5ca88
6 changed files with 437 additions and 196 deletions
|
|
@ -394,6 +394,22 @@ fn ownership_tools_read_the_local_database() {
|
|||
assert!(page["next_offset"].is_null(), "offset {past}: {page}");
|
||||
}
|
||||
|
||||
// Bad, unknown, or reversed dates are errors, not "everyone is new".
|
||||
for (from, to) in [
|
||||
("", "2026-02-27"),
|
||||
("1999-01-01", "2026-02-27"),
|
||||
("2026-02-27", "2026-01-30"),
|
||||
("2026-01-30", "2026-01-30"),
|
||||
] {
|
||||
let (is_error, body) =
|
||||
client.call("get_ownership_changes", json!({"from": from, "to": to}));
|
||||
assert!(is_error, "{from}..{to}: {body}");
|
||||
assert_eq!(body["code"], "INVALIDINPUT", "{from}..{to}: {body}");
|
||||
}
|
||||
let (is_error, body) = client.call("get_investor_holdings", json!({"entity": " "}));
|
||||
assert!(is_error, "{body}");
|
||||
assert_eq!(body["code"], "INVALIDINPUT", "{body}");
|
||||
|
||||
let (is_error, body) = client.call(
|
||||
"get_ownership_changes",
|
||||
json!({"from": "2026-01-30", "to": "2026-02-27", "limit": 301}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue