Module: Parse::Core::Describe

Included in:
Object
Defined in:
lib/parse/model/core/describe.rb

Overview

Operator-facing introspection mixin. Extended onto Parse::Object so ‘Model.describe` aggregates local model declarations, server schema, CLP, and Atlas Search index state into a single Hash.

SECURITY POSTURE — mirrors Agent::Describe. This is operator-side observability, NOT data exposed to an LLM. Output is never included in tool responses, MCP ‘tools/list`, or any `parse.agent.*` notification payload. Surfacing it via a console or debug endpoint requires auth-gating on the operator boundary.

Network policy mirrors ‘agent.describe`: local-only by default. Opt in to server fetches with `network: true`. Each section degrades gracefully (`false, reason: …`) instead of raising when the underlying service is unreachable or unconfigured.

Constant Summary collapse

LOCAL_SECTIONS =
%i[model acl].freeze
NETWORK_SECTIONS =
%i[schema clp atlas indexes].freeze
ALL_SECTIONS =
(LOCAL_SECTIONS + NETWORK_SECTIONS).freeze
CORE_FIELD_KEYS =

Core/built-in field keys we don’t report under ‘:model` —they’re inherited from Parse::Object (in both snake_case and camelCase form) and add noise to every output.

%i[
  id object_id created_at updated_at acl session_token
  objectId createdAt updatedAt ACL sessionToken
].freeze

Instance Method Summary collapse

Instance Method Details

#describe(*sections, pretty: false, network: false, usage: false, master: false, client: nil) ⇒ Hash, String

Note:

Valid sections: :model :acl :schema :clp :atlas :indexes.

Aggregate introspection for the class. Local-only by default; pass ‘network: true` to include server schema, CLP, and Atlas Search.

Parameters:

  • sections (Array<Symbol>)

    which sections to include. When empty, returns LOCAL_SECTIONS for ‘network: false` and ALL_SECTIONS for `network: true`. Valid: :model :acl :schema :clp :atlas.

  • pretty (Boolean) (defaults to: false)

    when true, returns a multi-line String for ‘puts` debugging instead of the Hash.

  • network (Boolean) (defaults to: false)

    permit per-section server/Mongo fetches. When false, network sections short-circuit to ‘false, reason: :network_disabled`.

  • client (Parse::Client, nil) (defaults to: nil)

    optional client override for schema/clp fetches.

  • master (Boolean) (defaults to: false)

    forward an explicit master-key opt-in to admin-only sub-fetches (currently: ‘$indexStats` via MongoDB.index_stats, which requires `master: true`). When false (default), `usage:` counters degrade to `{}` and the `indexes` section reports `usage_available: false`. Pass `master: true` from an operator/audit context to populate real counters. The flag is NEVER auto-set by the SDK.

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/parse/model/core/describe.rb', line 56

def describe(*sections, pretty: false, network: false, usage: false, master: false, client: nil)
  requested = sections.flatten.map(&:to_sym)
  active    = if requested.empty?
      network ? ALL_SECTIONS : LOCAL_SECTIONS
    else
      requested
    end

  data = { class_name: parse_class }
  active.each do |s|
    data[s] = describe_section(s, client: client, network: network, usage: usage, master: master)
  end
  pretty ? describe_pretty(data) : data
end