Skip to content

Dev#15

Merged
Iktahana merged 59 commits intomainfrom
dev
Feb 13, 2026
Merged

Dev#15
Iktahana merged 59 commits intomainfrom
dev

Conversation

@Iktahana
Copy link
Copy Markdown
Member

@Iktahana Iktahana commented Feb 12, 2026

Summary by CodeRabbit

  • Chores
    • Revised API endpoint paths from /api/v1/namespaces/ to /api/v1/namespace/ across all namespace operations, including collections management, namespace information retrieval, and card verification functionality.
    • Updated corresponding API documentation, specifications, quick-start guides, and test routes to reflect the new singular namespace path format.

- Use build version variables (commit, date) in startup log
- Fix octal literals to use 0o prefix (Go 1.13+ style)
- Add proper error checking for deferred Close() calls
- Fix variable shadowing issues
- Add documentation comments for exported types/variables
- Add nolint directives for intentional code patterns
- Update .golangci.yml to remove deprecated options
- Format all code with gofmt/goimports

All golangci-lint checks now pass successfully.
- Update all Go version references from '1.25' to '1.25.5'
- Install golangci-lint using 'go install' instead of action
- This ensures golangci-lint is built with Go 1.25.5, matching project requirements

Fixes error: 'the Go language version (go1.24) used to build golangci-lint
is lower than the targeted Go version (1.25.5)'
- Create detailed project scope and objectives
- Design 4-phase roadmap with clear milestones
- Document API endpoint architecture and design
- Establish quality assurance and testing strategy
- Include risk management and contingency plans
- Define success criteria and KPIs
- Provide resource planning and communication strategy
- Implement GET /api/v1/kv/{namespace}/{collection}/{key} to retrieve values
- Implement POST /api/v1/kv/{namespace}/{collection}/{key} to set values
- Implement DELETE /api/v1/kv/{namespace}/{collection}/{key} to remove keys
- Implement HEAD /api/v1/kv/{namespace}/{collection}/{key} to check key existence
- Add request/response structures with proper error handling
- Add comprehensive unit tests for all CRUD operations
- Validate input parameters and normalize namespace
- Return standardized JSON responses with timestamps
- Achieve 81.8% test coverage for handlers package
- Implement POST /api/v1/kv/batch for batch set operations
- Implement DELETE /api/v1/kv/batch for batch delete operations
- Implement GET /api/v1/kv/{namespace}/{collection} for listing keys (returns not-implemented)
- Add batch operation request/response structures
- Add comprehensive error handling with detailed result tracking
- Support up to 1000 operations per batch request
- Add full test coverage for batch operations
- Include integer parsing helper function for query parameters
- Implement GET /api/v1/namespaces for listing namespaces (returns not-implemented)
- Implement GET /api/v1/namespaces/{namespace}/collections for listing collections
- Implement GET /api/v1/namespaces/{namespace}/info for namespace information
- Implement DELETE /api/v1/namespaces/{namespace} for deleting namespaces
- Implement DELETE /api/v1/namespaces/{namespace}/collections/{collection} for deleting collections
- Add comprehensive request/response structures for namespace operations
- Include full test coverage for all namespace management endpoints
- Validate input parameters and return appropriate error responses
- Add OpenAPI 3.0 specification with all endpoints defined
  - Include request/response schemas
  - Document error codes and status codes
  - Add operation IDs for code generation
- Create API quick-start guide for 5-minute setup
  - Cover all CRUD operations
  - Include batch operation examples
  - Show data organization (namespace/collection)
  - Document error handling and limits
- Add detailed API examples in multiple languages
  - Python with requests library
  - JavaScript/Node.js with fetch API
  - Real-world scenarios (sessions, config, cache)
  - Error handling patterns
