What problem does this solve?
The current query functionality for StatusQuery and ResourceQuery may not fully utilize all available database fields. Some database columns exist but aren't queryable, limiting user ability to filter commands and resources.
Additionally, StatusQuery is used in contexts beyond status (such as the cancel command), so renaming it to FormaCommandQuery would improve clarity.
Database fields available and not currently queryable:
- forma_commands table:
timestamp, agent_version, agent_id
- resources table:
valid_from, command_id, operation, ksuid
Proposed solution
- Rename
StatusQuery to FormaCommandQuery:
- Update type definition in
internal/metastructure/datastore/datastore.go
- Update all usages (querier, datastore implementations, cancel command, API endpoints, etc)
- Add support for querying additional database fields:
- Review which missing fields (see above) are useful to query
- Update query parsing in
internal/metastructure/querier/bluge_querier.go
- Update SQL implementations in both SQLite and PostgreSQL datastores
Important: Ensure backward compatibility with existing queries throughout implementation. Focus on adding fields that have clear use cases and are indexed in the database for performance.
What problem does this solve?
The current query functionality for
StatusQueryandResourceQuerymay not fully utilize all available database fields. Some database columns exist but aren't queryable, limiting user ability to filter commands and resources.Additionally,
StatusQueryis used in contexts beyond status (such as the cancel command), so renaming it toFormaCommandQuerywould improve clarity.Database fields available and not currently queryable:
timestamp,agent_version,agent_idvalid_from,command_id,operation,ksuidProposed solution
StatusQuerytoFormaCommandQuery:internal/metastructure/datastore/datastore.gointernal/metastructure/querier/bluge_querier.goImportant: Ensure backward compatibility with existing queries throughout implementation. Focus on adding fields that have clear use cases and are indexed in the database for performance.