Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v5
with:
repository: chaoz23/srdcheck
ref: 27dee98cb7cb86e6ef86e34568d08954179f9a82
ref: 0fbc4b9d161a9ca7e378a73ad88421ff6b278af3
path: srdcheck-src
- uses: actions/setup-python@v6
with:
Expand Down
6 changes: 6 additions & 0 deletions tablekit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,12 @@ def main(argv=None):
print(__version__)
return 0
cmd = args.pop(0)
# FAMILY.md clause 7 codifies `--schema` as a flag, and it binds every member
# class. The capability already exists as a subcommand; accept the codified
# spelling as an alias so a fresh-context agent following the family contract
# verbatim is not refused. See chaoz23/table-kit#23.
if cmd == "--schema":
cmd = "schema"
fn = COMMANDS.get(cmd)
if not fn:
print(f"unknown command {cmd!r}\n\n{USAGE}", file=sys.stderr)
Expand Down
25 changes: 25 additions & 0 deletions tests/test_contracts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import io
import json
import os
import subprocess
Expand Down Expand Up @@ -140,6 +141,30 @@ def test_contract_cli_is_checkout_independent(self):
self.assertEqual(json.loads(result.stdout)["properties"]["schema_version"]["const"], version)


class FamilyContractTests(unittest.TestCase):
"""FAMILY.md clause 7 codifies `--schema` as a flag, and it binds every
member class. table-kit exposes the capability as a `schema` subcommand, so
the flag spelling is an alias -- without it a fresh-context agent following
the family contract verbatim is refused (chaoz23/table-kit#23)."""

def _capture(self, argv):
buf = io.StringIO()
with redirect_stdout(buf):
code = main(argv)
return code, buf.getvalue()

def test_schema_flag_is_accepted(self):
code, out = self._capture(["--schema"])
self.assertEqual(code, 0)
json.loads(out)

def test_schema_flag_matches_the_subcommand(self):
flag_code, flag_out = self._capture(["--schema"])
cmd_code, cmd_out = self._capture(["schema"])
self.assertEqual(flag_code, cmd_code)
self.assertEqual(json.loads(flag_out), json.loads(cmd_out))


class LegacyMigrationTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
Expand Down