Remove application credential substitution

This commit is contained in:
2026-11-16 03:37:29 +00:00
parent e34672f7fe
commit ffe0e3491e
37 changed files with 217 additions and 729 deletions

View File

@@ -5,8 +5,6 @@ import (
"html"
"sort"
"strings"
"gitea.maximumdirect.net/eric/audita/v3/internal/core/redaction"
)
// CompletionLine is the brief successful CLI summary. It uses the same counts
@@ -24,12 +22,10 @@ func count(value *int) int {
}
// Markdown renders a fixed-layout human report from one processing snapshot.
func Markdown(snapshot Snapshot, secrets ...string) []byte {
r := redaction.New(secrets)
safe := func(value string) string { return escapeMarkdown(r.String(value)) }
func Markdown(snapshot Snapshot) []byte {
var b strings.Builder
fmt.Fprintf(&b, "# Audita report: %s\n\n", safe(snapshot.RunID))
fmt.Fprintf(&b, "Status: %s\n\n", safe(snapshot.Status))
fmt.Fprintf(&b, "# Audita report: %s\n\n", escapeMarkdown(snapshot.RunID))
fmt.Fprintf(&b, "Status: %s\n\n", escapeMarkdown(snapshot.Status))
fmt.Fprintf(&b, "Corrections applied: %d \n", count(snapshot.Summary.CorrectionsApplied))
fmt.Fprintf(&b, "Work units: %s total; %s completed; %s interrupted; %s not started \n",
showCount(snapshot.Summary.WorkUnitsTotal), showCount(snapshot.Summary.WorkUnitsCompleted),
@@ -38,20 +34,20 @@ func Markdown(snapshot Snapshot, secrets ...string) []byte {
fmt.Fprintf(&b, "Recoveries: %s of %s model operations \n", showCount(snapshot.Summary.Recoveries), showCount(snapshot.Summary.LLMOperations))
fmt.Fprintf(&b, "Proposal responses: %s; with filtering: %s\n\n",
showCount(snapshot.Summary.ProposalResponses), showCount(snapshot.Summary.ProposalResponsesWithFiltering))
fmt.Fprintf(&b, "Transcript input: %s \n", safe(snapshot.TranscriptPath))
fmt.Fprintf(&b, "Transcript input: %s \n", escapeMarkdown(snapshot.TranscriptPath))
output := snapshot.OutputPath
if output == "" {
output = "stdout"
}
fmt.Fprintf(&b, "Transcript output: %s\n\n", safe(output))
fmt.Fprintf(&b, "Transcript output: %s\n\n", escapeMarkdown(output))
fmt.Fprintln(&b, "## Work-unit errors")
fmt.Fprintln(&b)
writeMatrix(&b, snapshot, r, false)
writeMatrix(&b, snapshot, false)
fmt.Fprintln(&b)
fmt.Fprintln(&b, "## Recoveries")
fmt.Fprintln(&b)
writeMatrix(&b, snapshot, r, true)
writeMatrix(&b, snapshot, true)
fmt.Fprintln(&b)
if len(snapshot.RepairOutcomes) > 0 {
fmt.Fprintln(&b, "## Correction repair")
@@ -59,14 +55,14 @@ func Markdown(snapshot Snapshot, secrets ...string) []byte {
fmt.Fprintln(&b, "| Stage | Chunk | Proposal index | Attempts | Outcome |")
fmt.Fprintln(&b, "| ---: | ---: | ---: | ---: | --- |")
for _, row := range snapshot.RepairOutcomes {
fmt.Fprintf(&b, "| %d | %d | %d | %d | %s |\n", row.StageIndex+1, row.ChunkIndex+1, row.ProposalIndex, row.Attempts, safe(row.Outcome))
fmt.Fprintf(&b, "| %d | %d | %d | %d | %s |\n", row.StageIndex+1, row.ChunkIndex+1, row.ProposalIndex, row.Attempts, escapeMarkdown(row.Outcome))
}
fmt.Fprintln(&b)
}
fmt.Fprintln(&b, "Legend: `—` = not started; `n*` = interrupted with n recorded errors or recoveries. Completed error cells are 0 or 1.")
fmt.Fprintln(&b)
writeReasons(&b, "Error reasons", errorReasons(snapshot.Errors), safe)
writeReasons(&b, "Recovery reasons", recoveryReasons(snapshot.Recoveries), safe)
writeReasons(&b, "Error reasons", errorReasons(snapshot.Errors))
writeReasons(&b, "Recovery reasons", recoveryReasons(snapshot.Recoveries))
fmt.Fprintln(&b, "A recovery can have multiple reasons; reason counts need not sum to the recovery total.")
fmt.Fprintln(&b)
fmt.Fprintln(&b, "Details: `errors.yml` and `recoveries.yml`.")
@@ -80,7 +76,7 @@ func showCount(value *int) string {
return fmt.Sprint(*value)
}
func writeMatrix(b *strings.Builder, snapshot Snapshot, redactor redaction.Redactor, recovery bool) {
func writeMatrix(b *strings.Builder, snapshot Snapshot, recovery bool) {
if len(snapshot.StageNames) == 0 || len(snapshot.WorkUnits) == 0 {
fmt.Fprintln(b, "No work units.")
return
@@ -88,7 +84,7 @@ func writeMatrix(b *strings.Builder, snapshot Snapshot, redactor redaction.Redac
columns := snapshot.StageNames
fmt.Fprint(b, "| Chunk |")
for _, name := range columns {
fmt.Fprintf(b, " %s |", stageCellEscaper.Replace(html.EscapeString(redactor.String(name))))
fmt.Fprintf(b, " %s |", stageCellEscaper.Replace(html.EscapeString(name)))
}
fmt.Fprint(b, "\n| --- |")
for range columns {
@@ -137,7 +133,7 @@ var stageCellEscaper = strings.NewReplacer(
"://", "://", "www.", "www.", "@", "@",
)
func writeReasons(b *strings.Builder, title string, counts map[string]int, safe func(string) string) {
func writeReasons(b *strings.Builder, title string, counts map[string]int) {
fmt.Fprintf(b, "### %s\n\n", title)
if len(counts) == 0 {
fmt.Fprintln(b, "None.")
@@ -150,7 +146,7 @@ func writeReasons(b *strings.Builder, title string, counts map[string]int, safe
}
sort.Strings(keys)
for _, key := range keys {
fmt.Fprintf(b, "- `%s`: %d\n", safe(key), counts[key])
fmt.Fprintf(b, "- `%s`: %d\n", escapeMarkdown(key), counts[key])
}
fmt.Fprintln(b)
}