Skip to content

Dev#13

Merged
Iktahana merged 54 commits intomainfrom
dev
Feb 10, 2026
Merged

Dev#13
Iktahana merged 54 commits intomainfrom
dev

Conversation

@Iktahana
Copy link
Copy Markdown
Member

@Iktahana Iktahana commented Feb 10, 2026

Summary by CodeRabbit

  • Chores
    • Updated Docker Hub publishing workflow configuration to use revised credential secrets, enabling improved secret management for Docker image releases.

- 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 21 commits February 3, 2026 13:55
- Comment out all KV CRUD routes for MVP focus
- Add MongoDB client getter to MongoDBKV adapter
- Create Device and Card data models with validation logic
- Implement CardService with business logic for card verification
  * Device existence and active status checks
  * Card lookup and device authorization validation
  * Time-based validity checks with ±60s NTP drift tolerance
- Add HTTP handlers for card verification endpoints
  * Standard endpoint: GET /api/v1/namespaces/:namespace/device/:device_sn/card/:card_number (204 No Content)
  * vguang-350 compatibility endpoint with plain text '0000' response
- Add comprehensive unit tests for models and handlers
- All existing tests pass, build successful
- Complete API endpoint reference with examples
- Verification logic steps with tolerance explanation
- MongoDB data structure specifications
- Configuration and testing guide
- Troubleshooting section
- Future enhancement suggestions
… 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>
Copilot AI review requested due to automatic review settings February 10, 2026 01:19
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 10, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

A push-dockerhub job has been added to the release workflow, enabling Docker image pushes to Docker Hub after the build stage. The job now uses updated secret names (DOCKER_USERNAME and DOCKER_PASSWORD) instead of the previous naming convention.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/release.yml
Enabled push-dockerhub job with Docker Buildx, artifact download, image load, tag, and push steps. Updated Docker Hub authentication to use DOCKER_USERNAME and DOCKER_PASSWORD secrets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop, hop! The Docker containers race,
To Hub they're pushed with newfound grace,
Secrets renamed, the workflow spins,
Each release now Docker-ly wins! 🐳✨

✨ Finishing touches
🧪 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 6c9ecf4 into main Feb 10, 2026
4 checks passed
@Iktahana Iktahana review requested due to automatic review settings March 23, 2026 21:19
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