quince: reconcile through the tool, write the facets, and adopt gitea.md
The whole loop ran on a real change with a cart open for the first time: check staged externals.md as a polad, apply moved it and its lock, and the new confidentiality rule arrived through the tool rather than through somebody saying so. Answers loom's completeness case. A 200 says the document moved and nothing about whether the casting still covers it — but the mechanism exists and we had not built the thing it needs. check prints the document's .usages.md when it stages a polad, and for an agreement that is the file the roles are cast in. It failed here because externals.md had no facet at all. So both are written: externals.usages.md naming which Go file implements which rule, and a v1 section on cart.usages.md recording the casting, that we got it wrong before it was written down, and that osprey and marmalade stay in history unrewritten. Implements the adopted confidentiality rule as far as it can be implemented. add warns when a fetch needed a credential, and says plainly that it cannot see who may read the repository the copy lands in. Reference-only adoption is recorded as not yet implemented rather than as a gap, because the gap is ours. Adopts gitea.md, now that homelab-cluster is public — the document that cost three tool calls and a guess this morning, with a facet recording that its :2222 fact is a fact for people and not for the tool, whose every transport is HTTPS on 443. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UTxuSizozEA8yDitPuris
This commit is contained in:
Vendored
+32
@@ -168,6 +168,7 @@ func Add(root, raw, override string, out io.Writer) error {
|
||||
|
||||
fmt.Fprintf(out, "adopted %s\n", rel)
|
||||
fmt.Fprintf(out, " from %s\n", body.url)
|
||||
warnIfNotPublic(cfg, body.url, out)
|
||||
if etag == "" {
|
||||
fmt.Fprintf(out, " etag (none served — check cannot ask conditionally)\n")
|
||||
} else {
|
||||
@@ -176,6 +177,37 @@ func Add(root, raw, override string, out io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// warnIfNotPublic says so when a document could only be fetched with a
|
||||
// credential.
|
||||
//
|
||||
// Adopting is copying, so a document from a repository somebody may not read
|
||||
// ends up in a repository they may, and the publisher loses control of it at the
|
||||
// moment of adoption. The tool can see half of that — whether this fetch needed
|
||||
// a credential — and cannot see the other half, which is who can read the
|
||||
// repository the copy is landing in. It reports the half it knows.
|
||||
func warnIfNotPublic(cfg *config.Config, raw string, out io.Writer) {
|
||||
req, err := http.NewRequest(http.MethodHead, raw, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if cfg.TokenFor(req.URL.Host) == "" {
|
||||
return // no credential was used, so the fetch was already anonymous
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(out, " WARN this needed a credential — anonymously it is %s.\n", resp.Status)
|
||||
fmt.Fprintf(out, " Confidentiality does not travel with the copy: writing it into\n")
|
||||
fmt.Fprintf(out, " .loom/externals/ republishes it to anyone who can read THIS\n")
|
||||
fmt.Fprintf(out, " repository. Do not adopt from a source less readable than the\n")
|
||||
fmt.Fprintf(out, " repository you are adopting into.\n")
|
||||
}
|
||||
|
||||
type fetched struct {
|
||||
data []byte
|
||||
url string
|
||||
|
||||
Reference in New Issue
Block a user