Summary
process_index_data_from_rest_api in src/cb_mcp/utils/index_utils.py validates that
lastScanTime is present (_validate_rest_row requires the key), then includes it
only when truthy:
if idx["lastScanTime"]:
index_info["lastScanTime"] = idx["lastScanTime"]
A value of 0 (a legitimate timestamp/epoch meaning "never scanned" or "scanned at
epoch 0") is falsy, so the field is silently omitted from the output even though it
was present and valid. The validator required the key, so its absence in the result is
inconsistent with the contract the validator implies.
How to reproduce
from cb_mcp.utils.index_utils import process_index_data_from_rest_api as p
row = {"indexName": "i", "definition": "CREATE INDEX ...",
"status": "Ready", "bucket": "b", "lastScanTime": 0}
out = p(row)
print("lastScanTime" in out) # -> False (dropped, though 0 is a valid value)
Verified against the current tree.
Impact
Minor but real: consumers relying on lastScanTime being present (because the
validator required it) will find it missing specifically when the value is 0. This
can misrepresent an index that has never been scanned versus one whose scan-time field
was absent.
Suggested fix
Distinguish "present" from "truthy":
if idx.get("lastScanTime") is not None:
index_info["lastScanTime"] = idx["lastScanTime"]
or, since the validator already guarantees the key exists, include it unconditionally:
index_info["lastScanTime"] = idx["lastScanTime"]
Summary
process_index_data_from_rest_apiinsrc/cb_mcp/utils/index_utils.pyvalidates thatlastScanTimeis present (_validate_rest_rowrequires the key), then includes itonly when truthy:
A value of
0(a legitimate timestamp/epoch meaning "never scanned" or "scanned atepoch 0") is falsy, so the field is silently omitted from the output even though it
was present and valid. The validator required the key, so its absence in the result is
inconsistent with the contract the validator implies.
How to reproduce
Verified against the current tree.
Impact
Minor but real: consumers relying on
lastScanTimebeing present (because thevalidator required it) will find it missing specifically when the value is
0. Thiscan misrepresent an index that has never been scanned versus one whose scan-time field
was absent.
Suggested fix
Distinguish "present" from "truthy":
or, since the validator already guarantees the key exists, include it unconditionally: