Skip to content

Commit 7f246a3

Browse files
Remove dead code and fix linting issues (#2)
* Add CodeRabbit AI integration configuration - Add .coderabbit.yaml with security-focused configuration - Configure path-specific instructions for different code areas - Add auto-approval for small, safe changes - Include ContextForge Memory-specific review prompts - Add comprehensive setup guide for CodeRabbit AI - Optimize for security, performance, and code quality reviews * Fix all CodeRabbit AI reported issues Security fixes: - Fix pip version constraint from >=25.0 to >=25.2 (GHSA-4xh5-x5gv-qwph) - Add explicit starlette==0.48.0 to requirements.txt - Pin fastapi to exact version 0.119.0 for reproducibility CI workflow improvements: - Remove duplicate dependency installation (safety/pip-audit now in requirements.txt) - Remove ad-hoc dependency upgrades from CI - Replace deprecated 'safety check' with 'safety scan' - Use continue-on-error instead of shell || true for cleaner JSON output Performance optimizations: - Remove unused _score computation in search function - Fix redundant query embedding computation in sort key - Reuse precomputed query_vec instead of recomputing for each item Code quality: - Add safety-results.json and audit-results.json to .gitignore - Remove committed safety-results.json artifact file - Ensure all dependencies are properly pinned for reproducibility All CodeRabbit AI suggestions have been implemented. * Remove CodeRabbit configuration from repository - Remove .coderabbit.yaml (system-specific configuration) - Remove CODERABBIT_SETUP.md (setup documentation) - Keep CodeRabbit AI integration but use default settings - Configuration should be managed at user/organization level, not in repo * Remove dead score function and fix linting issues - Remove unused score function from main.py (dead code) - Fix flake8 line length issues in Python client - Fix markdownlint issues across all markdown files: - Break long lines to comply with 80-character limit - Add proper spacing around headings and lists - Fix code block spacing issues - All linting tools now pass without errors * Fix CodeRabbit configuration schema - Move tone from review.tone to top-level tone_instructions - Move path_instructions under reviews section - Replace ignore.paths with reviews.path_filters using ! prefix - Remove unsupported custom sections (behavior, security, performance, integrations, custom_prompts) - Restructure to match official CodeRabbit schema requirements - Preserve all review guidance content in properly formatted structure * refactor: merge redundant path entries in .coderabbit.yaml - Combine identical instructions for *.md and docs/**/* into single entry - Use **/*.md pattern to cover all markdown files - Remove duplication while preserving all review instructions * docs(coderabbit): add optional external tools note and IaC review paths - Recommend enabling gitleaks, semgrep, checkov in CodeRabbit UI - Add IaC/container/K8s review instructions under path_instructions - Keep path fields as strings to satisfy linter * Consolidate duplicate IaC/container path instructions in .coderabbit.yaml - Replace 8 identical path instruction blocks with single canonical rule - Use brace-expanded glob to cover all original patterns: - **/*.tf, **/Dockerfile, **/Dockerfile.* - **/docker-compose.yml, **/docker-compose.*.yml - helm/**/*, k8s/**/*, kubernetes/**/* - Preserve original instruction text for Infrastructure-as-Code security --------- Co-authored-by: Ben De Cock <[email protected]>
1 parent c85c74e commit 7f246a3

File tree

11 files changed

+269
-1520
lines changed

11 files changed

+269
-1520
lines changed

.coderabbit.yaml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# CodeRabbit AI Configuration for ContextForge Memory
2+
# https://docs.coderabbit.ai/guides/code-review-best-practices/
3+
4+
# Top-level tone instructions (max 250 chars)
5+
tone_instructions: "Professional tone focusing on security, performance, code quality, best practices, and documentation"
6+
7+
# Review configuration
8+
reviews:
9+
# Optional: Consider enabling additional external review tools in CodeRabbit UI
10+
# such as gitleaks (secrets scanning), semgrep (SAST), and checkov (IaC scanning)
11+
# for broader security coverage. These are configured in the CodeRabbit UI, not here.
12+
# Path filters for excluding files and directories
13+
path_filters:
14+
- "!**/*.pyc"
15+
- "!**/__pycache__/**"
16+
- "!**/.pytest_cache/**"
17+
- "!**/node_modules/**"
18+
- "!**/.venv/**"
19+
- "!**/venv/**"
20+
- "!**/data/**"
21+
- "!**/logs/**"
22+
- "!**/*.log"
23+
- "!**/safety-results.json"
24+
- "!**/audit-results.json"
25+
- "!**/.coverage"
26+
- "!**/coverage.xml"
27+
- "!**/dist/**"
28+
- "!**/build/**"
29+
- "!**/.mypy_cache/**"
30+
31+
# Path-specific review instructions
32+
path_instructions:
33+
# API and main application code
34+
- path: "src/**/*.py"
35+
instructions: |
36+
Focus on:
37+
- API design and RESTful principles
38+
- Error handling and validation
39+
- Security considerations (input validation, authentication)
40+
- Performance implications
41+
- Type hints and documentation
42+
- FastAPI best practices
43+
44+
# Client libraries
45+
- path: "clients/**/*"
46+
instructions: |
47+
Focus on:
48+
- API client design patterns
49+
- Error handling and retry logic
50+
- Type safety and interfaces
51+
- Documentation and examples
52+
- Cross-platform compatibility
53+
54+
# CI/CD and workflows
55+
- path: ".github/**/*"
56+
instructions: |
57+
Focus on:
58+
- Security best practices
59+
- Workflow efficiency
60+
- Proper permissions and secrets handling
61+
- Dependabot configuration
62+
- Security scanning setup
63+
64+
# Infrastructure-as-Code and container security (canonical rule)
65+
- path: "{**/*.tf,**/Dockerfile,**/Dockerfile.*,**/docker-compose.yml,**/docker-compose.*.yml,helm/**/*,k8s/**/*,kubernetes/**/*}"
66+
instructions: |
67+
Focus on:
68+
- IaC security and misconfigurations (least privilege, restricted policies)
69+
- Safe defaults (no hard-coded secrets, pinned images, versioned modules)
70+
- Container best practices (non-root user, slim base images, healthchecks)
71+
- Network exposure and port/security group rules
72+
- Kubernetes/Helm best practices (resource limits, probes, RBAC)
73+
74+
# Documentation (markdown files in root and docs directory)
75+
- path: "**/*.md"
76+
instructions: |
77+
Focus on:
78+
- Clarity and completeness
79+
- Up-to-date information
80+
- Proper markdown formatting
81+
- Security policy accuracy
82+
- Contribution guidelines
83+
84+
# Configuration files
85+
- path: "requirements.txt"
86+
instructions: |
87+
Focus on:
88+
- Dependency security and versions
89+
- Configuration best practices
90+
- Security implications
91+
- Proper formatting and structure
92+
93+
- path: "pyproject.toml"
94+
instructions: |
95+
Focus on:
96+
- Dependency security and versions
97+
- Configuration best practices
98+
- Security implications
99+
- Proper formatting and structure
100+
101+
- path: "*.yaml"
102+
instructions: |
103+
Focus on:
104+
- Configuration best practices
105+
- Security implications
106+
- Proper formatting and structure
107+
108+
- path: "*.yml"
109+
instructions: |
110+
Focus on:
111+
- Configuration best practices
112+
- Security implications
113+
- Proper formatting and structure

.github/workflows/ci.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@ jobs:
2222
run: |
2323
python -m pip install --upgrade pip
2424
pip install -r requirements.txt
25-
pip install safety pip-audit
26-
- name: Update vulnerable dependencies
27-
run: |
28-
pip install --upgrade pip
29-
pip install --upgrade starlette
3025
- name: Lint
3126
run: |
3227
ruff check src
3328
black --check src
3429
- name: Security audit
30+
id: security-audit
31+
continue-on-error: true
3532
run: |
36-
safety check --json > safety-results.json || true
37-
pip-audit --desc --format=json --output=audit-results.json || true
33+
safety scan --json > safety-results.json
34+
pip-audit --desc --format=json --output=audit-results.json
3835
- name: Upload security audit results
3936
if: always()
4037
uses: actions/upload-artifact@v4
@@ -43,6 +40,24 @@ jobs:
4340
path: |
4441
safety-results.json
4542
audit-results.json
43+
- name: Security audit failure notification
44+
if: failure() && steps.security-audit.outcome == 'failure'
45+
run: |
46+
echo "::warning::Security audit failed! Check the security-audit-results artifact for details."
47+
echo "::group::Safety scan results"
48+
if [ -f safety-results.json ]; then
49+
cat safety-results.json
50+
else
51+
echo "safety-results.json not found"
52+
fi
53+
echo "::endgroup::"
54+
echo "::group::Pip audit results"
55+
if [ -f audit-results.json ]; then
56+
cat audit-results.json
57+
else
58+
echo "audit-results.json not found"
59+
fi
60+
echo "::endgroup::"
4661
- name: Import smoke test
4762
run: |
4863
python - << 'PY'

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ node_modules/
1515
logs/
1616
data/
1717

18+
# Security scan artifacts
19+
safety-results.json
20+
audit-results.json
21+
1822

CODE_OF_CONDUCT.md

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
## Our Pledge
44

5-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
611

7-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
814

915
## Our Standards
1016

11-
Examples of behavior that contributes to a positive environment for our community include:
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
1219

1320
* Using welcoming and inclusive language
1421
* Being respectful of differing viewpoints and experiences
@@ -18,59 +25,102 @@ Examples of behavior that contributes to a positive environment for our communit
1825

1926
Examples of unacceptable behavior include:
2027

21-
* The use of sexualized language or imagery, and sexual attention or advances of any kind
28+
* The use of sexualized language or imagery, and sexual attention or advances
29+
of any kind
2230
* Trolling, insulting or derogatory comments, and personal or political attacks
2331
* Public or private harassment
24-
* Publishing others' private information, such as a physical or email address, without their explicit permission
25-
* Other conduct which could reasonably be considered inappropriate in a professional setting
32+
* Publishing others' private information, such as a physical or email address,
33+
without their explicit permission
34+
* Other conduct which could reasonably be considered inappropriate in a
35+
professional setting
2636

2737
## Enforcement Responsibilities
2838

29-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
39+
Community leaders are responsible for clarifying and enforcing our standards of
40+
acceptable behavior and will take appropriate and fair corrective action in
41+
response to any behavior that they deem inappropriate, threatening, offensive,
42+
or harmful.
3043

31-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
44+
Community leaders have the right and responsibility to remove, edit, or reject
45+
comments, commits, code, wiki edits, issues, and other contributions that are
46+
not aligned to this Code of Conduct, and will communicate reasons for
47+
moderation decisions when appropriate.
3248

3349
## Scope
3450

35-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
51+
This Code of Conduct applies within all community spaces, and also applies when
52+
an individual is officially representing the community in public spaces.
53+
Examples of representing our community include using an official project e-mail
54+
address, posting via an official social media account, or acting as an appointed
55+
representative at an online or offline event.
3656

3757
## Enforcement
3858

39-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [[email protected]](mailto:[email protected]). All complaints will be reviewed and investigated promptly and fairly.
59+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
60+
reported to the community leaders responsible for enforcement at
61+
62+
complaints will be reviewed and investigated promptly and fairly.
4063

41-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
64+
All community leaders are obligated to respect the privacy and security of the
65+
reporter of any incident.
4266

4367
## Enforcement Guidelines
4468

45-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
69+
Community leaders will follow these Community Impact Guidelines in determining
70+
the consequences for any action they deem in violation of this Code of Conduct:
4671

4772
### 1. Correction
48-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
4973

50-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
74+
**Community Impact**: Use of inappropriate language or other behavior deemed
75+
unprofessional or unwelcome in the community.
76+
77+
**Consequence**: A private, written warning from community leaders, providing
78+
clarity around the nature of the violation and an explanation of why the
79+
behavior was inappropriate. A public apology may be requested.
5180

5281
### 2. Warning
82+
5383
**Community Impact**: A violation through a single incident or series of actions.
5484

55-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
85+
**Consequence**: A warning with consequences for continued behavior. No
86+
interaction with the people involved, including unsolicited interaction with
87+
those enforcing the Code of Conduct, for a specified period of time. This
88+
includes avoiding interactions in community spaces as well as external channels
89+
like social media. Violating these terms may lead to a temporary or permanent
90+
ban.
5691

5792
### 3. Temporary Ban
58-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
5993

60-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
94+
**Community Impact**: A serious violation of community standards, including
95+
sustained inappropriate behavior.
96+
97+
**Consequence**: A temporary ban from any sort of interaction or public
98+
communication with the community for a specified period of time. No public or
99+
private interaction with the people involved, including unsolicited interaction
100+
with those enforcing the Code of Conduct, is allowed during this period.
101+
Violating these terms may lead to a permanent ban.
61102

62103
### 4. Permanent Ban
63-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
64104

65-
**Consequence**: A permanent ban from any sort of public interaction within the community.
105+
**Community Impact**: Demonstrating a pattern of violation of community
106+
standards, including sustained inappropriate behavior, harassment of an
107+
individual, or aggression toward or disparagement of classes of individuals.
108+
109+
**Consequence**: A permanent ban from any sort of public interaction within the
110+
community.
66111

67112
## Attribution
68113

69-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
114+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
115+
version 2.1, available at
116+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
70117

71-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
118+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
119+
enforcement ladder][Mozilla CoC].
72120