- Document completion of all core API endpoints (12 operations)
- Summarize 75.8% test coverage for handlers
- Report on 2,217 lines of technical documentation created
- Analyze test coverage metrics and identify gaps
- List known limitations and backend-specific features
- Provide recommendations for Phases 2-4
- Include performance characteristics from unit tests
- Track 5 atomic commits for Phase 1 work
- Create comprehensive documentation index
- Add quick reference for common operations
- Document all 12 endpoints with examples
- Include data organization guide (namespace/collection/key)
- Add configuration reference
- Document supported data types and limits
- Include troubleshooting section
- Link to all related documentation
- Add project status and phase information
…uide

- Add DATABASE selection option (bbolt/mongodb/redis)
- Document BBolt configuration with DATA_PATH
- Add MongoDB connection URI format and examples
- Add Redis URI format with authentication examples
- Include configuration examples for different use cases
  - Development (local BBolt)
  - Production edge device (BBolt)
  - Cloud deployment (MongoDB)
  - High-performance (Redis)
- Add quick start guide for setup
- Document database backend comparison with pros/cons
- Explain data organization for each backend
- Provide clear comments and examples
Create comprehensive, token-efficient AI rules structure:

Main index (.clinerules):
- Project overview and quick reference
- Tech stack and constraints summary
- Links to detailed rule modules
- Universal rules that always apply
- Current phase tracking
- Quick commands reference

Detailed rules (.ai-rules/):
1. 01-code-style.md - Go best practices, naming, formatting
2. 02-git-workflow.md - Atomic commits, conventional commits
3. 03-testing.md - Test patterns, coverage requirements
4. 04-api-design.md - REST principles, handler patterns
5. 05-database.md - KV interface, backend implementations
6. 06-documentation.md - Code docs, API docs, examples
7. 07-performance.md - Edge optimization, profiling
8. 08-security.md - Input validation, error handling

Benefits:
- Modular structure reduces token usage
- Load only relevant rules as needed
- Easy to maintain and update
- Clear separation of concerns
- Comprehensive coverage of all aspects

Total: ~15,000 lines of detailed guidance
- Explain modular structure and usage
- Document all 8 rule categories
- Provide quick reference guide
- Include statistics and benefits
- Add maintenance guidelines
- Link to related documentation
Add detailed architecture documentation covering:

System Architecture:
- High-level architecture diagram
- Component architecture with layers
- Package structure visualization
- Technology stack overview

Data Flow:
- GET request flow sequence
- POST request flow sequence
- Batch operation flow
- Request/response lifecycle

Database Architecture:
- Three backend implementations (BBolt/Redis/MongoDB)
- Data organization comparison
- Storage mapping for each backend
- Connection pooling strategies

Deployment Architecture:
- Edge device deployment (Raspberry Pi + BBolt)
- Cloud deployment (Load balancer + MongoDB/Redis)
- Hybrid deployment (Edge + Cloud sync)
- Resource usage targets

Security Architecture:
- Security layers and controls
- Authentication flow (future)
- Input validation strategy
- Error sanitization

Design Principles:
- SOLID principles application
- Hexagonal architecture pattern
- Factory and dependency injection
- Repository pattern

All diagrams in Mermaid format for:
- Version control friendly
- Easy to update
- Renders in GitHub/GitLab
- Clean and professional visualization
Iktahana and others added 25 commits February 3, 2026 14:44
… body

BREAKING CHANGE: Card verification endpoints redesigned

New Standard API:
- POST /api/v1/namespaces/:namespace
- Header: X-Device-SN (device serial number)
- Body: plain text card number
- Response: 204 No Content (success) / Status only (error, no body)

Legacy vguang-m350 API (maintained for compatibility):
- POST /api/v1/namespaces/:namespace/device/:device_name
- Body: plain text or binary card number
- Response: 200 'code=0000' (success) / 404 (error, no body)
- Special handling: alphanumeric → uppercase, binary → reversed hex

Removed endpoints:
- GET /api/v1/namespaces/:namespace/device/:device_sn/card/:card_number
- GET /api/v1/namespaces/:namespace/device/:device_sn/card/:card_number/vguang-350

