Make great documentation goal 1.2, and plan the README's reorganisation and the nested-template gaps #33

Open
lilleman wants to merge 966 commits from worktree-todo-relative-dates-exact-counts into main
3 changed files with 26 additions and 20 deletions
Showing only changes of commit eee7572360 - Show all commits
+12 -13
View File
@@ -889,8 +889,7 @@ Where the project is heading; the sections before Audience document what ships t
1. It covers the ten most-spoken languages and the Nordic countries.
2. Each locale covers the common categories: names, addresses, phone numbers, ids,
companies and dates.
3. A library gets only the data and functions it hands to `New`, and fejkdata's own
load the same way as anyone else's.
3. A library gets only the data and the module functions it is handed.
3. **The code is easy to understand.**
1. You can go from a bug to the code behind it without asking anyone.
2. You can change one part without keeping the rest in your head.
@@ -919,35 +918,35 @@ Where the project is heading; the sections before Audience document what ships t
1. A template that could render a value its own rules forbid, such as `NaN` or `Inf`,
fails to load instead.
2. Data that reads something nobody provided fails to load, and the error names the
package that provides it by default.
module that provides it by default, or says that none does.
7. **One command gets you a value.**
1. Flags work like in other command-line tools, and can go anywhere on the line.
2. Your first template of your own needs no escaping and no options.
3. The CLI fills in what you leave out with a sane default: all the shipped data, the
system's randomness and today's date.
8. **Data is JSON files and TSV tables. Code is only for what they can't express.**
9. **Everything is replaceable.** Data, functions, and the packages they depend on can
come from fejkdata or anyone else.
1. A package names the packages it reads by default, and anything providing the same
9. **Everything is replaceable.** Data, functions and the modules they come in can come
from fejkdata or anyone else.
1. A module names the modules it reads by default, and anything providing the same
paths can stand in for one.
2. Loading two things under one name fails, in the library and the CLI alike, unless
you say the second replaces the first.
3. The template language's own functions stay in the core, so a template means the
same in every program.
4. A function loaded from a package can ask for the input it needs, and gets the
3. The builtins ship with fejkdata itself, so a template means the same in every
program.
4. A function loaded from a module can ask for the input it needs, and gets the
randomness and the date the generator uses.
5. A CLI carrying your own packages is a few lines of Go, and works just like
5. A CLI carrying your own modules is a few lines of Go, and works just like
`fejkdata`.
10. **The same seed, version and data always give the same output.**
1. A library call takes everything that can change its output from its caller: data,
1. In the library, the caller supplies everything that can change the output: data,
randomness and the date.
11. **It depends on nothing but Go's standard library.**
12. **The docs are a map of the template language.**
1. Every feature has its own heading.
2. Every example runs as a test and shows its output.
3. Each rule is stated in one place.
13. **It is fast enough that you never notice with the shipped data, and its cost grows
with the data a render reaches, not with all the data loaded.**
13. **It is fast enough that you never notice it with the shipped data.**
1. A render's cost grows only with the data it reaches.
14. **Every fact comes from an official or open source,** such as a government
register.
1. A table holds every row its source holds, and nothing added by hand.
+4
View File
@@ -134,6 +134,8 @@ set, against goal 13, until `todo.md` item 79 ends it.
Valid while CI proves the shipped set whole and each category alone.
Works against goal 2.3 until `todo.md` item 77 ends it.
## A bare reference draws each time; a reference path is held
2026-09-02, Lilleman auf Larv.
@@ -231,6 +233,8 @@ references read. Accepted: overriding is the point of layering, the error names
reference and the field, and the fix is the consumer's file carrying the fields the
shipped tree reads.
Works against goal 9.2 until `todo.md` item 77 ends it.
## The repeat cap bounds renders, not bytes
2026-09-02, Lilleman auf Larv.
+10 -7
View File
@@ -54,6 +54,7 @@
| 12.2 | 0.45 |
| 12.3 | 0.45 |
| 13 | 0.40 |
| 13.1 | 0.40 |
| 14 | 0.35 |
| 14.1 | 0.35 |
| 15 | 0.30 |
@@ -146,14 +147,14 @@
### 77. Split the shipped data into Go modules per locale and country, which a library imports by choice, and embed every one in the CLI.
The CLI binary carries every module and may grow to hundreds of MB; a library imports only what it uses, as it imports any dependency, and nothing is fetched at run time. The maintainer decided on 2026-10-04, under goals 2.3, 6.2, 7.3, 9 and 10.1:
The CLI binary may grow to hundreds of MB. The maintainer decided on 2026-10-04, under goals 2.3, 6.2, 7.3, 9 and 10.1:
- One module per locale, one per country's `geo/` tree, and one for `misc`. A module registers nothing when imported.
- A bare `New()` loads no data, and its error names the option to add. `WithoutShippedData` goes.
- A data module is an `fs.FS` passed to `WithDataFS`, as anyone's data is, and several load at once. A module carrying functions loads through an option of its own; gaining one is a breaking change for that module's users.
- A module names, in a manifest, what it reads and the module providing each by default. Nothing loads a default on its own: loading fails naming it, and anything providing the same paths stands in.
- Two sources defining one name fail to load, unless an option says the second replaces the first. The CLI's `--data-path` takes `--replace` to override a shipped category. This revises the decisions "A `--data-path` override rebinds every reference to the category it replaces" and "With only the shipped set, a category loads on the first call reaching it; beside a `--data-path`, every category loads in `New`".
- The template language's builtins stay in the core. A module's function asks for the inputs it needs through one generic mechanism, and gets the randomness and the date the generator uses. The README strongly encourages functions with no side effects of their own.
- The CLI is a library call, so a custom CLI carrying other modules is a few lines of Go and works just like `fejkdata`. A README section shows it with example code.
- A bare `New()` loads no data and fails, naming the option to add. `WithoutShippedData` goes.
- A data module is an `fs.FS` passed to `WithDataFS`, as anyone's data is, and `New` takes several. A module carrying functions loads through an option of its own, so a data module that starts carrying functions breaks its users.
- A module names, in a manifest, every module it reads by default, directly or through another, so the first error names the whole set to import. Nothing loads a default on its own: loading fails naming it, and anything providing the same paths stands in.
- Two sources defining one name fail to load, unless an option says the second replaces the first. In the CLI, a flag standing on its own, benched with the data and hand fixture authors, does the same for a `--data-path`, so flags still go anywhere on the line. This revises the decisions "A `--data-path` override rebinds every reference to the category it replaces" and "With only the shipped set, a category loads on the first call reaching it; beside a `--data-path`, every category loads in `New`".
- The builtins stay in fejkdata itself. A module's function asks for the inputs it needs through one generic mechanism, and gets the randomness and the date the generator uses. The README asks for functions with no side effects of their own.
- The CLI is a library call, so a custom CLI carrying other modules is a few lines of Go and works just like `fejkdata`. A README section shows it with example code, and the README's Library quick start shows the whole import block for one locale.
Split it into items before starting. Before the module API ships, a panel of the README's audience personas tries pulling in data with it.
@@ -264,6 +265,8 @@ Needs item 4.
### 79. Beside a `--data-path`, load in `New` the user's categories, the shipped ones they override or read, and the shipped ones whose reads reach an overridden one; load the rest on first reach.
Needs item 77, which makes an override fail unless it says it replaces.
The decision "With only the shipped set, a category loads on the first call reaching it; beside a `--data-path`, every category loads in `New`" parses the whole shipped set on every `--data-path` run, about 45 ms today and seconds once items 61 and 78 land. Goal 6 needs only the user's categories, the shipped ones they override, the shipped ones they read, and the shipped ones whose reads reach an overridden category, so the index would carry each category's reads.
### 87. Split the README's last Records paragraph into one paragraph per rule, name the two shapes "either shape" means, and define or replace "a field hold".