73-
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
121+
For answers to common questions about this code of conduct, see the FAQ at
122+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
123+
[https://www.contributor-covenant.org/translations][translations].
74124

75125
[homepage]: https://www.contributor-covenant.org
76126
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html

CONTRIBUTING.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Contributing to ContextForge Memory
22

3-
Thank you for your interest in contributing to ContextForge Memory! This document provides guidelines for contributing to the project.
3+
Thank you for your interest in contributing to ContextForge Memory! This
4+
document provides guidelines for contributing to the project.
45

56
## Code of Conduct
67

7-
This project adheres to our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
8+
This project adheres to our [Code of Conduct](CODE_OF_CONDUCT.md). By
9+
participating, you are expected to uphold this code.
810

911
## Getting Started
1012

@@ -36,19 +38,22 @@ python -m pytest
3638
### Branch Naming
3739

3840
Use descriptive branch names:
41+
3942
- `feature/add-new-endpoint`
4043
- `bugfix/fix-search-filtering`
4144
- `docs/update-readme`
4245

4346
### Commit Messages
4447

4548
Write clear, descriptive commit messages:
49+
4650
- Use present tense ("Add feature" not "Added feature")
4751
- Capitalize the first letter
4852
- No period at the end
4953
- Reference issues when applicable
5054

5155
Examples:
56+
5257
- `Add support for custom metadata validation`
5358
- `Fix search results ordering bug (#123)`
5459
- `Update API documentation`
@@ -58,11 +63,13 @@ Examples:
5863
### Before Submitting
5964

6065
1. **Run Tests**: Ensure all tests pass
66+
6167
```bash
6268
python -m pytest
6369
```
6470

6571
2. **Run Linting**: Fix any linting issues
72+
6673
```bash
6774
ruff check src
6875
black src
@@ -177,4 +184,5 @@ If you have questions about contributing, please:
177184

178185
## Thank You
179186

180-
Thank you for contributing to ContextForge Memory! Your contributions help make this project better for everyone.
187+
Thank you for contributing to ContextForge Memory! Your contributions help make
188+
this project better for everyone.

0 commit comments

Comments
 (0)