feat(mcp,cli): report filter preflight and CLI label hex#284
Conversation
dfc09d2 to
db4b77e
Compare
0b11025 to
01c4788
Compare
There was a problem hiding this comment.
One correctness risk to verify against the API, one altitude note, one cleanup, one docs gap. The filter-narrowing items are plausible (the validator is stricter than the previously-passthrough path), not confirmed regressions: the repo has no ReportCardsFilter schema to check against.
db4b77e to
2e0d0b8
Compare
01c4788 to
293a18f
Compare
|
Thanks @gbrlcustodio — addressed in |
Consolidating the four filter and label threadsThe four open threads on this PR are one structural issue, not four. Filter and color validation is a decision (is this input valid, and what is its normalized form?) wired at twelve effect sites: the six MCP report tools and the six CLI commands. Every one of those sites forwards through a single SDK layer: The movePush normalize and validate down to those SDK methods, and let each surface only shape the error. # report_service.py: one decision point that all six methods call
def _prepare_filter(filter_obj):
if filter_obj is None:
return None
normalized = normalize_report_cards_filter(filter_obj)
msg = validate_report_cards_filter(normalized)
if msg is not None:
raise ValueError(msg) # or a small typed subclass for precise catches
return normalized
# each method: input_obj["filter"] = _prepare_filter(filter)
# pipe_config_service.py: normalize at the funnel
async def create_label(self, pipe_id, name, color):
color = normalize_label_color(color) # already raises ValueError on bad input
...
async def update_label(self, label_id, **attrs):
if "color" in attrs:
attrs["color"] = normalize_label_color(attrs["color"])Then delete the twelve leaf guards. MCP catches the error and returns What this resolves
Trade-offs
Needs fixing regardless of the aboveThe docstring change in 293a18f introduced a regression. The four newly-documented tools use f-string docstrings ( |
293a18f to
d0260f5
Compare
2e0d0b8 to
66d0703
Compare
|
Thanks @gbrlcustodio — you convinced us. The consolidated move is implemented in #291 (PR 7 of this stack, stacked on #285): The f-string docstring regression was fixed separately on this PR in b7dbc4e (plain literals + regression tests asserting non-empty descriptions and the |
598f553 to
ca568bb
Compare
… CLI Fail fast on malformed ReportCardsFilter (including export paths); CLI label create/update uses normalize_label_color (#RGB expanded to #RRGGBB).
…dation Normalize integer query values to strings before ReportCardsFilter preflight; apply normalized filters on MCP paths. Share label name/color CLI validation; align filter-shape docstrings across all six report tools.
Python does not treat f-strings as docstrings, so the four report tools
documented via f"""...{_REPORT_FILTER_SHAPE_DOC}""" exposed empty MCP
descriptions. Inline the ReportCardsFilter guidance as plain literals and
add regression tests asserting non-empty descriptions and the
current_phase warning on all six filter paths.
Co-authored-by: Gabriel Custodio <gbrlcustodio@users.noreply.github.com>
Align validate_label_name_cli and validate_label_color_cli with validate_report_filter_cli so validation errors share the same format.
d0260f5 to
26c86b3
Compare
|
Rebased onto latest Tests run locally:
Ready for manual merge when CI is green. |
ccb361f
into
feat/card-phase-erg/4-mcp-cli-create-card-phase
Analytics pipe seeding (
306996636) requiredexecute_graphqlfor phase inventory and phase-local creates. Spec:.cursor/dev-planning/specs/archive/card-phase-ergonomics/— Stack after #277 (closed).Depends on: #283
Objective
Close remaining boundary gaps from chaos-pipe:
validate_report_cards_filteron all MCP/CLI paths that acceptfilter(create/update/export pipe + org reports) — F6label create/updateusesnormalize_label_color(F7)Improvements
current_phasemistake caught before GraphQL with a clear message.#F00works like the live API;redrejected locally.