-
Notifications
You must be signed in to change notification settings - Fork 1
docs: FOC board rule updates from 2026-05-05 sweep #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cc80515
docs: update FOC board rules from 2026-05-05 sweep learnings
BigLep 68dcb64
docs: address PR review feedback on jq examples and R-SL-008 clarity
BigLep ad0435b
docs: sweep workflow improvements from 2026-05-06 usage
BigLep ad3e52e
docs: add unlinked PR discovery to R-SL-008 for In Progress issues
BigLep 719a092
feat(filozzy-mcp): add compact columnar JSON format for list_board_items
BigLep 89991f7
docs: use has:linked-pull-requests filter to narrow R-SL-008 queries
BigLep cd397eb
style: apply ruff formatting to server.py and test_format.py
BigLep fa307d4
fix: address PR review comments on playbook and format validation
BigLep daab619
docs: require Phase 2 for R-PR-007 and batch all Phase 2 candidates
BigLep 02f535a
fix(github-projects-client): trim verbose linked PR objects from API …
BigLep 06dae97
style: apply ruff formatting to server.py
BigLep 4b57895
fix: address second round of PR review comments
BigLep a38a60a
style: fix ruff formatting in server.py
BigLep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| """Unit tests for output format helpers (_format_json, _format_compact). | ||
|
|
||
| These are pure-logic tests — no network access or GITHUB_TOKEN required. | ||
|
|
||
| Run: | ||
| cd filozzy-mcp | ||
| uv run pytest tests/test_format.py -v | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
|
|
||
| from filozzy_mcp.server import _format_json, _format_compact | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Fixtures / helpers | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| SAMPLE_ITEMS = [ | ||
| { | ||
| "Repository": "curio", | ||
| "Title": "Fix X", | ||
| "Status": "⌨️ In Progress", | ||
| "Node ID": "PVTI_abc", | ||
| "Assignees": "alice", | ||
| }, | ||
| { | ||
| "Repository": "dealbot", | ||
| "Title": "Add Y", | ||
| "Status": "📌 Triage", | ||
| # Node ID and Assignees intentionally missing (sparse row) | ||
| }, | ||
| { | ||
| "Repository": "curio", | ||
| "Title": "Refactor Z", | ||
| "Status": "👀 Awaiting review", | ||
| "Node ID": "PVTI_xyz", | ||
| "Assignees": "bob, carol", | ||
| }, | ||
| ] | ||
|
|
||
|
|
||
| def _parse(result: str) -> dict: | ||
| return json.loads(result) | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # _format_json | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| class TestFormatJson: | ||
| def test_basic_structure(self): | ||
| out = _parse(_format_json(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| assert out["total_in_page"] == 3 | ||
| assert len(out["items"]) == 3 | ||
| assert "has_more" not in out | ||
| assert "next_cursor" not in out | ||
|
|
||
| def test_items_are_original_dicts(self): | ||
| out = _parse(_format_json(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| assert out["items"][0]["Repository"] == "curio" | ||
| assert out["items"][1]["Title"] == "Add Y" | ||
|
|
||
| def test_pagination_fields(self): | ||
| out = _parse(_format_json(SAMPLE_ITEMS, has_more=True, next_cursor="cur_42")) | ||
| assert out["has_more"] is True | ||
| assert out["next_cursor"] == "cur_42" | ||
|
|
||
| def test_empty_items(self): | ||
| out = _parse(_format_json([], has_more=False, next_cursor=None)) | ||
| assert out["items"] == [] | ||
| assert out["total_in_page"] == 0 | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # _format_compact | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| class TestFormatCompact: | ||
| def test_columns_are_union_of_all_keys(self): | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| assert set(out["columns"]) == { | ||
| "Repository", | ||
| "Title", | ||
| "Status", | ||
| "Node ID", | ||
| "Assignees", | ||
| } | ||
|
|
||
| def test_column_order_follows_first_seen(self): | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| # First item's keys define the initial order | ||
| cols = out["columns"] | ||
| assert cols.index("Repository") < cols.index("Title") | ||
| assert cols.index("Title") < cols.index("Status") | ||
|
|
||
| def test_row_count_matches_items(self): | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| assert len(out["rows"]) == 3 | ||
| assert out["total_in_page"] == 3 | ||
|
|
||
| def test_row_values_match_items(self): | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| cols = out["columns"] | ||
| first_row = dict(zip(cols, out["rows"][0])) | ||
| assert first_row["Repository"] == "curio" | ||
| assert first_row["Title"] == "Fix X" | ||
| assert first_row["Node ID"] == "PVTI_abc" | ||
|
|
||
| def test_sparse_rows_get_empty_string(self): | ||
| """Items missing a column that other items have should get ''.""" | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| cols = out["columns"] | ||
| second_row = dict(zip(cols, out["rows"][1])) | ||
| assert second_row["Node ID"] == "" | ||
| assert second_row["Assignees"] == "" | ||
|
|
||
| def test_pagination_fields(self): | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=True, next_cursor="cur_99")) | ||
| assert out["has_more"] is True | ||
| assert out["next_cursor"] == "cur_99" | ||
|
|
||
| def test_no_pagination_fields_when_not_needed(self): | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| assert "has_more" not in out | ||
| assert "next_cursor" not in out | ||
|
|
||
| def test_empty_items(self): | ||
| out = _parse(_format_compact([], has_more=False, next_cursor=None)) | ||
| assert out["columns"] == [] | ||
| assert out["rows"] == [] | ||
| assert out["total_in_page"] == 0 | ||
|
|
||
| def test_roundtrip_via_jq_reconstruction(self): | ||
| """Verify the documented jq reconstruction produces the original items.""" | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| cols = out["columns"] | ||
| # Simulate: jq '[.columns as $c | .rows[] | [$c, .] | transpose | map({(.[0]): .[1]}) | add]' | ||
| reconstructed = [ | ||
| {col: val for col, val in zip(cols, row)} for row in out["rows"] | ||
| ] | ||
| # First and third items should match exactly | ||
| assert reconstructed[0] == SAMPLE_ITEMS[0] | ||
| assert reconstructed[2] == SAMPLE_ITEMS[2] | ||
| # Second item had missing fields — reconstruction has "" instead | ||
| for key in SAMPLE_ITEMS[1]: | ||
| assert reconstructed[1][key] == SAMPLE_ITEMS[1][key] | ||
|
|
||
| def test_compact_is_smaller_than_json(self): | ||
| """The whole point: compact should use fewer bytes than json.""" | ||
| json_out = _format_json(SAMPLE_ITEMS, has_more=False, next_cursor=None) | ||
| compact_out = _format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None) | ||
| assert len(compact_out) < len(json_out), ( | ||
| f"compact ({len(compact_out)}) should be smaller than json ({len(json_out)})" | ||
| ) | ||
|
|
||
| def test_unicode_preserved(self): | ||
| """Emoji status values should survive the round-trip.""" | ||
| out = _parse(_format_compact(SAMPLE_ITEMS, has_more=False, next_cursor=None)) | ||
| cols = out["columns"] | ||
| first_row = dict(zip(cols, out["rows"][0])) | ||
| assert first_row["Status"] == "⌨️ In Progress" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think compact pagination can still produce incompatible schemas across pages here. Since
_build_display_items()strips empty values before_format_compact()buildscolumns, page 1 and page 2 can end up with different column sets for the same requested fields.The playbook merge example keeps page 1’s
.columnsand just concatenates rows, so if a field is empty on page 1 but present on page 2, reconstruction can silently drop or mislabel values.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed — I have a follow-up PR that discards compact entirely, so I won't fix this now.