Skip to content

[Chore] Add flake8 style check#6

Closed
wcchang1115 wants to merge 1 commit into
mainfrom
chore/add-flake8-style-check
Closed

[Chore] Add flake8 style check#6
wcchang1115 wants to merge 1 commit into
mainfrom
chore/add-flake8-style-check

Conversation

@wcchang1115
Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
@wcchang1115 wcchang1115 changed the title Add flake8 style check [Chore] Add flake8 style check Nov 17, 2023
@popcornylu popcornylu closed this Nov 23, 2023
@wcchang1115 wcchang1115 deleted the chore/add-flake8-style-check branch November 29, 2023 06:07
iamcxa added a commit that referenced this pull request Feb 6, 2026
Changes based on Copilot review:

1. Add PERMISSION_DENIED status code to distinguish authorization
   errors from missing table errors (#5)

2. Add defensive check for node.config.materialized is not None
   to handle edge cases (#2)

3. Remove unnecessary raw string prefix from SQL template (#3)

4. Fix SQLMesh initialization - only set TABLE_NOT_FOUND after
   query actually fails, not as misleading default (#7)

5. Add test for PERMISSION_DENIED status

Skipped suggestions:
- #1: Integration tests (better as separate PR)
- #4: Logger convention (__name__ is standard Python)
- #6: Error pattern specific enough for count(*) context

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
even-wei added a commit that referenced this pull request May 25, 2026
Addresses PR #1376 review (Andy, Issue #6). The previous "does not
throw if cancelRun POST rejects" test mocked `cancelRun` at the
module boundary, so the real try/catch in `api/runs.ts:113-120` was
never exercised. The assertion `expect(onCancel()).resolves.toBeUndefined()`
also asserted on `useRun.onCancel`'s hard-coded `Promise.resolve()`,
not on `cancelRun` — meaning the test would pass even if the
production swallow were deleted.

The fix removes the module-level mock of `cancelRun` (only `waitRun`
is mocked now), stubs `globalThis.fetch` to throw on
`/api/runs/.../cancel`, and asserts:

  - `onCancel()` still resolves to undefined
  - fetch was actually called against the cancel URL (so the real
    `cancelRun` path executed)
  - UI state (`error`, `run.status`, `isRunning`) is unaffected by
    the network failure

`vi.spyOn(globalThis, "fetch")` is restored in a `finally` so the
default 500-response mock from `vitest.setup.mts` is reinstated for
the next test.

Signed-off-by: even-wei <evenwei@infuseai.io>
iamcxa added a commit that referenced this pull request May 25, 2026
Fifth widget, completing Phase A of the post-iter-1 widget expansion.
Single-model detail view (base/current column tables, constraints, not-found state).

- Pydantic ColumnInfo + ModelEnvironment + GetModelOutput + GetModelInput
  matching actual _tool_get_model return shape (columns dict → list normalised
  in _parse_model_env helper; primary_key preserved; raw_code omitted)
- @mcp.tool with annotations, CallToolResult short content + structuredContent
- @mcp.resource with mime/CSP/prefersBorder
- Widget HTML: SDK helpers + onhostcontextchanged + onteardown + exhaustive
  @media dark; adaptive 2-col/3-col column table layout (constraints visible
  only when present); per-env base/current sections; not-found empty state
- WIDGET_TOOLS filter at 5 tools
- 2 new tests (test_get_model_widget_registered,
  test_get_model_returns_calltoolresult_with_pydantic_shape); enumeration
  assertions bumped to 5 tools/resources

Phase A (tier 1-2 multipliers) complete: row_count_diff, schema_diff,
get_server_info, list_checks, get_model. ~half the design's 12 widget
candidates done — design Open Q #6 >=50% FastMCP migration trigger
approaches. Iter 2 mini-doc to reevaluate.

No Pydantic reserved-name conflicts in actual handler shape (columns,
primary_key, raw_code are all safe); Gotcha documented in mcp-widgets.md
for future implementors.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
iamcxa added a commit that referenced this pull request May 25, 2026
Tenth widget; closes Phase B (5 tier-3 widgets). Side-by-side ranked
lists of top-K most frequent values across base + current envs.

- TopKDiffInput / TopKEnvStats / TopKDiffOutput Pydantic models matching
  actual TopKDiffTask return shape (READ from source):
  base/current: {values[], counts[], valids, total} parallel lists.
  values[] is the SAME union list in both envs (SQL FULL OUTER JOIN order:
  curr_count DESC, base_count DESC). count=0 means absent from that env.
  Param is column_name (not column), default k=10 (not 50).
- 2-column grid with ranked lists per env, inline bar viz, rank-change
  arrows (up/down), New/Gone badges for env-exclusive categories
- _warning extracted to output.warning named field
- @mcp.tool annotations (openWorldHint=True — executes warehouse SQL)
- WIDGET_TOOLS at 10 tools — 50% coverage (10/20), design Open Q #6
  FastMCP migration trigger threshold REACHED. iter 2 to reevaluate.
- 2 new tests (23: registration + inputSchema, 24: Pydantic shape);
  enumeration bumped to 10

Phase B (tier-3 data tables): query, query_diff, value_diff,
value_diff_detail, top_k_diff. Each hand-rolled its table/list layout
because patterns diverged enough that a shared <recce-table> would
need extreme flexibility. Iter 2 mini-doc: evaluate renderRankedList()
JS helper extraction; full component abstraction deferred until 3+
widgets converge on same layout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
iamcxa added a commit that referenced this pull request May 27, 2026
…ete)

Twelfth widget; closes Phase C. Per-column statistical profile comparison
(count, null proportion, distinct count, min, max, avg, median) across base
+ current envs rendered as a card grid.

- ProfileColumnStats / ProfileColumnDiff / ProfileDiffOutput / ProfileDiffInput
  Pydantic models matching actual ProfileDiffResult return shape (base + current
  DataFrames with columns: column_name, data_type, row_count, not_null_proportion,
  distinct_proportion, distinct_count, is_unique, min, max, avg, median)
- _parse_profile_dataframe() helper: DataFrame dict -> {col_name: ProfileColumnStats}
  with _to_float / _to_int / _to_str / _to_bool coercions for agate type variants
- _parse_data_type_map() helper: DataFrame dict -> {col_name: data_type}
- Union column ordering: base columns first, then current-only appended;
  columns absent from one env have base=None or current=None in the diff
- min/max arrive as str (SQL CAST to text type in PROFILE_COLUMN_JINJA_TEMPLATE)
  -- no isoformat() conversion needed (unlike histogram_diff bin_edges)
- _warning extracted to output.warning named field
- @mcp.tool annotations: openWorldHint=True (warehouse queries)
- WIDGET_TOOLS now 12 tools -- 60% coverage, Open Q #6 FastMCP migration
  trigger threshold EXCEEDED (was 50% hypothesis)
- 2 new tests (27, 28); enumeration bumped to 12 in test 3; profile_diff
  added to annotation loop in test 8; openWorldHint assertion added
- HTML: 521 lines, ~22KB; CSS grid card layout (260px min per card); stat
  mini-table per card with Base->Current columns; delta chips for numeric
  changes; pp (percentage-point) delta for proportions; type classification
  (numeric/text/date-time/boolean/other) for badge and stat visibility
- No sparklines -- ProfileDiffTask returns aggregate stats only, no per-bin data

Phase C (tier 4 chart/stats): histogram_diff (SVG bars), profile_diff (CSS grid
cards). Both keep CSP at single unpkg origin. If iter 3+ needs richer chart types
(stacked bar, line, heatmap), evaluate Chart.js / Vega-Lite then.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Kent <iamcxa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants