Feature: question catalog as rule pack type #136

Closed
opened 2026-10-12 20:03:31 +02:00 by michael · 5 comments
Owner

Goal

fragjan can represent structured question catalogs in addition to file checks.
First use case: taking over an IT lead role in an interim mandate --
prepare questions, record answers, generate a status report.

Decisions

  • Catalogs are regular packs (fragjan_pack/v1) with includes.questions
    next to includes.rules, installed like any other pack.
  • Own schema fragjan_question/v1 -- the rule schema is not extended
    (questions have no primitive and no severity).
  • The pack declares its allowed phases, audiences and sections
    under catalog:. The validator rejects unknown values; section order
    defines report order.
  • Answers live in a separate file next to the mandate
    (fragjan_answers/v1), never inside fragjan or var/rules/.
    Reasons: make upgrade-rules overwrites var/rules/, answers are
    confidential customer data, one catalog serves many mandates.
  • Implemented in the current code style (pre daw_error/v1).
    Migrated together with the rest of fragjan, not separately.

Schemas (minimal)

Question: question_id, text, area, phase, audience (list), section
Answers: pack_id, answers.<question_id>.status
(open|answered|not_applicable), answers.<question_id>.text

Commands

  • fragjan catalog list --pack <id> [--phase] [--area] [--audience]
  • fragjan catalog init --pack <id> <answers-file> -- template, all open
  • fragjan catalog report <answers-file> -- Markdown, grouped by section,
    open items at the end

Acceptance criteria

  • fragjan_question/v1 and fragjan_answers/v1 validated in core/validator/
  • Pack loader handles includes.questions and catalog: block
  • core/commands/catalog.lua with list, init, report
  • Unknown phase/audience/section/question_id -> hard error (exit 10)
  • Small test catalog in DAW/fragjan-templates
  • Tests pass on Lua 5.1 and 5.4

Out of scope

  • Content of the IT interim catalog (separate issue in DAW/fragjan-templates)
  • Interactive answer capture
  • Migration to daw_error/v1
## Goal fragjan can represent structured question catalogs in addition to file checks. First use case: taking over an IT lead role in an interim mandate -- prepare questions, record answers, generate a status report. ## Decisions - Catalogs are regular packs (`fragjan_pack/v1`) with `includes.questions` next to `includes.rules`, installed like any other pack. - Own schema `fragjan_question/v1` -- the rule schema is not extended (questions have no primitive and no severity). - The pack declares its allowed `phases`, `audiences` and `sections` under `catalog:`. The validator rejects unknown values; section order defines report order. - Answers live in a separate file next to the mandate (`fragjan_answers/v1`), never inside fragjan or `var/rules/`. Reasons: `make upgrade-rules` overwrites `var/rules/`, answers are confidential customer data, one catalog serves many mandates. - Implemented in the current code style (pre `daw_error/v1`). Migrated together with the rest of fragjan, not separately. ## Schemas (minimal) Question: `question_id`, `text`, `area`, `phase`, `audience` (list), `section` Answers: `pack_id`, `answers.<question_id>.status` (`open|answered|not_applicable`), `answers.<question_id>.text` ## Commands - `fragjan catalog list --pack <id> [--phase] [--area] [--audience]` - `fragjan catalog init --pack <id> <answers-file>` -- template, all `open` - `fragjan catalog report <answers-file>` -- Markdown, grouped by section, open items at the end ## Acceptance criteria - [x] `fragjan_question/v1` and `fragjan_answers/v1` validated in `core/validator/` - [x] Pack loader handles `includes.questions` and `catalog:` block - [x] `core/commands/catalog.lua` with `list`, `init`, `report` - [x] Unknown phase/audience/section/question_id -> hard error (exit 10) - [x] Small test catalog in `DAW/fragjan-templates` - [x] Tests pass on Lua 5.1 and 5.4 ## Out of scope - Content of the IT interim catalog (separate issue in `DAW/fragjan-templates`) - Interactive answer capture - Migration to `daw_error/v1`
Author
Owner

Scope update and final answers schema

Scope

  • #136 keeps: validator, loader, catalog list, catalog report
  • catalog init dropped -- answers file is created by catalog ask
  • Interactive capture moves to its own issue (blocked by daw-lua-common)

Why text moves out of YAML

daw.common.yaml 1.2.0 cannot round-trip multiline text: dump()
writes \n escapes that load() reads back literally, and block
scalars (|) make load() throw instead of returning nil, err.
Answer text therefore lives in Markdown files next to the answers file.

Answers schema (fragjan_answers/v1, still unreleased)

schema: fragjan_answers/v1
pack_id: it-interim
questions:                    # ad-hoc questions from the conversation
  - question_id: x-firewall-eol
    text: "When does firewall support end?"
    section: risiken          # must exist in catalog sections
