Normalize internal component documentation
This commit is contained in:
@@ -1,27 +1,46 @@
|
||||
# Link URL Policy
|
||||
|
||||
Audience: developers and LLM coding agents changing `internal/link`.
|
||||
|
||||
## Purpose
|
||||
|
||||
`internal/link` defines shared validation for configured and persisted HTTP link URLs.
|
||||
`internal/link` owns shared validation for configured and persisted HTTP link URLs.
|
||||
|
||||
## Inputs and outputs
|
||||
## Inputs And Outputs
|
||||
|
||||
Input is a URL string. Output is either nil for an accepted URL or a concise validation error that callers wrap with field context.
|
||||
|
||||
## Validation behavior
|
||||
|
||||
Accepted URLs must parse successfully, use `http` or `https`, include a host, and omit query strings and fragments.
|
||||
|
||||
## Boundaries
|
||||
|
||||
This package validates URL shape only. It does not construct destination output URLs, choose primary URLs, infer public URLs from backend configuration, or read configuration files.
|
||||
The package validates URL shape only. It does not construct output URLs, choose primary URLs, infer public URLs from backend configuration, parse config files, or write destination state.
|
||||
|
||||
## Tests
|
||||
## Config Fields Used
|
||||
|
||||
Before changing link URL policy, inspect tests under `internal/link` and callers in `internal/config`, `internal/state`, and `internal/publish`.
|
||||
The package does not read config directly. `internal/config` uses it to validate `links.base_url`; `internal/state` uses it to validate persisted `links.primary_url` and output `url` fields.
|
||||
|
||||
## Invariants
|
||||
## Adapters Used
|
||||
|
||||
- Configured `links.base_url`, persisted `links.primary_url`, persisted output `url`, and publish link planning use the same URL policy.
|
||||
None.
|
||||
|
||||
## State And Manifest Behavior
|
||||
|
||||
Destination state URL fields and configured link URLs share the same URL validation policy. Source manifests are not involved.
|
||||
|
||||
## Skip And Resume Behavior
|
||||
|
||||
None.
|
||||
|
||||
## Failure Behavior
|
||||
|
||||
Validation rejects parse failures, non-HTTP(S) schemes, missing hosts, query strings, and fragments.
|
||||
|
||||
## Tests To Inspect
|
||||
|
||||
- `internal/link/url_test.go`
|
||||
- callers in `internal/config`, `internal/state`, and `internal/publish`
|
||||
|
||||
## Architectural Invariants
|
||||
|
||||
- Configured and persisted link URLs use one validation policy.
|
||||
- URL construction remains outside `internal/link`.
|
||||
- Callers own field-specific error context.
|
||||
- URL path construction remains in `internal/publish`.
|
||||
|
||||
Reference in New Issue
Block a user