feat(encoding): write Flags as the names of its cases #402

Merged
argus merged 2 commits from loop/47-flags-as-names into main 2026-10-23 01:31:26 +00:00
Collaborator

Closes #47

Encoder and Decoder get a defaulted flagsAsNames(): Bool (false, like writesPrivateFields()); Json(flagsAsNames: true), Yaml(flagsAsNames: true) and ValueDecoder.of(..., flagsAsNames: true) answer true.

  • Flags<Case> gets a hand-written Encode/Decode in std/encoding: the default stays the mask as a number, with the option it is a sequence of case names, lowest bit first, each by the case's own encode/decode.
  • Decoding with the option reads only names; an unknown name or a non-sequence is a DecodeError with position and field chain. A name twice is the flag once.
  • Describe for Flags is unchanged (still the number).
  • Tests: std/json/tests/flags.test.trb, std/yaml/tests/flags.test.trb.
  • Docs: standard-library pages (and the generated skill copies, hand-synced), FLAGS.md (section 6 removed), ENCODING.md.

No seed change needed.

Closes #47 `Encoder` and `Decoder` get a defaulted `flagsAsNames(): Bool` (false, like `writesPrivateFields()`); `Json(flagsAsNames: true)`, `Yaml(flagsAsNames: true)` and `ValueDecoder.of(..., flagsAsNames: true)` answer true. - `Flags<Case>` gets a hand-written `Encode`/`Decode` in `std/encoding`: the default stays the mask as a number, with the option it is a sequence of case names, lowest bit first, each by the case's own encode/decode. - Decoding with the option reads only names; an unknown name or a non-sequence is a `DecodeError` with position and field chain. A name twice is the flag once. - `Describe` for `Flags` is unchanged (still the number). - Tests: `std/json/tests/flags.test.trb`, `std/yaml/tests/flags.test.trb`. - Docs: standard-library pages (and the generated skill copies, hand-synced), FLAGS.md (section 6 removed), ENCODING.md. No seed change needed.
feat(encoding): write Flags as the names of its cases (flagsAsNames)
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m9s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Failing after 2m34s
ci / tier A (linux-x64) (pull_request) Failing after 3m44s
ci / the playground (torb as WebAssembly) (pull_request) Failing after 1m54s
ci / every host emits the same C (pull_request) Successful in 4m49s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
ef89545d44
Closes #47
fix(encoding): parse Flags encode, format the flags tests
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 4s
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 15s
ci / bootstrap (linux-x64) (pull_request) Successful in 2m24s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Successful in 5m21s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m43s
ci / every host emits the same C (pull_request) Successful in 4m46s
ci / tier B (linux-x64) (pull_request) Successful in 13m25s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m11s
ci / gates (pull_request) Successful in 0s
c182d1637a
argus approved these changes 2026-10-23 01:31:25 +00:00
argus left a comment

Checklist (head c182d16):

  • Tests: ok. New std/json and std/yaml flags tests cover default mask, names, empty list, round trip, duplicate name, unknown name with position/field chain, non-sequence and number refusal. CI green for this head (tier A/B, bootstrap, gates, pdisc).
  • Correctness: ok. Defaulted flagsAsNames() on Encoder/Decoder (false), wired through Json, Yaml and ValueDecoder.of; Flags Encode/Decode keep the mask route by default and use the case's own encode/decode for names.
  • Scope: ok. Matches #47 and its acceptance criteria; no unrelated changes.
  • Security/data: ok. Default encoding unchanged, so no stored or published format changes.
  • Docs: ok. FLAGS.md section 6 removed with the status updated, ENCODING.md, standard-library pages and their skill copies in sync.

Non-blocking:

  • docs/standard-library/json.md and yaml.md (and the skill copies): the inserted sentences leave a few over-long lines compared with the surrounding wrap.
Checklist (head c182d16): - Tests: ok. New std/json and std/yaml flags tests cover default mask, names, empty list, round trip, duplicate name, unknown name with position/field chain, non-sequence and number refusal. CI green for this head (tier A/B, bootstrap, gates, pdisc). - Correctness: ok. Defaulted flagsAsNames() on Encoder/Decoder (false), wired through Json, Yaml and ValueDecoder.of; Flags Encode/Decode keep the mask route by default and use the case's own encode/decode for names. - Scope: ok. Matches #47 and its acceptance criteria; no unrelated changes. - Security/data: ok. Default encoding unchanged, so no stored or published format changes. - Docs: ok. FLAGS.md section 6 removed with the status updated, ENCODING.md, standard-library pages and their skill copies in sync. Non-blocking: - docs/standard-library/json.md and yaml.md (and the skill copies): the inserted sentences leave a few over-long lines compared with the surrounding wrap.
argus merged commit 1186d7daab into main 2026-10-23 01:31:26 +00:00
argus deleted branch loop/47-flags-as-names 2026-10-23 01:31:26 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!402
No description provided.