Changes:
- Rewrite card.go handlers for POST endpoints
- Update route registration in main.go
- Rewrite card_test.go with new POST test cases
- Update API documentation with new endpoint specs
- Add parseVguangCardNumber() for binary card handling
- Error responses now status code only (logged to console)
- All existing tests passing
…nary entries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace 9 verbose rule files with 4 focused guides:
- important.md: mandatory rules (English only, no secrets, tests, conventional commits)
- 01-patterns.md: project-specific handler, response, and KV patterns
- 02-testing.md: table-driven test structure with MockKV
- 03-guidelines.md: git workflow, security, performance, and documentation

Simplify .clinerules to a concise quick reference.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix unparam, gocritic, ineffassign, staticcheck, revive, unused, and
errcheck linter violations to pass CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	.github/workflows/ci.yml
#	.github/workflows/release.yml
#	cmd/server/main.go
#	docs/open-graph/repository-open-graph.png
#	docs/open-graph/repository-open-graph.psd
#	go.mod
#	go.sum
#	internal/config/config.go
#	internal/config/config_test.go
#	internal/database/bbolt/bbolt.go
#	internal/database/example.go
#	internal/database/mongodb/mongodb.go
#	internal/database/redis/redis.go
#	internal/handlers/config.go
#	internal/handlers/health.go
#	internal/models/card.go
- release.yml: use build output tarball directly instead of docker save
- .gitignore: add .env.* and .env.*.local patterns
- batch.go: replace custom parseStringToInt with strconv.Atoi
- kv.go: use json.Marshal consistently in marshalJSON

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Avoids malformed image name like username/org/repo by using
github.event.repository.name instead of github.repository.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update from outdated Access Authorization Service docs to accurately
describe the KV storage abstraction with BBolt/MongoDB/Redis backends,
current API routes, Docker deployment, and BSL 1.1 license.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use DOCKER_TOKEN instead of DOCKER_PASSWORD for Docker Hub auth
- Add permissions block to push-dockerhub job for consistency
- Add language specifier to fenced code blocks in README

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 12, 2026 14:01
Copy link
Copy Markdown

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.

Copilot wasn't able to review any files in this pull request.


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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 13, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR updates API endpoint paths across the codebase from plural namespaces to singular namespace. All references to /api/v1/namespaces/{namespace} are systematically changed to /api/v1/namespace/{namespace} in route definitions, handlers, tests, and documentation files.

Changes

Cohort / File(s) Summary
Route Definitions & Handlers
cmd/server/main.go, internal/handlers/namespace.go, internal/handlers/card.go
Updated route path literals from /api/v1/namespaces/{namespace} to /api/v1/namespace/{namespace} in route registrations and handler comments for namespace management and card verification endpoints.
Handler Tests
internal/handlers/namespace_test.go, internal/handlers/card_test.go
Updated route paths in test fixtures and HTTP request URLs from plural namespaces to singular namespace to match new endpoint definitions.
API Documentation
docs/api-specification.yaml, docs/PHASE1_COMPLETION.md, docs/PROJECT_MANAGEMENT_PLAN.md, docs/README.md, docs/mvp-card-verification.md, docs/api-quickstart.md
Updated all documented endpoint paths from /api/v1/namespaces/{namespace} to /api/v1/namespace/{namespace} in narrative descriptions, examples, and OpenAPI specification.
Configuration & Rules
.ai-rules/01-patterns.md, README.md
Updated AI pattern rules and main README examples to reflect singular namespace path in documented curl commands and API examples.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A path once tangled, now made clear,
From namespaces plural to singular here,
Each endpoint renamed with careful care,
Consistency flowing through routes everywhere! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands and usage tips.

@Iktahana Iktahana merged commit 967c8b3 into main Feb 13, 2026
4 of 5 checks passed
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