opaque_id 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.cursor/rules/create-prd.md +56 -0
- data/.cursor/rules/generate-tasks.md +60 -0
- data/.cursor/rules/process-task-list.md +47 -0
- data/.cursorignore +55 -0
- data/.release-please-manifest.json +3 -0
- data/.rubocop.yml +31 -0
- data/CHANGELOG.md +169 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +1602 -0
- data/Rakefile +12 -0
- data/lib/generators/opaque_id/install_generator.rb +57 -0
- data/lib/generators/opaque_id/templates/migration.rb.tt +6 -0
- data/lib/opaque_id/model.rb +130 -0
- data/lib/opaque_id/version.rb +5 -0
- data/lib/opaque_id.rb +58 -0
- data/release-please-config.json +55 -0
- data/sig/opaque_id.rbs +4 -0
- data/tasks/0001-prd-opaque-id-gem.md +202 -0
- data/tasks/0002-prd-publishing-release-automation.md +206 -0
- data/tasks/references/opaque_gem_requirements.md +482 -0
- data/tasks/references/original_identifiable_concern_and_nanoid.md +110 -0
- data/tasks/tasks-0001-prd-opaque-id-gem.md +109 -0
- data/tasks/tasks-0002-prd-publishing-release-automation.md +177 -0
- metadata +168 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1f4d5672d6b21c027f97ab270edb905e9bc63c3813c2a79a54c443f5fb348970
|
4
|
+
data.tar.gz: 6a6e7f794aa7e932de44459c4f6711d9d1629e62321623dcfbff31594b12b32b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 655395d357f1198bcda2293c09a805149323cd658f96554b1b2783fca7ddd5bceae0c31ab7f666080ebc3809a00e98006011990b8b4254c28721e19bcab37c77
|
7
|
+
data.tar.gz: 551ef07e9924648fe9d03b5f5980df15b14a7f90e1adcfdfb4bd0eef350c0f7f456bdc2adf0afcf6cbb5b905c51fc85c6d38d3aa278987643902f458703aae98
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Rule: Generating a Product Requirements Document (PRD)
|
2
|
+
|
3
|
+
## Goal
|
4
|
+
|
5
|
+
To guide an AI assistant in creating a detailed Product Requirements Document (PRD) in Markdown format, based on an initial user prompt. The PRD should be clear, actionable, and suitable for a junior developer to understand and implement the feature.
|
6
|
+
|
7
|
+
## Process
|
8
|
+
|
9
|
+
1. **Receive Initial Prompt:** The user provides a brief description or request for a new feature or functionality.
|
10
|
+
2. **Ask Clarifying Questions:** Before writing the PRD, the AI *must* ask clarifying questions to gather sufficient detail. The goal is to understand the "what" and "why" of the feature, not necessarily the "how" (which the developer will figure out). Make sure to provide options in letter/number lists so I can respond easily with my selections.
|
11
|
+
3. **Generate PRD:** Based on the initial prompt and the user's answers to the clarifying questions, generate a PRD using the structure outlined below.
|
12
|
+
4. **Save PRD:** Save the generated document as `[n]-prd-[feature-name].md` inside the `/tasks` directory. (Where `n` is a zero-padded 4-digit sequence starting from 0001, e.g., `0001-prd-user-authentication.md`, `0002-prd-dashboard.md`, etc.)
|
13
|
+
|
14
|
+
## Clarifying Questions (Examples)
|
15
|
+
|
16
|
+
The AI should adapt its questions based on the prompt, but here are some common areas to explore:
|
17
|
+
|
18
|
+
* **Problem/Goal:** "What problem does this feature solve for the user?" or "What is the main goal we want to achieve with this feature?"
|
19
|
+
* **Target User:** "Who is the primary user of this feature?"
|
20
|
+
* **Core Functionality:** "Can you describe the key actions a user should be able to perform with this feature?"
|
21
|
+
* **User Stories:** "Could you provide a few user stories? (e.g., As a [type of user], I want to [perform an action] so that [benefit].)"
|
22
|
+
* **Acceptance Criteria:** "How will we know when this feature is successfully implemented? What are the key success criteria?"
|
23
|
+
* **Scope/Boundaries:** "Are there any specific things this feature *should not* do (non-goals)?"
|
24
|
+
* **Data Requirements:** "What kind of data does this feature need to display or manipulate?"
|
25
|
+
* **Design/UI:** "Are there any existing design mockups or UI guidelines to follow?" or "Can you describe the desired look and feel?"
|
26
|
+
* **Edge Cases:** "Are there any potential edge cases or error conditions we should consider?"
|
27
|
+
|
28
|
+
## PRD Structure
|
29
|
+
|
30
|
+
The generated PRD should include the following sections:
|
31
|
+
|
32
|
+
1. **Introduction/Overview:** Briefly describe the feature and the problem it solves. State the goal.
|
33
|
+
2. **Goals:** List the specific, measurable objectives for this feature.
|
34
|
+
3. **User Stories:** Detail the user narratives describing feature usage and benefits.
|
35
|
+
4. **Functional Requirements:** List the specific functionalities the feature must have. Use clear, concise language (e.g., "The system must allow users to upload a profile picture."). Number these requirements.
|
36
|
+
5. **Non-Goals (Out of Scope):** Clearly state what this feature will *not* include to manage scope.
|
37
|
+
6. **Design Considerations (Optional):** Link to mockups, describe UI/UX requirements, or mention relevant components/styles if applicable.
|
38
|
+
7. **Technical Considerations (Optional):** Mention any known technical constraints, dependencies, or suggestions (e.g., "Should integrate with the existing Auth module").
|
39
|
+
8. **Success Metrics:** How will the success of this feature be measured? (e.g., "Increase user engagement by 10%", "Reduce support tickets related to X").
|
40
|
+
9. **Open Questions:** List any remaining questions or areas needing further clarification.
|
41
|
+
|
42
|
+
## Target Audience
|
43
|
+
|
44
|
+
Assume the primary reader of the PRD is a **junior developer**. Therefore, requirements should be explicit, unambiguous, and avoid jargon where possible. Provide enough detail for them to understand the feature's purpose and core logic.
|
45
|
+
|
46
|
+
## Output
|
47
|
+
|
48
|
+
* **Format:** Markdown (`.md`)
|
49
|
+
* **Location:** `/tasks/`
|
50
|
+
* **Filename:** `[n]-prd-[feature-name].md`
|
51
|
+
|
52
|
+
## Final instructions
|
53
|
+
|
54
|
+
1. Do NOT start implementing the PRD
|
55
|
+
2. Make sure to ask the user clarifying questions
|
56
|
+
3. Take the user's answers to the clarifying questions and improve the PRD
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Rule: Generating a Task List from a PRD
|
2
|
+
|
3
|
+
## Goal
|
4
|
+
|
5
|
+
To guide an AI assistant in creating a detailed, step-by-step task list in Markdown format based on an existing Product Requirements Document (PRD). The task list should guide a developer through implementation.
|
6
|
+
|
7
|
+
## Output
|
8
|
+
|
9
|
+
- **Format:** Markdown (`.md`)
|
10
|
+
- **Location:** `/tasks/`
|
11
|
+
- **Filename:** `tasks-[prd-file-name].md` (e.g., `tasks-0001-prd-user-profile-editing.md`)
|
12
|
+
|
13
|
+
## Process
|
14
|
+
|
15
|
+
1. **Receive PRD Reference:** The user points the AI to a specific PRD file
|
16
|
+
2. **Analyze PRD:** The AI reads and analyzes the functional requirements, user stories, and other sections of the specified PRD.
|
17
|
+
3. **Assess Current State:** Review the existing codebase to understand existing infrastructre, architectural patterns and conventions. Also, identify any existing components or features that already exist and could be relevant to the PRD requirements. Then, identify existing related files, components, and utilities that can be leveraged or need modification.
|
18
|
+
4. **Phase 1: Generate Parent Tasks:** Based on the PRD analysis and current state assessment, create the file and generate the main, high-level tasks required to implement the feature. Use your judgement on how many high-level tasks to use. It's likely to be about five tasks. Present these tasks to the user in the specified format (without sub-tasks yet). Inform the user: "I have generated the high-level tasks based on the PRD. Ready to generate the sub-tasks? Respond with 'Go' to proceed."
|
19
|
+
5. **Wait for Confirmation:** Pause and wait for the user to respond with "Go".
|
20
|
+
6. **Phase 2: Generate Sub-Tasks:** Once the user confirms, break down each parent task into smaller, actionable sub-tasks necessary to complete the parent task. Ensure sub-tasks logically follow from the parent task, cover the implementation details implied by the PRD, and consider existing codebase patterns where relevant without being constrained by them.
|
21
|
+
7. **Identify Relevant Files:** Based on the tasks and PRD, identify potential files that will need to be created or modified. List these under the `Relevant Files` section, including corresponding test files if applicable.
|
22
|
+
8. **Generate Final Output:** Combine the parent tasks, sub-tasks, relevant files, and notes into the final Markdown structure.
|
23
|
+
9. **Save Task List:** Save the generated document in the `/tasks/` directory with the filename `tasks-[prd-file-name].md`, where `[prd-file-name]` matches the base name of the input PRD file (e.g., if the input was `0001-prd-user-profile-editing.md`, the output is `tasks-0001-prd-user-profile-editing.md`).
|
24
|
+
|
25
|
+
## Output Format
|
26
|
+
|
27
|
+
The generated task list _must_ follow this structure:
|
28
|
+
|
29
|
+
```markdown
|
30
|
+
## Relevant Files
|
31
|
+
|
32
|
+
- `path/to/potential/file1.ts` - Brief description of why this file is relevant (e.g., Contains the main component for this feature).
|
33
|
+
- `path/to/file1.test.ts` - Unit tests for `file1.ts`.
|
34
|
+
- `path/to/another/file.tsx` - Brief description (e.g., API route handler for data submission).
|
35
|
+
- `path/to/another/file.test.tsx` - Unit tests for `another/file.tsx`.
|
36
|
+
- `lib/utils/helpers.ts` - Brief description (e.g., Utility functions needed for calculations).
|
37
|
+
- `lib/utils/helpers.test.ts` - Unit tests for `helpers.ts`.
|
38
|
+
|
39
|
+
### Notes
|
40
|
+
|
41
|
+
- Unit tests should typically be placed alongside the code files they are testing (e.g., `MyComponent.tsx` and `MyComponent.test.tsx` in the same directory).
|
42
|
+
- Use `npx jest [optional/path/to/test/file]` to run tests. Running without a path executes all tests found by the Jest configuration.
|
43
|
+
|
44
|
+
## Tasks
|
45
|
+
|
46
|
+
- [ ] 1.0 Parent Task Title
|
47
|
+
- [ ] 1.1 [Sub-task description 1.1]
|
48
|
+
- [ ] 1.2 [Sub-task description 1.2]
|
49
|
+
- [ ] 2.0 Parent Task Title
|
50
|
+
- [ ] 2.1 [Sub-task description 2.1]
|
51
|
+
- [ ] 3.0 Parent Task Title (may not require sub-tasks if purely structural or configuration)
|
52
|
+
```
|
53
|
+
|
54
|
+
## Interaction Model
|
55
|
+
|
56
|
+
The process explicitly requires a pause after generating parent tasks to get user confirmation ("Go") before proceeding to generate the detailed sub-tasks. This ensures the high-level plan aligns with user expectations before diving into details.
|
57
|
+
|
58
|
+
## Target Audience
|
59
|
+
|
60
|
+
Assume the primary reader of the task list is a **junior developer** who will implement the feature with awareness of the existing codebase context.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Task List Management
|
2
|
+
|
3
|
+
Guidelines for managing task lists in markdown files to track progress on completing a PRD
|
4
|
+
|
5
|
+
## Task Implementation
|
6
|
+
- **One sub-task at a time:** Do **NOT** start the next sub‑task until you ask the user for permission and they say "yes" or "y"
|
7
|
+
- **Completion protocol:**
|
8
|
+
1. When you finish a **sub‑task**, immediately mark it as completed by changing `[ ]` to `[x]`.
|
9
|
+
2. If **all** subtasks underneath a parent task are now `[x]`, follow this sequence:
|
10
|
+
- **First**: Run the full test suite (`pytest`, `npm test`, `bin/rails test`, etc.)
|
11
|
+
- **Only if all tests pass**: Stage changes (`git add .`)
|
12
|
+
- **Clean up**: Remove any temporary files and temporary code before committing
|
13
|
+
- **Commit**: Use a descriptive commit message that:
|
14
|
+
- Uses conventional commit format (`feat:`, `fix:`, `refactor:`, etc.)
|
15
|
+
- Summarizes what was accomplished in the parent task
|
16
|
+
- Lists key changes and additions
|
17
|
+
- References the task number and PRD context
|
18
|
+
- **Formats the message as a single-line command using `-m` flags**, e.g.:
|
19
|
+
|
20
|
+
```
|
21
|
+
git commit -m "feat: add payment validation logic" -m "- Validates card type and expiry" -m "- Adds unit tests for edge cases" -m "Related to T123 in PRD"
|
22
|
+
```
|
23
|
+
3. Once all the subtasks are marked completed and changes have been committed, mark the **parent task** as completed.
|
24
|
+
- Stop after each sub‑task and wait for the user's go‑ahead.
|
25
|
+
|
26
|
+
## Task List Maintenance
|
27
|
+
|
28
|
+
1. **Update the task list as you work:**
|
29
|
+
- Mark tasks and subtasks as completed (`[x]`) per the protocol above.
|
30
|
+
- Add new tasks as they emerge.
|
31
|
+
|
32
|
+
2. **Maintain the "Relevant Files" section:**
|
33
|
+
- List every file created or modified.
|
34
|
+
- Give each file a one‑line description of its purpose.
|
35
|
+
|
36
|
+
## AI Instructions
|
37
|
+
|
38
|
+
When working with task lists, the AI must:
|
39
|
+
|
40
|
+
1. Regularly update the task list file after finishing any significant work.
|
41
|
+
2. Follow the completion protocol:
|
42
|
+
- Mark each finished **sub‑task** `[x]`.
|
43
|
+
- Mark the **parent task** `[x]` once **all** its subtasks are `[x]`.
|
44
|
+
3. Add newly discovered tasks.
|
45
|
+
4. Keep "Relevant Files" accurate and up to date.
|
46
|
+
5. Before starting work, check which sub‑task is next.
|
47
|
+
6. After implementing a sub‑task, update the file and then pause for user approval.
|
data/.cursorignore
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# === Ignore build / generated artifacts & temp ===
|
2
|
+
/log/
|
3
|
+
/tmp/
|
4
|
+
/vendor/bundle/
|
5
|
+
/node_modules/
|
6
|
+
/public/packs/
|
7
|
+
/public/assets/
|
8
|
+
/coverage/
|
9
|
+
/spec/tmp/
|
10
|
+
/test/tmp/
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ruby gem build artifacts
|
15
|
+
*.gem
|
16
|
+
pkg/
|
17
|
+
/pkg/*
|
18
|
+
|
19
|
+
# Rails / Ruby cached / compiled files
|
20
|
+
*.rbc
|
21
|
+
*.sassc
|
22
|
+
*.css.map
|
23
|
+
.byebug_history
|
24
|
+
.rspec_local_profile
|
25
|
+
sinatra.cache
|
26
|
+
|
27
|
+
# config / secrets / credentials
|
28
|
+
/config/credentials.yml.enc
|
29
|
+
/config/master.key
|
30
|
+
.env
|
31
|
+
.env.*
|
32
|
+
*.key
|
33
|
+
*.pem
|
34
|
+
*.cert
|
35
|
+
|
36
|
+
# IDE / editor / OS noise
|
37
|
+
/.idea/
|
38
|
+
/.vscode/
|
39
|
+
/*.swp
|
40
|
+
/*.swo
|
41
|
+
.DS_Store
|
42
|
+
Thumbs.db
|
43
|
+
|
44
|
+
# Cursor local state except for rules / modes
|
45
|
+
.cursor/*
|
46
|
+
!/.cursor/rules/
|
47
|
+
!/.cursor/modes/
|
48
|
+
|
49
|
+
# Additional gem-specific ignores
|
50
|
+
*.gem
|
51
|
+
/pkg/
|
52
|
+
Gemfile.lock
|
53
|
+
|
54
|
+
# Optional: If you expect cursorindexing-specific control:
|
55
|
+
# you might also add entries to `.cursorindexingignore` (inherited from gitignore) per docs
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
SuggestExtensions: false
|
4
|
+
|
5
|
+
# Disable some cops that are too strict for this gem
|
6
|
+
Style/Documentation:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Metrics/MethodLength:
|
10
|
+
Max: 15
|
11
|
+
Exclude:
|
12
|
+
- "test/**/*"
|
13
|
+
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 20
|
16
|
+
Exclude:
|
17
|
+
- "test/**/*"
|
18
|
+
|
19
|
+
Metrics/ModuleLength:
|
20
|
+
Max: 120
|
21
|
+
|
22
|
+
Metrics/BlockLength:
|
23
|
+
Max: 70
|
24
|
+
|
25
|
+
Metrics/ClassLength:
|
26
|
+
Max: 200
|
27
|
+
Exclude:
|
28
|
+
- "test/**/*"
|
29
|
+
|
30
|
+
Gemspec/DevelopmentDependencies:
|
31
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to the OpaqueId gem will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [1.1.0](https://github.com/nyaggah/opaque_id/compare/opaque_id-v1.0.2...opaque_id/v1.1.0) (2025-10-02)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* initial release of OpaqueId gem v0.1.0 ([3a90274](https://github.com/nyaggah/opaque_id/commit/3a9027403552f8160e3aaf413d1e99ce8c63bbe4))
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* add Release Please manifest and update workflow configuration ([f33ce6c](https://github.com/nyaggah/opaque_id/commit/f33ce6c96805b6c670cd1eedf5ebed2a46e8ffa6))
|
19
|
+
* add required permissions for Release Please job ([cdf8d2b](https://github.com/nyaggah/opaque_id/commit/cdf8d2bfc5dbea9a9ec40411a988191ba91913fa))
|
20
|
+
* improve publish workflow trigger reliability ([9c6e240](https://github.com/nyaggah/opaque_id/commit/9c6e2402474d8ecf8a3f754a9f2ca149a63bf1d1))
|
21
|
+
* improve statistical test reliability for CI ([c9b0d52](https://github.com/nyaggah/opaque_id/commit/c9b0d52fb4e9559aad489fcf58bdff1917d613a6))
|
22
|
+
* remove unsupported Release Please configuration parameters ([e3b0d2a](https://github.com/nyaggah/opaque_id/commit/e3b0d2ac96b905316a78992004fae83423991632))
|
23
|
+
* resolve dependency version conflicts and improve test robustness ([af43e13](https://github.com/nyaggah/opaque_id/commit/af43e13393a452f11ce32bafb26a267d1460736c))
|
24
|
+
|
25
|
+
|
26
|
+
### Miscellaneous Chores
|
27
|
+
|
28
|
+
* **main:** release 1.0.0 ([43282c5](https://github.com/nyaggah/opaque_id/commit/43282c5865aae3f136c9eaa49f013066a2359826))
|
29
|
+
* **main:** release 1.0.0 ([b8271ad](https://github.com/nyaggah/opaque_id/commit/b8271ad43cf6fab4687276258f0105c06a87bff7))
|
30
|
+
* **main:** release 1.0.1 ([4ee2e2c](https://github.com/nyaggah/opaque_id/commit/4ee2e2c69905e71d6c5048617af09b65cbb9e12a))
|
31
|
+
* **main:** release 1.0.1 ([e6cd2f8](https://github.com/nyaggah/opaque_id/commit/e6cd2f8f8ff545ad3010598488f71956e36a88c5))
|
32
|
+
* **main:** release 1.0.2 ([d5c7423](https://github.com/nyaggah/opaque_id/commit/d5c7423cf06ae7638d95cdd29b2631049efed727))
|
33
|
+
* **main:** release 1.0.2 ([365dff8](https://github.com/nyaggah/opaque_id/commit/365dff87a044aa967906866d6ace8d1ccad08c78))
|
34
|
+
* sync version to 1.0.2 ([2f870c8](https://github.com/nyaggah/opaque_id/commit/2f870c89d486f0a5cda8ef37e5544c29c8fa2919))
|
35
|
+
* update author name and GitHub URLs ([e911548](https://github.com/nyaggah/opaque_id/commit/e911548e89e1e60ac3281157059f7c7b812750bd))
|
36
|
+
* update bundle and add Linux platform support ([661842f](https://github.com/nyaggah/opaque_id/commit/661842f0ba66ce36962bb11f75a1b0e35eb5a3e7))
|
37
|
+
|
38
|
+
|
39
|
+
### Code Refactoring
|
40
|
+
|
41
|
+
* integrate Release Please into main CI workflow ([8a0b189](https://github.com/nyaggah/opaque_id/commit/8a0b189a8bfbfcc07275c9bdda3397ff367b2054))
|
42
|
+
|
43
|
+
## [1.0.2](https://github.com/nyaggah/opaque_id/compare/v1.0.1...v1.0.2) (2025-10-02)
|
44
|
+
|
45
|
+
|
46
|
+
### Bug Fixes
|
47
|
+
|
48
|
+
* remove unsupported Release Please configuration parameters ([e3b0d2a](https://github.com/nyaggah/opaque_id/commit/e3b0d2ac96b905316a78992004fae83423991632))
|
49
|
+
|
50
|
+
## [1.0.1](https://github.com/nyaggah/opaque_id/compare/v1.0.0...v1.0.1) (2025-10-02)
|
51
|
+
|
52
|
+
|
53
|
+
### Bug Fixes
|
54
|
+
|
55
|
+
* improve publish workflow trigger reliability ([9c6e240](https://github.com/nyaggah/opaque_id/commit/9c6e2402474d8ecf8a3f754a9f2ca149a63bf1d1))
|
56
|
+
* improve statistical test reliability for CI ([c9b0d52](https://github.com/nyaggah/opaque_id/commit/c9b0d52fb4e9559aad489fcf58bdff1917d613a6))
|
57
|
+
|
58
|
+
## 1.0.0 (2025-10-02)
|
59
|
+
|
60
|
+
|
61
|
+
### Features
|
62
|
+
|
63
|
+
* initial release of OpaqueId gem v0.1.0 ([3a90274](https://github.com/nyaggah/opaque_id/commit/3a9027403552f8160e3aaf413d1e99ce8c63bbe4))
|
64
|
+
|
65
|
+
|
66
|
+
### Bug Fixes
|
67
|
+
|
68
|
+
* resolve dependency version conflicts and improve test robustness ([af43e13](https://github.com/nyaggah/opaque_id/commit/af43e13393a452f11ce32bafb26a267d1460736c))
|
69
|
+
|
70
|
+
## [Unreleased]
|
71
|
+
|
72
|
+
### Added
|
73
|
+
|
74
|
+
- Nothing yet
|
75
|
+
|
76
|
+
### Changed
|
77
|
+
|
78
|
+
- Nothing yet
|
79
|
+
|
80
|
+
### Deprecated
|
81
|
+
|
82
|
+
- Nothing yet
|
83
|
+
|
84
|
+
### Removed
|
85
|
+
|
86
|
+
- Nothing yet
|
87
|
+
|
88
|
+
### Fixed
|
89
|
+
|
90
|
+
- Nothing yet
|
91
|
+
|
92
|
+
### Security
|
93
|
+
|
94
|
+
- Nothing yet
|
95
|
+
|
96
|
+
## [0.1.0] - 2025-01-XX
|
97
|
+
|
98
|
+
### Added
|
99
|
+
|
100
|
+
- **Core ID Generation**: Secure, collision-free ID generation using Ruby's `SecureRandom`
|
101
|
+
- **Fast Path Algorithm**: Optimized bitwise operations for 64-character alphabets
|
102
|
+
- **Unbiased Path Algorithm**: Rejection sampling for other alphabet sizes to eliminate modulo bias
|
103
|
+
- **ActiveRecord Integration**: `OpaqueId::Model` concern for automatic ID generation
|
104
|
+
- **Rails Generator**: `opaque_id:install` generator for easy setup
|
105
|
+
- **Built-in Alphabets**: `ALPHANUMERIC_ALPHABET` (62 chars) and `STANDARD_ALPHABET` (64 chars)
|
106
|
+
- **Configuration Options**: Customizable ID length, alphabet, letter start requirement, character purging
|
107
|
+
- **Finder Methods**: `find_by_opaque_id` and `find_by_opaque_id!` for model lookups
|
108
|
+
- **Collision Handling**: Automatic retry with configurable max attempts
|
109
|
+
- **Error Classes**: `OpaqueId::Error`, `OpaqueId::ConfigurationError`, `OpaqueId::GenerationError`
|
110
|
+
- **Comprehensive Test Suite**: Minitest-based tests covering core functionality, ActiveRecord integration, and generators
|
111
|
+
- **Performance Benchmarks**: Statistical uniformity tests and performance measurements
|
112
|
+
- **Security Features**: Cryptographically secure random generation, unbiased distribution
|
113
|
+
- **Documentation**: Complete README with usage examples, security considerations, and use cases
|
114
|
+
|
115
|
+
### Technical Details
|
116
|
+
|
117
|
+
- **Ruby Compatibility**: Requires Ruby 3.2.0 or higher
|
118
|
+
- **Rails Compatibility**: Requires Rails 8.0 or higher
|
119
|
+
- **Dependencies**: ActiveRecord, ActiveSupport
|
120
|
+
- **Performance**: ~2.5M IDs/sec for 64-character alphabets, ~1.2M IDs/sec for other alphabets
|
121
|
+
- **Collision Resistance**: 2^126 possible combinations for 21-character STANDARD_ALPHABET IDs
|
122
|
+
- **Memory Usage**: ~21 bytes per ID, consistent across all algorithms
|
123
|
+
|
124
|
+
### Security
|
125
|
+
|
126
|
+
- Uses Ruby's `SecureRandom` for cryptographically secure entropy
|
127
|
+
- Implements rejection sampling to eliminate modulo bias
|
128
|
+
- Provides non-sequential, unpredictable IDs
|
129
|
+
- Includes comprehensive security guidelines and best practices
|
130
|
+
- Supports configurable ID lengths for different security requirements
|
131
|
+
|
132
|
+
### Documentation
|
133
|
+
|
134
|
+
- Complete installation and setup instructions
|
135
|
+
- Detailed usage examples for standalone and ActiveRecord integration
|
136
|
+
- Comprehensive configuration options documentation
|
137
|
+
- Security considerations and threat model analysis
|
138
|
+
- Real-world use case examples (e-commerce, APIs, CMS, etc.)
|
139
|
+
- Performance benchmarks and optimization tips
|
140
|
+
- Development and contribution guidelines
|
141
|
+
- MIT License with full legal details
|
142
|
+
|
143
|
+
### Testing
|
144
|
+
|
145
|
+
- **Core Module Tests**: ID generation, error handling, edge cases
|
146
|
+
- **ActiveRecord Integration Tests**: Model callbacks, finder methods, configuration
|
147
|
+
- **Generator Tests**: Migration generation, model modification
|
148
|
+
- **Performance Tests**: Statistical uniformity validation
|
149
|
+
- **Error Handling Tests**: Invalid inputs, collision scenarios
|
150
|
+
- **RuboCop Integration**: Code quality and style enforcement
|
151
|
+
|
152
|
+
### Generator Features
|
153
|
+
|
154
|
+
- **Migration Generation**: Creates `opaque_id` column with unique index
|
155
|
+
- **Model Modification**: Automatically adds `include OpaqueId::Model`
|
156
|
+
- **Customizable Options**: Column name, alphabet, length configuration
|
157
|
+
- **Error Handling**: Graceful handling of missing models or invalid arguments
|
158
|
+
- **Console Output**: Color-coded success and error messages
|
159
|
+
|
160
|
+
### Breaking Changes
|
161
|
+
|
162
|
+
- None (initial release)
|
163
|
+
|
164
|
+
### Migration Notes
|
165
|
+
|
166
|
+
- This is the initial release of OpaqueId
|
167
|
+
- No migration from previous versions required
|
168
|
+
- Compatible with Rails 8.0+ applications
|
169
|
+
- Requires Ruby 3.2.0 or higher
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
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.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Joe Nyaggah
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|