Introduces `code.nochebuena.dev/einherjar/core` — the foundational implementation module of the Einherjar framework. Provides four sub-packages that together cover every service's baseline needs: lifecycle management, structured logging, typed errors, and struct validation. - launcher: Launcher interface — three-phase managed lifecycle (OnInit → BeforeStart hooks → OnStart → OS signal wait → OnStop in reverse). Accepts lifecycle.Component and logging.Logger from contracts. Prints an ASCII art banner at startup (EINHERJAR_BANNER=off to suppress). Banner includes core version via runtime/debug.ReadBuildInfo() and a loaded-module list for every registered component that implements observability.Identifiable. Config struct with EINHERJAR_COMPONENT_STOP_TIMEOUT env tag (caarlos0/env syntax, default 15s). - logz: Logger implementation backed by log/slog. Returns contracts/logging.Logger. Detects errs.CodedError and errs.ContextualError (from contracts/errs) to enrich log records automatically — replaces the private duck-typed bridge from micro-lib. Context helpers: WithRequestID, WithField, WithFields, GetRequestID. Config struct with EINHERJAR_LOG_LEVEL (default INFO) and EINHERJAR_LOG_JSON (default false) env tags (caarlos0/env syntax); programmatic-only fields StaticArgs and Writer carry no tags. - xerrors: Typed error codes with context enrichment. Complete gRPC canonical set (16 codes) plus HTTP 410 ErrGone. Adds ErrOutOfRange, ErrAborted, ErrDataLoss over micro-lib. One convenience constructor per code. *Err declares compile-time satisfaction of errs.CodedError and errs.ContextualError. - valid: Struct validation wrapping go-playground/validator/v10. Validator interface + MessageProvider interface with full built-in tag coverage (~150 tags) in both DefaultMessages (English) and SpanishMessages (Spanish). Backend fully hidden; returns *xerrors.Err with ErrInvalidInput or ErrInternal. FieldLevel interface abstracts the backend's field-level access for custom validators. WithCustomValidator registers custom validation tags at construction time; OverrideProvider chains a tag→handler map with a fallback MessageProvider for custom tag messages without re-implementing built-ins. Compliance test enforces CT-6 (at most one exported TypeSpec per file via AST) and verifies behavioural correctness of all four sub-packages, including custom validator registration and OverrideProvider composition. Compile-time var _ assertions prove interface satisfaction. docs: ADR-001 (core module composition), ADR-002 (logz contracts/errs adoption), ADR-003 (Config naming convention and caarlos0/env tag standard)
91 lines
4.7 KiB
Markdown
91 lines
4.7 KiB
Markdown
# Contributor License Agreement
|
|
|
|
By contributing to any Einherjar repository, you agree to the terms of this Contributor License Agreement ("Agreement"). Please read it carefully before submitting your first Pull Request.
|
|
|
|
---
|
|
|
|
## 1. Definitions
|
|
|
|
| Term | Meaning |
|
|
|---|---|
|
|
| **You** | The individual or legal entity submitting a Contribution |
|
|
| **Contribution** | Any original work — source code, documentation, tests, configuration — submitted to an Einherjar repository |
|
|
| **Project** | The Einherjar framework and all repositories under `code.nochebuena.dev/einherjar/` |
|
|
| **Maintainers** | The individuals responsible for maintaining the Project |
|
|
|
|
---
|
|
|
|
## 2. You Retain Ownership
|
|
|
|
This Agreement does **not** transfer your copyright to the Maintainers. You remain the legal owner of your Contribution. What you grant here is a broad license to use it — not ownership of it.
|
|
|
|
---
|
|
|
|
## 3. Copyright License Grant
|
|
|
|
You grant the Maintainers and all recipients of the Project a **perpetual, worldwide, non-exclusive, royalty-free, irrevocable** license to:
|
|
|
|
- Reproduce, modify, and create derivative works of your Contribution
|
|
- Publicly display and perform your Contribution
|
|
- Distribute your Contribution and derivative works, in source or compiled form, under any terms
|
|
- Sublicense the above rights to third parties
|
|
- **Relicense** your Contribution under a different open-source or commercial license at the Maintainers' sole discretion
|
|
|
|
The Maintainers commit to keeping the Project available under at least one OSI-approved open-source license at all times.
|
|
|
|
---
|
|
|
|
## 4. Patent License Grant
|
|
|
|
You grant the Maintainers and all recipients of the Project a **perpetual, worldwide, non-exclusive, royalty-free, irrevocable** patent license to make, use, sell, offer for sale, import, and distribute your Contribution — limited to patent claims you own or control that are necessarily infringed by your Contribution alone, or in combination with the Project to which you submitted it.
|
|
|
|
---
|
|
|
|
## 5. Your Representations
|
|
|
|
By submitting a Contribution, you confirm that:
|
|
|
|
1. **Original work.** The Contribution is your original work, or you have the legal right to submit it under these terms.
|
|
2. **No infringement.** To your knowledge, the Contribution does not infringe any third-party intellectual property rights, including patents, copyrights, and trade secrets.
|
|
3. **Employer rights.** If your employer holds rights over intellectual property you create, you have obtained written permission to submit the Contribution on behalf of that employer, or your employer has explicitly waived such rights for contributions to open-source projects.
|
|
4. **No warranty implied.** You understand that your Contribution may or may not be included in the Project, and the Maintainers are under no obligation to use it.
|
|
|
|
---
|
|
|
|
## 6. No Support Obligation
|
|
|
|
You are not required to provide maintenance, support, or updates for your Contributions. They are accepted **"as-is"**, without any warranty of fitness for a particular purpose or correctness.
|
|
|
|
---
|
|
|
|
## 7. How to Sign
|
|
|
|
Consent is given by **posting a comment** on your Pull Request with the following exact text:
|
|
|
|
```
|
|
I have read the Einherjar Contributor License Agreement (CLA.md) and I agree to all its terms.
|
|
I confirm this Contribution is my original work. I grant the Maintainers the rights described
|
|
therein, including the right to relicense, and I retain ownership of my copyright.
|
|
This agreement covers all future Contributions I submit to any Einherjar repository under
|
|
this account.
|
|
```
|
|
|
|
**Why a comment and not a checkbox?**
|
|
PR description checkboxes can be silently toggled on and off by anyone with write access to the branch at any time. A comment creates a timestamped, author-attributed record in the PR activity log — it cannot be quietly retracted. If a comment is deleted, the deletion itself is visible in the activity log.
|
|
|
|
No handwritten or electronic signature is required beyond the comment above. A Maintainer will verify the comment before merging. PRs without the comment will not be merged.
|
|
|
|
If you are contributing on behalf of a company or organization, ensure that an authorized representative of that entity has reviewed and accepted these terms before submitting. The comment must be posted by the account that owns the Contribution.
|
|
|
|
---
|
|
|
|
## 8. Governing Terms
|
|
|
|
This Agreement is intended to be simple and broadly fair. It follows the model established by widely adopted CLAs from the Apache Software Foundation, Google, and MongoDB — granting the Project the flexibility to evolve while fully preserving your ownership of what you wrote.
|
|
|
|
If any provision of this Agreement is found unenforceable, the remaining provisions continue in full effect.
|
|
|
|
---
|
|
|
|
*For those who come after. — The Einherjar Maintainers*
|