Skip to content

Conversation

@Seven-Streams
Copy link
Collaborator

This PR adds the CONTRIBUTING.md and CODEOWNERS for the repo.

Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Copilot AI review requested due to automatic review settings November 22, 2025 09:49
Copilot finished reviewing on behalf of Seven-Streams November 22, 2025 09:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds contributing guidelines and code ownership documentation to the XGrammar repository. The changes establish processes for community contributions, code review, and maintainership.

  • Introduces CONTRIBUTING.md with PR naming conventions, review process, and community guidelines
  • Adds CODEOWNERS file mapping repository files to responsible maintainers
  • Includes utility scripts to generate and maintain the CODEOWNERS file

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 23 comments.

Show a summary per file
File Description
CONTRIBUTING.md Establishes contribution workflow, PR conventions, and review process
.github/CODEOWNERS Maps 226 files to code owners for review assignments
.github/name_mappings.csv Provides git-to-GitHub username mappings for code owner generation
scripts/generate_code_owner.bash Bash script to automate CODEOWNERS file generation from git history
scripts/name_replace.py Python utility to replace names in CODEOWNERS using CSV mappings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

f.write(content)


if __name__ == "__main__":
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing input validation and error handling. The script will crash with IndexError if insufficient command-line arguments are provided. Consider adding a check like if len(sys.argv) != 3: and printing usage instructions.

Suggested change
if __name__ == "__main__":
if __name__ == "__main__":
if len(sys.argv) != 3:
print(f"Usage: {sys.argv[0]} <csv_file> <input_file>", file=sys.stderr)
sys.exit(1)

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +18
with open(input_file, "r", encoding="utf-8") as f:
content = f.read()

with open(csv_file, "r", encoding="utf-8") as f:
reader = csv.reader(f)
next(reader, None)
for old, _, new in reader:
content = content.replace(old, new)

with open(input_file, "w", encoding="utf-8") as f:
f.write(content)


Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error handling for file operations. If the input file doesn't exist or isn't readable, the script will crash with an unhelpful error. Consider wrapping file operations in try-except blocks with informative error messages.

Suggested change
with open(input_file, "r", encoding="utf-8") as f:
content = f.read()
with open(csv_file, "r", encoding="utf-8") as f:
reader = csv.reader(f)
next(reader, None)
for old, _, new in reader:
content = content.replace(old, new)
with open(input_file, "w", encoding="utf-8") as f:
f.write(content)
try:
with open(input_file, "r", encoding="utf-8") as f:
content = f.read()
except (FileNotFoundError, PermissionError, OSError) as e:
print(f"Error opening or reading input file '{input_file}': {e}", file=sys.stderr)
sys.exit(1)
try:
with open(csv_file, "r", encoding="utf-8") as f:
reader = csv.reader(f)
next(reader, None)
for old, _, new in reader:
content = content.replace(old, new)
except (FileNotFoundError, PermissionError, OSError) as e:
print(f"Error opening or reading CSV file '{csv_file}': {e}", file=sys.stderr)
sys.exit(1)
try:
with open(input_file, "w", encoding="utf-8") as f:
f.write(content)
except (PermissionError, OSError) as e:
print(f"Error writing to input file '{input_file}': {e}", file=sys.stderr)
sys.exit(1)

Copilot uses AI. Check for mistakes.
with open(csv_file, "r", encoding="utf-8") as f:
reader = csv.reader(f)
next(reader, None)
for old, _, new in reader:
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSV unpacking assumes exactly 3 columns per row. If the CSV has a different number of columns, this will raise a ValueError. Consider validating row length or using more defensive unpacking.

Suggested change
for old, _, new in reader:
for row in reader:
if len(row) < 3:
continue # Skip rows with insufficient columns
old, _, new = row[:3]

Copilot uses AI. Check for mistakes.
.github/workflows/tmate.yaml @Ubospica
.github/workflows/unit_test.yaml @DarkSharpness
.gitignore @Ubospica
.gitmodules @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
.gitmodules @Ubospica @Ubospica
.gitmodules @Ubospica

Copilot uses AI. Check for mistakes.
cpp/fsm_builder.cc @Ubospica @Seven-Streams
cpp/fsm_builder.h @Ubospica
cpp/grammar.cc @Ubospica
cpp/grammar_builder.h @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
cpp/grammar_builder.h @Ubospica @Ubospica
cpp/grammar_builder.h @Ubospica

Copilot uses AI. Check for mistakes.
python/xgrammar/kernels/__init__.py @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_cpu.py @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.cu @Ubospica @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica

Copilot uses AI. Check for mistakes.
python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.cu @Ubospica @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_torch_compile.py @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_triton.py @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
python/xgrammar/kernels/apply_token_bitmask_inplace_triton.py @Ubospica @Ubospica
python/xgrammar/kernels/apply_token_bitmask_inplace_triton.py @Ubospica

Copilot uses AI. Check for mistakes.
tests/python/test_function_calling_converter.py @Seven-Streams
tests/python/test_grammar_compiler.py @Ubospica
tests/python/test_grammar_matcher_basic.py @Ubospica
tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica
tests/python/test_grammar_matcher_ebnf.py @Ubospica

Copilot uses AI. Check for mistakes.
tests/python/test_grammar_compiler.py @Ubospica
tests/python/test_grammar_matcher_basic.py @Ubospica
tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica
tests/python/test_grammar_matcher_json.py @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
tests/python/test_grammar_matcher_json.py @Ubospica @Ubospica
tests/python/test_grammar_matcher_json.py @Ubospica

Copilot uses AI. Check for mistakes.
tests/python/test_grammar_matcher_basic.py @Ubospica
tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica
tests/python/test_grammar_matcher_json.py @Ubospica @Ubospica
tests/python/test_grammar_matcher_json_schema.py @Ubospica @Ubospica
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.

Suggested change
tests/python/test_grammar_matcher_json_schema.py @Ubospica @Ubospica
tests/python/test_grammar_matcher_json_schema.py @Ubospica

Copilot uses AI. Check for mistakes.
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.

1 participant