Přeskočit na obsah

Tato stránka byla automaticky přeložena z angličtiny, jediného jazyka, ve kterém se tento web píše. Číst originál.

Zaznamenat rozhodnutí jako data a dokázat, že ho nástroj nemůže přijmout za vás

Přečtěte rozhodnutí, která repozitář obsahuje, zvalidujte celou sadu jedním příkazem a sledujte, jak nástroj odmítne zapsat jediný stav, který smí zapsat jen člověk.

zaručeno Znalosti repozitářezákladnímaintaineragentzapisuje stav

Situace

Rozhodnutí, podle kterých repozitář žije, vznikla v konverzacích, které jsou do druhého rána pryč, a jediný záznam je odstavec v chat logu, který nikdo nenajde. Odůvodnění se ztratí první, takže za půl roku kód vypadá libovolně a někdo ho tiše vrátí.

Scénář

setup: adr-related
given:
  - 'Majordomus installed, with one decision proposed and committed'
  - 'discovery is over the tracked tree, so a decision git does not hold is not yet part of the layer'
steps:
  - id: what-was-decided
    run: ['adr', 'list']
    note: 'one line per decision: identity, status, date, title'
    expect:
      exit: 0
      stdout_contains: ['adr-0001', 'proposed']
  - id: the-record-itself
    run: ['adr', 'show', 'adr-0001']
    note: 'the path, then the file as written: the provenance says the tool derived it'
    expect:
      exit: 0
      stdout_contains: ['schema: adr/v1', 'origin: extracted', 'file:docs/d']
  - id: the-set-is-sound
    run: ['adr', 'check']
    note: 'identities, statuses, supersession and every reference, in one pass'
    expect:
      exit: 0
      stdout_contains: ['every identity unique']
  - id: what-it-put-in-force
    run: ['adr', 'show', 'adr-0001']
    note: 'related is the forward edge: the rule the decision declares, the file it reaches'
    expect:
      exit: 0
      stdout_contains: ['related:', 'rule:majordomus.adr-integrity']
  - id: the-graph-reads-it-backwards
    run: ['knowledge', 'edges', '--type', 'declares']
    note: 'the same fact as an edge, with the front-matter key that stated it as provenance; nothing wrote the reverse direction down'
    expect:
      exit: 0
      stdout_contains: ['adr:adr-0001', 'rule:majordomus.adr-integrity', 'related.0']
  - id: what-a-change-reaches
    run: ['adr', 'affected']
    note: 'the same edges read from a change set: which decisions this work touches. A clean tree reaches nothing, and the exit code never says a decision stopped holding'
    expect:
      exit: 0
      stdout_contains: ['no decision names anything this change set touches']
  - id: not-yours-to-choose
    run: ['adr', 'propose', 'A decision that accepts itself', '--status', 'accepted']
    note: 'the refusal that matters: a tool that can write accepted turns its inference into repository truth'
    expect:
      exit: 15
      stdout_contains: ['not yours to choose']
  - id: evidence-must-resolve
    run: ['adr', 'propose', 'A decision derived from a file nobody has', '--from', 'file:docs/nosuch']
    note: 'an extracted record without evidence is an assertion, and is refused as one'
    expect:
      exit: 2
      stdout_contains: ['names a path that does not exist']
then:
  - 'a reference a decision makes is validated where its type says the target lives'
  - 'the reverse direction is the graph read backwards, never a second list'
  - 'a change set names the decisions it reaches; whether they still hold is a person to read, not an exit code'
  - 'a decision is one validated file under .ai/repo/adrs/, discovered as data'
  - 'no invocation of the tool writes status accepted'

Výsledek

Rozhodnutí je soubor s identitou, kterou si nic jiného nenárokuje, s důkazy, ze kterých vzešlo, a se stavem, který jasně říká, zda jej člověk přijal. Nástroj navrhuje; přijímá jen člověk a příkazová řádka nemá jak říct jinak.

Scénář

Provedeno proti skutečnému nástroji v repozitáři připraveném pomocí adr-related, při každém generování tohoto webu. To, co následuje, není popis toho, co by se mělo stát; je to to, co se stalo.

dáno

  • Majordomus nainstalován, s jedním rozhodnutím navrženým a commitnutým
  • zjišťování probíhá nad sledovaným stromem, takže rozhodnutí, které git nedrží, ještě není součástí vrstvy

kdy

  1. 1majordomus adr list
  2. 2majordomus adr show adr-0001
  3. 3majordomus adr check
  4. 4majordomus adr show adr-0001
  5. 5majordomus knowledge edges --type declares
  6. 6majordomus adr affected
  7. 7majordomus adr propose A decision that accepts itself --status accepted
  8. 8majordomus adr propose A decision derived from a file nobody has --from file:docs/nosuch

pak

  • odkaz, který rozhodnutí činí, je validován tam, kde jeho typ říká, že cíl žije
  • opačný směr je graf čtený pozpátku, nikdy druhý seznam
  • sada změn jmenuje rozhodnutí, kterých se dotýká; zda stále platí, má číst člověk, ne návratový kód
  • rozhodnutí je jeden validovaný soubor v .ai/repo/adrs/, objevovaný jako data
  • žádné vyvolání nástroje nezapíše status accepted

