Seeming gap in Hartshorne's Algebraic Geometry, proof of Proposition 1.10 The claim is that if $Y$ is a quasi-affine variety (an open subset of an affine variety), then dim $Y = $ dim $\overline{Y}$. Here dimension is defined as the maximal length of an ascending chain of irreducible closed subsets, minus one.
Hartshorne starts with the observation that dim $Y \le $ dim $\overline{Y}$ (a chain of irreducible closed subsets of $Y$ induces a chain of irreducible closed subsets of $\overline{Y}$ by taking closures). He then states that a maximal chain of such subsets of $Y$ induces a maximal chain of $\overline{Y}$ (this claim is not explicitly proven, but I think I have worked through the details). The chain of irreducible closed subsets of $Y$ is $Z_0 \subset Z_1 \subset... \subset Z_n$, where $Z_0$ is a singleton and $n + 1$ is the maximal length of such a chain. Then $\mathfrak{m} = I(\overline{Z_0}) \subset I(\overline{Z_1}) \subset... \subset I(\overline{Z_n})$ is an ascending chain of prime ideals, where $\mathfrak{m}$ is a maximal ideal. Hartshorne concludes, by maximality of the chain of closed subsets of $\overline{Y}$, that height $\mathfrak{m} = n$.
Here is where I find the gap. Just because the chain of closed subsets of $\overline{Y}$ is maximal, in the sense that it cannot be extended to a longer chain, does not obviously mean that it is of maximal length over all such chains. If it is not of maximal length we only know height $\mathfrak{m} \ge n$. Am I correct that Hartshorne has failed to account for this, and is there a way to fill the gap?
 A: You are correct that there are topological spaces where there are maximal chains of inclusions of irreducible closed subsets which have different lengths. It happens that we are not working in such a setting, though.
Definition A topological space is said to be catenary if for every pair of irreducible closed subsets $T\subset T'$ there exists a maximal chain of irreducible closed subsets $$T=T_0\subset\cdots\subset T_e=T'$$ and every such chain has the same length.
Definition Let $S$ be a locally noetherian scheme. We say $S$ is universally catenary if for every morphism $X\to S$ locally of finite type, the scheme $X$ is catenary.
Essentially every scheme you meet in practice (any scheme locally of finite type over a field, any scheme locally of finite type over a Cohen-Macaulay scheme, any scheme locally of finite type over $\Bbb Z$, any scheme locally of finite type over a $1$-dimensional noetherian domain, etc etc etc) will be universally catenary. In particular, this implies that varieties in the sense of Hartshorne chapter I are also catenary.
In context, Theorem I.1.8A, which for a finitely generated $k$-algebra $B$ which is also an integral domain shows that $\dim B=\operatorname{tr.deg} K(B)/k$ and for any prime $\mathfrak{p}\subset B$, $\operatorname{height}\mathfrak{p}+\dim B/\mathfrak{p} = \dim B$, implies that Hartshorne's varieties are catenary.

One might reasonably object that all this talk about universally catenary schemes is too advanced for the proof of proposition I.1.10. Here's a way to work around this, using only material from Chapter I section 1. Write $Y=X\setminus Z$ where $X$ is an affine variety and $Z$ is a closed subset. Then one can cover $Y$ by affine varieties of the form $D(f_i)\subset X$: pick a finite set $\{f_i\}$ of nonzero generators for $I(Z)$, the ideal of $Z$ in $X$. Then each $D(f_i)$ is an affine variety with coordinate algebra $k[X]_{f_i}$, which is a finitely generated $k$-algebra which is also an integral domain, having the same field of fractions as $k[X]$. Thus by theorem I.1.8A, $D(f_i)$ has dimension equal to $\dim X$, and by exercise I.1.10, which shows that if $T$ is a topological space covered by open subsets $\{T_i\}$, $\dim T=\sup_i \dim T_i$, we get that $\dim Y=\dim X$.