answers:
  firewall-support:
    status: answered          # open | answered | not_applicable
    critical: true            # optional
    priority: A               # optional, Eisenhower A|B|C|D
    dates:                    # optional, facts from the answer, not tasks
      - date: 2026-09-30
        label: Maintenance contract notice period
      - date: 2027-03-31
        label: Firewall end of support
    text_file: antworten/firewall-support.md
    files: [docs/contract.pdf, https://wiki.example/firewall]
  • answered without text_file -> warning
  • date checked for format YYYY-MM-DD only
  • Existence of text_file / local files checked by the file layer,
    not the validator (missing -> warning)

Report blocks

  1. Critical: critical: true, A -> B -> C -> D -> none, then catalog order
  2. Dates: all dates, chronological, past dates marked
  3. Sections: catalog order
  4. Open items: open and unanswered questions

Notes for later (out of scope)

  • priority describes an answer, not a task. Splitting into
    findings/measures may follow.
  • answered means documented, not verified.
  • text = 123 style type questions for open answers not defined.
## Scope update and final answers schema ### Scope - #136 keeps: validator, loader, `catalog list`, `catalog report` - `catalog init` dropped -- answers file is created by `catalog ask` - Interactive capture moves to its own issue (blocked by daw-lua-common) ### Why text moves out of YAML `daw.common.yaml` 1.2.0 cannot round-trip multiline text: `dump()` writes `\n` escapes that `load()` reads back literally, and block scalars (`|`) make `load()` throw instead of returning `nil, err`. Answer text therefore lives in Markdown files next to the answers file. ### Answers schema (fragjan_answers/v1, still unreleased) ```yaml schema: fragjan_answers/v1 pack_id: it-interim questions: # ad-hoc questions from the conversation - question_id: x-firewall-eol text: "When does firewall support end?" section: risiken # must exist in catalog sections answers: firewall-support: status: answered # open | answered | not_applicable critical: true # optional priority: A # optional, Eisenhower A|B|C|D dates: # optional, facts from the answer, not tasks - date: 2026-09-30 label: Maintenance contract notice period - date: 2027-03-31 label: Firewall end of support text_file: antworten/firewall-support.md files: [docs/contract.pdf, https://wiki.example/firewall] ``` - `answered` without `text_file` -> warning - `date` checked for format YYYY-MM-DD only - Existence of `text_file` / local `files` checked by the file layer, not the validator (missing -> warning) ### Report blocks 1. Critical: `critical: true`, A -> B -> C -> D -> none, then catalog order 2. Dates: all `dates`, chronological, past dates marked 3. Sections: catalog order 4. Open items: `open` and unanswered questions ### Notes for later (out of scope) - `priority` describes an answer, not a task. Splitting into findings/measures may follow. - `answered` means documented, not verified. - `text = 123` style type questions for `open` answers not defined.
Author
Owner

Schema update: catalog sections are { id, title } in YAML block form only (flow maps like {id: x} parse silently wrong). Answers gain optional title and updated (YYYY-MM-DD, set by hand until #137).

Schema update: catalog sections are { id, title } in YAML block form only (flow maps like {id: x} parse silently wrong). Answers gain optional title and updated (YYYY-MM-DD, set by hand until #137).
Author
Owner

Done: catalog packs (loader, validators for catalog/questions/answers), catalog list and catalog report (Markdown file, default bericht.md next to answers). Deployment note: update fragjan before installing catalog packs -- older loaders fault on packs without includes.rules. Follow-ups: #137 (ask), #138 (loader cleanup), daw-lua-common#61, output via berhtjan.

Done: catalog packs (loader, validators for catalog/questions/answers), catalog list and catalog report (Markdown file, default bericht.md next to answers). Deployment note: update fragjan before installing catalog packs -- older loaders fault on packs without includes.rules. Follow-ups: #137 (ask), #138 (loader cleanup), daw-lua-common#61, output via berhtjan.
Author
Owner

Final notes:
(1) Correction to #7990 -- a referenced text_file that cannot be read is an error (no report written); only missing local evidence files are warnings.
(2) Acceptance criteria: validators, loader, init/list/report, exit 10 on unknown values and Lua 5.1/5.4 tests are done. catalog init restored: creates antworten.yaml (all questions open) and one Markdown template per question; manual workflow until #137. Test catalog lives as fixtures in fragjan test/fixtures/catalog instead of fragjan-templates.
(3) Critical points exclude not_applicable answers.
(4) Makefile: update-rules/upgrade-rules abort when var/rules and the system rules dir are the same symlinked directory.
(5) question_id restricted to letters, digits, - and _ (catalog and ad-hoc), since it becomes a file name in catalog init.

Final notes: (1) Correction to #7990 -- a referenced text_file that cannot be read is an error (no report written); only missing local evidence files are warnings. (2) Acceptance criteria: validators, loader, init/list/report, exit 10 on unknown values and Lua 5.1/5.4 tests are done. catalog init restored: creates antworten.yaml (all questions open) and one Markdown template per question; manual workflow until #137. Test catalog lives as fixtures in fragjan test/fixtures/catalog instead of fragjan-templates. (3) Critical points exclude not_applicable answers. (4) Makefile: update-rules/upgrade-rules abort when var/rules and the system rules dir are the same symlinked directory. (5) question_id restricted to letters, digits, - and _ (catalog and ad-hoc), since it becomes a file name in catalog init.
michael 2026-10-13 13:31:34 +02:00
Author
Owner

Update to (4) in #8026, superseded by d2847e7: installed rule packs are always copies (cp -rpL). upgrade-rules replaces a symlinked system rules dir with copies; update-rules aborts and make install warns if the system rules dir is a symlink. The dev var/rules symlink to fragjan-templates stays intended.

Update to (4) in #8026, superseded by d2847e7: installed rule packs are always copies (cp -rpL). upgrade-rules replaces a symlinked system rules dir with copies; update-rules aborts and make install warns if the system rules dir is a symlink. The dev var/rules symlink to fragjan-templates stays intended.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
DAW/fragjan#136
No description provided.