Co nástroj udělal

Důkaz běhu, z něhož byla tato stránka vygenerována: pass, 8 kroků. Výstup je normalizován: cesta repozitáře, časová razítka, id a doby trvání jsou zástupné hodnoty; nic dalšího se neupravuje.

Testováno v test/cases/94_use_cases.sh, který spouští každý scénář a odmítne krok, jehož zaznamenaný výstup není tím, co vyprodukoval.

  1. jeden řádek na rozhodnutí: identita, stav, datum, název

    adr-0001   proposed    <date>  The registry is the one canonical declaration
    • exit 0
    • stdout_contains /adr-0001/
    • stdout_contains /proposed/
  2. cesta, pak soubor tak, jak byl zapsán: provenience říká, že jej nástroj odvodil

    .ai/repo/adrs/0001-the-registry-is-the-one-canonical-declaration.md
    
    ---
    schema: adr/v1
    id: adr-0001
    kind: adr
    title: The registry is the one canonical declaration
    status: proposed
    related:
      - rule:majordomus.adr-integrity
      - file:docs/d
    date: <date>
    tags:
      - architecture
    provenance:
      origin: extracted
      derived_from:
        - file:docs/d
    ---
    
    # 1. The registry is the one canonical declaration
    
    ## Context
    
    What forced the decision. Derived from:  file:docs/d.
    
    ## Decision
    
    The registry is the one canonical declaration
    
    ## Alternatives rejected
    
    What else was considered, and why it was not taken.
    
    ## Consequences
    
    What this costs, what it forecloses, and what now has to be true.
    • exit 0
    • stdout_contains /schema: adr/v1/
    • stdout_contains /origin: extracted/
    • stdout_contains /file:docs/d/
  3. identity, stavy, nahrazení a každý odkaz, v jednom průchodu

    examined 1 decision(s) in .ai/repo/adrs/
    every identity unique, every status known, every reference resolves
    0 identities added here, measured against main and every other ref
    • exit 0
    • stdout_contains /every identity unique/
  4. related je dopředná hrana: pravidlo, které rozhodnutí deklaruje, soubor, ke kterému sahá

    .ai/repo/adrs/0001-the-registry-is-the-one-canonical-declaration.md
    
    ---
    schema: adr/v1
    id: adr-0001
    kind: adr
    title: The registry is the one canonical declaration
    status: proposed
    related:
      - rule:majordomus.adr-integrity
      - file:docs/d
    date: <date>
    tags:
      - architecture
    provenance:
      origin: extracted
      derived_from:
        - file:docs/d
    ---
    
    # 1. The registry is the one canonical declaration
    
    ## Context
    
    What forced the decision. Derived from:  file:docs/d.
    
    ## Decision
    
    The registry is the one canonical declaration
    
    ## Alternatives rejected
    
    What else was considered, and why it was not taken.
    
    ## Consequences
    
    What this costs, what it forecloses, and what now has to be true.
    • exit 0
    • stdout_contains /related:/
    • stdout_contains /rule:majordomus.adr-integrity/
  5. týž fakt jako hrana, s klíčem front matter, který jej uvedl, jako proveniencí; opačný směr nezapsal nikdo

    declares        adr:adr-0001                                   rule:majordomus.adr-integrity                  .ai/repo/adrs/0001-the-registry-is-the-one-canonical-declaration.md:related.0
    knowledge edges: 1 in scope all, type declares
    INFO knowledge   . — the schema check was not asked for (MAJORDOMUS_KNOWLEDGE_SCHEMA=unasked), so no file was checked against the schema of its kind
    • exit 0
    • stdout_contains /adr:adr-0001/
    • stdout_contains /rule:majordomus.adr-integrity/
    • stdout_contains /related.0/
  6. tytéž hrany čtené ze sady změn: kterých rozhodnutí se tato práce dotýká. Čistý strom se nedotýká ničeho a exit kód nikdy neřekne, že rozhodnutí přestalo platit

    adr affected: no decision names anything this change set touches
    • exit 0
    • stdout_contains /no decision names anything this change set touches/
  7. odmítnutí, na kterém záleží: nástroj, který smí zapisovat přijaté, mění svou inferenci v pravdu repozitáře

    majordomus: adr propose: the status is not yours to choose; a proposed decision is accepted by a person editing the record
    • kód 15
    • stdout_contains /not yours to choose/
  8. extrahovaný záznam bez důkazu je tvrzení a jako takové se odmítá

    majordomus: adr propose: reference "file:docs/nosuch" names a path that does not exist
    • exit 2
    • stdout_contains /names a path that does not exist/

Proč to nástroj ví

Řetězec od této stránky ke kódu: případ užití jmenuje příkazy, pravidla a tvrzení; každé pravidlo se dispatchuje z registru a každé tvrzení jmenuje test, který ho dokazuje; scénář výše provedl příkazy. Nic v tomto řetězci není text o záměru.

Pravidla, díky nimž platí

Uplatněné záruky

Související případy užití

Vypočteno z toho, co sdílejí: tvrzení, pravidla, příkazy, kategorie, aplikace. Tento seznam nikdo neudržuje.

Okamžiky, na které to odpovídá

Prohledává názvy a popisy všech stránek, které tento web publikuje.